24 |
(check-copy-list '(a b c . d)) |
(check-copy-list '(a b c . d)) |
25 |
(a b c . d)) |
(a b c . d)) |
26 |
|
|
27 |
|
(deftest copy-list.error.1 |
28 |
|
(classify-error (copy-list)) |
29 |
|
program-error) |
30 |
|
|
31 |
|
(deftest copy-list.error.2 |
32 |
|
(classify-error (copy-list nil nil)) |
33 |
|
program-error) |
34 |
|
|
35 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
36 |
;;; list, list* |
;;; list, list* |
37 |
|
|
70 |
(list-length '(a b c d e f)) |
(list-length '(a b c d e f)) |
71 |
6) |
6) |
72 |
|
|
|
|
|
73 |
;; check that list-length returns nil |
;; check that list-length returns nil |
74 |
;; on a circular list |
;; on a circular list |
75 |
|
|
85 |
;; Check that list-length produces a type-error |
;; Check that list-length produces a type-error |
86 |
;; on arguments that are not proper lists or circular lists |
;; on arguments that are not proper lists or circular lists |
87 |
|
|
88 |
(deftest list-length-error |
(deftest list-length.error.1 |
89 |
(loop |
(loop |
90 |
for x in (list 'a 1 1.0 #\w (make-array '(10)) |
for x in (list 'a 1 1.0 #\w (make-array '(10)) |
91 |
'(a b . c) (symbol-package 'cons)) |
'(a b . c) (symbol-package 'cons)) |
93 |
'type-error))) |
'type-error))) |
94 |
0) |
0) |
95 |
|
|
96 |
|
(deftest list-length.error.2 |
97 |
|
(classify-error (list-length)) |
98 |
|
program-error) |
99 |
|
|
100 |
|
(deftest list-length.error.3 |
101 |
|
(classify-error (list-length nil nil)) |
102 |
|
program-error) |
103 |
|
|
104 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
105 |
;;; listp |
;;; listp |
106 |
|
|
128 |
(not (not (listp '(a b c d e f g h)))) |
(not (not (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 |
138 |
|
(classify-error (listp)) |
139 |
|
program-error) |
140 |
|
|
141 |
|
(deftest listp.error.2 |
142 |
|
(classify-error (listp nil nil)) |
143 |
|
program-error) |
144 |
|
|
145 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
146 |
;;; (typep <obj> 'list) |
;;; (typep <obj> 'list) |
147 |
|
|
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))) |
(not (not (typep nil 'list))) |
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-type-error-1 |
(deftest make-list-other-keywords.1 |
193 |
(catch-type-error (make-list -1)) |
(make-list 5 :allow-other-keys t :foo 'a) |
194 |
|
(nil nil nil nil nil)) |
195 |
|
|
196 |
|
(deftest make-list-other-keywords.2 |
197 |
|
(make-list 5 :bar nil :allow-other-keys t) |
198 |
|
(nil nil nil nil nil)) |
199 |
|
|
200 |
|
(deftest make-list-repeated-keyword |
201 |
|
(make-list 5 :initial-element 'a :initial-element 'b) |
202 |
|
(a a a a a)) |
203 |
|
|
204 |
|
(deftest make-list-type.error.1 |
205 |
|
(catch-type-error (make-list -1)) |
206 |
type-error) |
type-error) |
207 |
|
|
208 |
;; This next test causes ACL 4.3 (Linux) to loop |
;; This next test causes ACL 4.3 (Linux) to loop |
209 |
#-allegro |
#-allegro |
210 |
(deftest make-list-type-error-2 |
(deftest make-list-type.error.2 |
211 |
(catch-type-error (make-list 'a)) |
(catch-type-error (make-list 'a)) |
212 |
type-error) |
type-error) |
213 |
|
|
214 |
|
(deftest make-list.error.3 |
215 |
|
(classify-error (make-list)) |
216 |
|
program-error) |
217 |
|
|
218 |
|
(deftest make-list.error.4 |
219 |
|
(classify-error (make-list 5 :bad t)) |
220 |
|
program-error) |
221 |
|
|
222 |
|
(deftest make-list.error.5 |
223 |
|
(classify-error (make-list 5 :initial-element)) |
224 |
|
program-error) |
225 |
|
|
226 |
|
(deftest make-list.error.6 |
227 |
|
(classify-error (make-list 5 1 2)) |
228 |
|
program-error) |
229 |
|
|
230 |
|
(deftest make-list.error.7 |
231 |
|
(classify-error (make-list 5 :bad t :allow-other-keys nil)) |
232 |
|
program-error) |