~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to ansi-tests/equal.lsp

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;-*- Mode:     Lisp -*-
 
2
;;;; Author:   Paul Dietz
 
3
;;;; Created:  Thu Oct 17 21:38:16 2002
 
4
;;;; Contains: Tests for EQUAL
 
5
 
 
6
(in-package :cl-test)
 
7
 
 
8
(deftest equal.1
 
9
  (loop for x in *symbols*
 
10
        always (loop for y in *symbols*
 
11
                     always (if (eq x y) (equal x y)
 
12
                              (not (equal x y)))))
 
13
  t)
 
14
 
 
15
(deftest equal.2
 
16
  (equalt (cons 'a 'b) (cons 'a 'b))
 
17
  t)
 
18
 
 
19
(deftest equal.3
 
20
  (equalt (cons 'a 'c) (cons 'a 'b))
 
21
  nil)
 
22
 
 
23
(deftest equal.4
 
24
  (equalt (vector 1 2 3) (vector 1 2 3))
 
25
  nil)
 
26
 
 
27
(deftest equal.5
 
28
  (loop for c in *characters*
 
29
        always (loop for d in *characters*
 
30
                     always (if (eql c d) (equalt c d)
 
31
                              (not (equalt c d)))))
 
32
  t)
 
33
 
 
34
(deftest equal.6
 
35
  (equalt (make-pathname :name (copy-seq "foo"))
 
36
          (make-pathname :name (copy-seq "foo")))
 
37
  t)
 
38
 
 
39
(deftest equal.7
 
40
  (equalt (make-pathname :name (copy-seq "foo"))
 
41
          (make-pathname :name (copy-seq "bar")))
 
42
  nil)
 
43
 
 
44
(deftest equal.8
 
45
  (equalt (copy-seq "abcd") (copy-seq "abcd"))
 
46
  t)
 
47
 
 
48
(deftest equal.9
 
49
  (equalt (copy-seq "abcd") (copy-seq "abc"))
 
50
  nil)
 
51
 
 
52
(deftest equal.10
 
53
  (equalt (copy-seq "abcd") (copy-seq "ABCD"))
 
54
  nil)
 
55
 
 
56
(deftest equal.11
 
57
  (equalt (copy-seq #*000110) (copy-seq #*000110))
 
58
  t)
 
59
 
 
60
(deftest equal.12
 
61
  (equalt (copy-seq #*000110) (copy-seq #*000111))
 
62
  nil)
 
63
 
 
64
(deftest equal.13
 
65
  :notes (:nil-vectors-are-strings)
 
66
  (let ((x (make-array '(0) :element-type nil))
 
67
        (y (make-array '(0) :element-type nil)))
 
68
    (equalt x y))
 
69
  t)
 
70
 
 
71
(deftest equal.14
 
72
  :notes (:nil-vectors-are-strings)
 
73
  (and
 
74
   (equalt (make-array '(0) :element-type nil) "")
 
75
   (equalt "" (make-array '(0) :element-type nil)))
 
76
  t)
 
77
 
 
78
(deftest equal.order.1
 
79
  (let ((i 0) x y)
 
80
    (values
 
81
     (equal (setf x (incf i)) (setf y (incf i)))
 
82
     i x y))
 
83
  nil 2 1 2)
 
84
 
 
85
;;; Error tests
 
86
 
 
87
(deftest equal.error.1
 
88
  (signals-error (equal) program-error)
 
89
  t)
 
90
 
 
91
(deftest equal.error.2
 
92
  (signals-error (equal nil) program-error)
 
93
  t)
 
94
 
 
95
(deftest equal.error.3
 
96
  (signals-error (equal nil nil nil) program-error)
 
97
  t)