/[gcl]/gcl/ansi-tests/cons-test-01.lsp
ViewVC logotype

Diff of /gcl/ansi-tests/cons-test-01.lsp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by pfdietz, Mon Jan 13 14:11:49 2003 UTC revision 1.7 by pfdietz, Fri Jan 24 04:22:54 2003 UTC
# Line 116  Line 116 
116    
117  ;; All the cons-related macros have a macro binding  ;; All the cons-related macros have a macro binding
118  (deftest macro-bound-cons-macros  (deftest macro-bound-cons-macros
119      (not (every #'macro-function    (notnot-mv (every #'macro-function
120                        (list 'push 'pop 'pushnew 'remf)))                      (list 'push 'pop 'pushnew 'remf)))
121    nil)    t)
122    
123  ;; None of the cons-related functions have macro bindings  ;; None of the cons-related functions have macro bindings
124  (deftest no-cons-fns-are-macros  (deftest no-cons-fns-are-macros
125      (some #'macro-function *cons-fns*)    (some #'macro-function *cons-fns*)
126    nil)    nil)
127    
128  ;; Various easy tests of cons  ;; Various easy tests of cons
129  (deftest cons-of-symbols  (deftest cons-of-symbols
130      (cons 'a 'b)    (cons 'a 'b)
131    (a . b))    (a . b))
132    
133  (deftest cons-with-nil  (deftest cons-with-nil
134      (cons 'a nil)    (cons 'a nil)
135    (a))    (a))
136    
137  ;; successive calls to cons produces results that are equal, but not eq  ;; successive calls to cons produces results that are equal, but not eq
138  (deftest cons-eq-equal  (deftest cons-eq-equal
139      (let ((x (cons 'a 'b))    (let ((x (cons 'a 'b))
140            (y (cons 'a 'b)))          (y (cons 'a 'b)))
141        (and (not (eqt x y))      (and (not (eqt x y))
142             (equal x y)           (equalt x y)))
            t))  
143    t)    t)
144    
145  ;; list can be expressed as a bunch of conses (with nil)  ;; list can be expressed as a bunch of conses (with nil)
146  (deftest cons-equal-list  (deftest cons-equal-list
147      (equal (cons 'a (cons 'b (cons 'c nil)))    (equalt (cons 'a (cons 'b (cons 'c nil)))
148             (list 'a 'b 'c))            (list 'a 'b 'c))
149    t)    t)
150    
151  ;; Lists satisfy consp  ;; Lists satisfy consp
152  (deftest consp-list  (deftest consp-list
153      (not (not (consp '(a))))    (notnot-mv (consp '(a)))
154    t)    t)
155    
156  ;; cons satisfies consp  ;; cons satisfies consp
157  (deftest consp-cons  (deftest consp-cons
158      (not (not (consp (cons nil nil))))    (notnot-mv (consp (cons nil nil)))
159    t)    t)
160    
161  ;; nil is not a consp  ;; nil is not a consp
162  (deftest consp-nil  (deftest consp-nil
163      (consp nil)    (consp nil)
164    nil)    nil)
165    
166  ;; The empty list is not a cons  ;; The empty list is not a cons
167  (deftest consp-empty-list  (deftest consp-empty-list
168      (consp (list))    (consp (list))
169    nil)    nil)
170    
171  ;; A single element list is a cons  ;; A single element list is a cons
172  (deftest consp-single-element-list  (deftest consp-single-element-list
173      (not (not (consp (list 'a))))    (notnot-mv (consp (list 'a)))
174    t)    t)
175    
176  ;; For everything in *universe*, it is either an atom, or satisfies  ;; For everything in *universe*, it is either an atom, or satisfies
177  ;; consp, but not both  ;; consp, but not both
178  (deftest consp-xor-atom-universe  (deftest consp-xor-atom-universe
179    (notnot    (notnot-mv
180     (every #'(lambda (x) (or (and (consp x) (not (atom x)))     (every #'(lambda (x) (or (and (consp x) (not (atom x)))
181                              (and (not (consp x)) (atom x))))                              (and (not (consp x)) (atom x))))
182            *universe*))            *universe*))
# Line 185  Line 184 
184    
185  ;; Everything in type cons satisfies consp, and vice versa  ;; Everything in type cons satisfies consp, and vice versa
186  (deftest consp-cons-universe  (deftest consp-cons-universe
187      (check-type-predicate 'consp 'cons)    (check-type-predicate 'consp 'cons)
188    0)    0)
189    
190  (deftest consp.error.1  (deftest consp.error.1

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26