107 |
;; Check listp against various simple cases |
;; Check listp against various simple cases |
108 |
|
|
109 |
(deftest listp-nil |
(deftest listp-nil |
110 |
(not (not (listp nil))) |
(notnot-mv (listp nil)) |
111 |
t) |
t) |
112 |
|
|
113 |
(deftest listp-symbol |
(deftest listp-symbol |
114 |
(listp 'a) |
(listp 'a) |
115 |
nil) |
nil) |
116 |
|
|
117 |
(deftest listp-singleton-list |
(deftest listp-singleton-list |
118 |
(not (not (listp '(a)))) |
(notnot-mv (listp '(a))) |
119 |
t) |
t) |
120 |
|
|
121 |
(deftest listp-circular-list |
(deftest listp-circular-list |
122 |
(let ((x (cons nil nil))) |
(let ((x (cons nil nil))) |
123 |
(setf (cdr x) x) |
(setf (cdr x) x) |
124 |
(not (not (listp x)))) |
(notnot-mv (listp x))) |
125 |
t) |
t) |
126 |
|
|
127 |
(deftest listp-longer-list |
(deftest listp-longer-list |
128 |
(not (not (listp '(a b c d e f g h)))) |
(notnot-mv (listp '(a b c d e f g h))) |
129 |
t) |
t) |
130 |
|
|
131 |
;;; Check that (listp x) == (typep x 'list) |
;;; Check that (listp x) == (typep x 'list) |
132 |
|
|
133 |
(deftest listp-universe |
(deftest listp-universe |
134 |
(check-type-predicate 'listp 'list) |
(check-type-predicate 'listp 'list) |
135 |
0) |
0) |
136 |
|
|
137 |
(deftest listp.error.1 |
(deftest listp.error.1 |
148 |
;;; These tests are now somewhat redundant |
;;; These tests are now somewhat redundant |
149 |
|
|
150 |
(deftest typep-nil-list |
(deftest typep-nil-list |
151 |
(not (not (typep nil 'list))) |
(notnot-mv (typep nil 'list)) |
152 |
t) |
t) |
153 |
|
|
154 |
(deftest typep-symbol-list |
(deftest typep-symbol-list |
155 |
(typep 'a 'list) |
(typep 'a 'list) |
156 |
nil) |
nil) |
157 |
|
|
158 |
(deftest typep-singleton-list-list |
(deftest typep-singleton-list-list |
159 |
(not (not (typep '(a) 'list))) |
(notnot-mv (typep '(a) 'list)) |
160 |
t) |
t) |
161 |
|
|
162 |
(deftest typep-circular-list-list |
(deftest typep-circular-list-list |
163 |
(let ((x (cons nil nil))) |
(let ((x (cons nil nil))) |
164 |
(setf (cdr x) x) |
(setf (cdr x) x) |
165 |
(not (not (typep x 'list)))) |
(notnot-mv (typep x 'list))) |
166 |
t) |
t) |
167 |
|
|
168 |
(deftest typep-longer-list-list |
(deftest typep-longer-list-list |
169 |
(not (not (typep '(a b c d e f g h) 'list))) |
(notnot-mv (typep '(a b c d e f g h) 'list)) |
170 |
t) |
t) |
171 |
|
|
172 |
|
|
174 |
;;; make-list |
;;; make-list |
175 |
|
|
176 |
(deftest make-list-empty-1 |
(deftest make-list-empty-1 |
177 |
(make-list 0) |
(make-list 0) |
178 |
nil) |
nil) |
179 |
|
|
180 |
(deftest make-list-empty-2 |
(deftest make-list-empty-2 |
181 |
(make-list 0 :initial-element 'a) |
(make-list 0 :initial-element 'a) |
182 |
nil) |
nil) |
183 |
|
|
184 |
(deftest make-list-no-initial-element |
(deftest make-list-no-initial-element |
185 |
(make-list 6) |
(make-list 6) |
186 |
(nil nil nil nil nil nil)) |
(nil nil nil nil nil nil)) |
187 |
|
|
188 |
(deftest make-list-with-initial-element |
(deftest make-list-with-initial-element |
189 |
(make-list 6 :initial-element 'a) |
(make-list 6 :initial-element 'a) |
190 |
(a a a a a a)) |
(a a a a a a)) |
191 |
|
|
192 |
(deftest make-list.allow-other-keys.1 |
(deftest make-list.allow-other-keys.1 |
220 |
;; This next test causes ACL 4.3 (Linux) to loop |
;; This next test causes ACL 4.3 (Linux) to loop |
221 |
#-allegro |
#-allegro |
222 |
(deftest make-list-type.error.2 |
(deftest make-list-type.error.2 |
223 |
(catch-type-error (make-list 'a)) |
(classify-error (make-list 'a)) |
224 |
type-error) |
type-error) |
225 |
|
|
226 |
(deftest make-list.error.3 |
(deftest make-list.error.3 |