source: trunk/source/tests/ansi-tests/mismatch.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 17.3 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Mon Aug 26 23:55:29 2002
4;;;; Contains: Tests for MISMATCH
5
6(in-package :cl-test)
7
8(deftest mismatch-list.1
9  (mismatch '() '(a b c))
10  0)
11
12(deftest mismatch-list.2
13  (mismatch '(a b c d) '())
14  0)
15
16(deftest mismatch-list.3
17  (mismatch '(a b c) '(a b c))
18  nil)
19
20(deftest mismatch-list.4
21  (mismatch '(a b c) '(a b d))
22  2)
23
24(deftest mismatch-list.5
25  (mismatch '(a b c) '(b c) :start1 1)
26  nil)
27
28(deftest mismatch-list.6
29  (mismatch '(a b c d) '(z b c e) :start1 1 :start2 1)
30  3)
31
32(deftest mismatch-list.7
33  (mismatch '(a b c d) '(z b c e) :start1 1 :start2 1 :end1 3 :end2 3)
34  nil)
35
36(deftest mismatch-list.8
37  (mismatch '(1 2 3 4) '(5 6 7 8) :test #'(lambda (x y) (= x (- y 4))))
38  nil)
39
40(deftest mismatch-list.9
41  (mismatch '(1 2 3 4) '(5 6 17 8) :test #'(lambda (x y) (= x (- y 4))))
42  2)
43
44(deftest mismatch-list.10
45  (mismatch '(1 2 3 4) '(10 11 7 123) :test-not #'(lambda (x y) (= x (- y 4))))
46  2)
47
48(deftest mismatch-list.11
49  (mismatch '(1 2 3 4) '(5 6 17 8) :key #'evenp)
50  nil)
51
52(deftest mismatch-list.12
53  (mismatch '(1 2 3 4) '(5 6 12 8) :key 'oddp)
54  2)
55
56(deftest mismatch-list.13
57  (mismatch '(1 2 3 4) '(1 2 3 4) :test 'eql)
58  nil)
59
60(deftest mismatch-list.14
61  (mismatch '(1 2 3 4) '(5 6 7 8) :test-not 'eql)
62  nil)
63
64(deftest mismatch-list.15
65  (mismatch '(a b c d e f g h i j k) '(a b c c e f g h z j k))
66  3)
67
68(deftest mismatch-list.16
69  (mismatch '(a b c d e f g h i j k) '(a b c c y f g h z j k) :from-end t)
70  9)
71
72(deftest mismatch-list.17
73  (mismatch '(a b c) '(a b c a b c d) :from-end t)
74  3)
75
76(deftest mismatch-list.18
77  (mismatch '(a b c a b c d) '(a b c) :from-end t)
78  7)
79
80(deftest mismatch-list.19
81  (mismatch '(1 1 1) '(2 2 2 2 2 1 2 2) :from-end t :test-not 'eql)
82  1)
83
84(deftest mismatch-list.20
85  (mismatch '(1 1 1 1 1 1 1) '(2 3 3) :from-end t :key #'evenp)
86  5)
87
88(deftest mismatch-list.21
89  (mismatch '(1 1 1) '(2 2 2 2 2 1 2 2) :from-end t :test-not #'equal)
90  1)
91
92(deftest mismatch-list.22
93  (mismatch '(1 1 1 1 1 1 1) '(2 3 3) :from-end t :key 'evenp)
94  5)
95
96;;; tests on vectors
97
98(deftest mismatch-vector.1
99  (mismatch #() #(a b c))
100  0)
101
102(deftest mismatch-vector.2
103  (mismatch #(a b c d) #())
104  0)
105
106(deftest mismatch-vector.3
107  (mismatch #(a b c) #(a b c))
108  nil)
109
110(deftest mismatch-vector.4
111  (mismatch #(a b c) #(a b d))
112  2)
113
114(deftest mismatch-vector.5
115  (mismatch #(a b c) #(b c) :start1 1)
116  nil)
117
118(deftest mismatch-vector.6
119  (mismatch #(a b c d) #(z b c e) :start1 1 :start2 1)
120  3)
121
122(deftest mismatch-vector.7
123  (mismatch #(a b c d) #(z b c e) :start1 1 :start2 1 :end1 3 :end2 3)
124  nil)
125
126(deftest mismatch-vector.8
127  (mismatch #(1 2 3 4) #(5 6 7 8) :test #'(lambda (x y) (= x (- y 4))))
128  nil)
129
130(deftest mismatch-vector.9
131  (mismatch #(1 2 3 4) #(5 6 17 8) :test #'(lambda (x y) (= x (- y 4))))
132  2)
133
134(deftest mismatch-vector.10
135  (mismatch #(1 2 3 4) #(10 11 7 123) :test-not #'(lambda (x y) (= x (- y 4))))
136  2)
137
138(deftest mismatch-vector.11
139  (mismatch #(1 2 3 4) #(5 6 17 8) :key #'evenp)
140  nil)
141
142(deftest mismatch-vector.12
143  (mismatch #(1 2 3 4) #(5 6 12 8) :key 'oddp)
144  2)
145
146(deftest mismatch-vector.13
147  (mismatch #(1 2 3 4) #(1 2 3 4) :test 'eql)
148  nil)
149
150(deftest mismatch-vector.14
151  (mismatch #(1 2 3 4) #(5 6 7 8) :test-not 'eql)
152  nil)
153
154(deftest mismatch-vector.15
155  (mismatch #(a b c d e f g h i j k) #(a b c c e f g h z j k))
156  3)
157
158(deftest mismatch-vector.16
159  (mismatch #(a b c d e f g h i j k) #(a b c c y f g h z j k) :from-end t)
160  9)
161
162(deftest mismatch-vector.17
163  (mismatch #(a b c) #(a b c a b c d) :from-end t)
164  3)
165
166(deftest mismatch-vector.18
167  (mismatch #(a b c a b c d) #(a b c) :from-end t)
168  7)
169
170(deftest mismatch-vector.19
171  (mismatch #(1 1 1) #(2 2 2 2 2 1 2 2) :from-end t :test-not 'eql)
172  1)
173
174(deftest mismatch-vector.20
175  (mismatch #(1 1 1 1 1 1 1) #(2 3 3) :from-end t :key #'evenp)
176  5)
177
178(deftest mismatch-vector.21
179  (mismatch #(1 1 1) #(2 2 2 2 2 1 2 2) :from-end t :test-not #'equal)
180  1)
181
182(deftest mismatch-vector.22
183  (mismatch #(1 1 1 1 1 1 1) #(2 3 3) :from-end t :key 'evenp)
184  5)
185
186(deftest mismatch-vector.23
187  (let ((a (make-array '(9) :initial-contents '(1 2 3 4 5 6 7 8 9)
188                       :fill-pointer 5)))
189    (values
190     (mismatch '(1 2 3 4 5) a)
191     (mismatch '(1 2 3 4 5) a :from-end t)
192     (mismatch '(1 2 3 4) a)
193     (mismatch '(1 2 3 4 5 6) a)
194     (mismatch '(6 7 8 9) a :from-end t)
195     (mismatch '(2 3 4 5) a :from-end t)))
196  nil nil 4 5 4 0)
197
198(deftest mismatch-vector.24
199  (let ((m (make-array '(6) :initial-contents '(1 2 3 4 5 6)
200                       :fill-pointer 4))
201        (a '(1 2 3 4 5)))
202    (list
203     (mismatch m a)
204     (mismatch m a :from-end t)
205     (setf (fill-pointer m) 5)
206     (mismatch m a)
207     (mismatch m a :from-end t)
208     (setf (fill-pointer m) 6)
209     (mismatch m a)
210     (mismatch m a :from-end t)))
211  (4 4 5 nil nil 6 5 6))     
212
213;;; tests on bit vectors
214
215(deftest mismatch-bit-vector.1
216  (mismatch "" #*111)
217  0)
218
219(deftest mismatch-bit-vector.1a
220  (mismatch '() #*111)
221  0)
222
223(deftest mismatch-bit-vector.1b
224  (mismatch "" '(1 1 1))
225  0)
226
227(deftest mismatch-bit-vector.2
228  (mismatch #*1010 #*)
229  0)
230
231(deftest mismatch-bit-vector.2a
232  (mismatch #*1010 '())
233  0)
234
235(deftest mismatch-bit-vector.2b
236  (mismatch '(1 0 1 0) #*)
237  0)
238
239(deftest mismatch-bit-vector.3
240  (mismatch #*101 #*101)
241  nil)
242
243(deftest mismatch-bit-vector.4
244  (mismatch #*101 #*100)
245  2)
246
247(deftest mismatch-bit-vector.5
248  (mismatch #*101  #*01 :start1 1)
249  nil)
250
251(deftest mismatch-bit-vector.6
252  (mismatch #*0110 #*0111 :start1 1 :start2 1)
253  3)
254
255(deftest mismatch-bit-vector.7
256  (mismatch #*0110 #*0111 :start1 1 :start2 1 :end1 3 :end2 3)
257  nil)
258
259(deftest mismatch-bit-vector.7a
260  (mismatch '(0 1 1 0) #*0111 :start1 1 :start2 1 :end1 3 :end2 3)
261  nil)
262
263(deftest mismatch-bit-vector.7b
264  (mismatch #*0110 '(0 1 1 1) :start1 1 :start2 1 :end1 3 :end2 3)
265  nil)
266
267(deftest mismatch-bit-vector.8
268  (mismatch #*1001 #*0110 :test #'(lambda (x y) (= x (- 1 y))))
269  nil)
270
271(deftest mismatch-bit-vector.8a
272  (mismatch #*1001 '(5 4 4 5) :test #'(lambda (x y) (= x (- y 4))))
273  nil)
274
275(deftest mismatch-bit-vector.9
276  (mismatch #*1001 '(5 4 17 5) :test #'(lambda (x y) (= x (- y 4))))
277  2)
278
279(deftest mismatch-bit-vector.9a
280  (mismatch '(5 4 17 5) #*1001 :test #'(lambda (x y) (= y (- x 4))))
281  2)
282
283(deftest mismatch-bit-vector.9b
284  (mismatch #*0100 #*1001 :test #'(lambda (x y) (= x (- 1 y))))
285  2)
286
287(deftest mismatch-bit-vector.10
288  (mismatch #*1001 '(10 11 4 123) :test-not #'(lambda (x y) (= x (- y 4))))
289  2)
290
291(deftest mismatch-bit-vector.10a
292  (mismatch #*1001 '(10 11 100 123) :test-not #'(lambda (x y) (= x (- y 4))))
293  nil)
294
295(deftest mismatch-bit-vector.11
296  (mismatch #*1010 '(5 6 17 8) :key #'evenp)
297  nil)
298
299(deftest mismatch-bit-vector.11a
300  (mismatch '(5 6 17 8) #*1010 :key #'evenp)
301  nil)
302
303(deftest mismatch-bit-vector.11b
304  (mismatch #*0101 #*1010 :key #'evenp :test-not 'eql)
305  nil)
306
307(deftest mismatch-bit-vector.11c
308  (mismatch '(5 6 17 8) #*10101 :key #'evenp)
309  4)
310
311(deftest mismatch-bit-vector.11d
312  (mismatch '(5 6 17 8 100) #*1010 :key #'evenp)
313  4)
314
315(deftest mismatch-bit-vector.12
316  (mismatch #*1010 #*1000 :key 'oddp)
317  2)
318
319(deftest mismatch-bit-vector.12a
320  (mismatch #*1010 '(5 6 8 8) :key 'oddp)
321  2)
322
323(deftest mismatch-bit-vector.12b
324  (mismatch '(5 6 8 8) #*1010 :key 'oddp)
325  2)
326
327(deftest mismatch-bit-vector.13
328  (mismatch #*0001 #*0001 :test 'eql)
329  nil)
330
331(deftest mismatch-bit-vector.14
332  (mismatch '#*10001 #*01110 :test-not 'eql)
333  nil)
334
335(deftest mismatch-bit-vector.15
336  (mismatch #*00100010100 #*00110010000)
337  3)
338
339(deftest mismatch-bit-vector.16
340  (mismatch #*00100010100 #*00110010000 :from-end t)
341  9)
342
343(deftest mismatch-bit-vector.17
344  (mismatch #*001 #*0010010 :from-end t)
345  3)
346
347(deftest mismatch-bit-vector.18
348  (mismatch #*0010010 #*001 :from-end t)
349  7)
350
351(deftest mismatch-bit-vector.19
352  (mismatch #*000 #*11111011 :from-end t :test-not 'eql)
353  1)
354
355(deftest mismatch-bit-vector.20
356  (mismatch #*1111111 '(2 3 3) :from-end t :key #'evenp)
357  5)
358
359(deftest mismatch-bit-vector.21
360  (mismatch #*111 #*00000100 :from-end t :test-not #'equal)
361  1)
362
363(deftest mismatch-bit-vector.22
364  (mismatch #*1111111 '(2 3 3) :from-end t :key 'evenp)
365  5)
366
367(deftest mismatch-bit-vector.23
368  (let ((a (make-array '(9) :initial-contents #*001011000
369                       :fill-pointer 5
370                       :element-type 'bit)))
371    (values
372     (mismatch #*00101 a)
373     (mismatch #*00101 a :from-end t)
374     (mismatch #*0010 a)
375     (mismatch #*001011 a)
376     (mismatch #*1000 a :from-end t)
377     (mismatch #*0010 a :from-end t)))
378  nil nil 4 5 4 4)
379
380(deftest mismatch-bit-vector.24
381  (let ((m (make-array '(6) :initial-contents #*001011
382                       :fill-pointer 4
383                       :element-type 'bit))
384        (a #*00101))
385    (list
386     (mismatch m a)
387     (mismatch m a :from-end t)
388     (setf (fill-pointer m) 5)
389     (mismatch m a)
390     (mismatch m a :from-end t)
391     (setf (fill-pointer m) 6)
392     (mismatch m a)
393     (mismatch m a :from-end t)))
394  (4 4 5 nil nil 6 5 5))
395
396;;; tests on strings
397
398(deftest mismatch-string.1
399  (mismatch "" "111")
400  0)
401
402(deftest mismatch-string.1a
403  (mismatch '() "111")
404  0)
405
406(deftest mismatch-string.1b
407  (mismatch "" '(1 1 1))
408  0)
409
410(deftest mismatch-string.2
411  (mismatch "1010" "")
412  0)
413
414(deftest mismatch-string.2a
415  (mismatch "1010" '())
416  0)
417
418(deftest mismatch-string.2b
419  (mismatch '(1 0 1 0) "")
420  0)
421
422(deftest mismatch-string.3
423  (mismatch "101" "101")
424  nil)
425
426(deftest mismatch-string.4
427  (mismatch "101" "100")
428  2)
429
430(deftest mismatch-string.5
431  (mismatch "101" "01" :start1 1)
432  nil)
433
434(deftest mismatch-string.6
435  (mismatch "0110" "0111" :start1 1 :start2 1)
436  3)
437
438(deftest mismatch-string.7
439  (mismatch "0110" "0111" :start1 1 :start2 1 :end1 3 :end2 3)
440  nil)
441
442(deftest mismatch-string.7a
443  (mismatch '(#\0 #\1 #\1 #\0) "0111" :start1 1 :start2 1 :end1 3 :end2 3)
444  nil)
445
446(deftest mismatch-string.7b
447  (mismatch "0110" '(#\0 #\1 #\1 #\1) :start1 1 :start2 1 :end1 3 :end2 3)
448  nil)
449
450(deftest mismatch-string.8
451  (mismatch "1001" "0110" :test #'(lambda (x y) (eql x (if (eql y #\0)
452                                                           #\1 #\0))))
453  nil)
454
455(deftest mismatch-string.8a
456  (mismatch "1001" '(5 4 4 5) :test #'(lambda (x y)
457                                        (setq x (read-from-string (string x)))
458                                        (= x (- y 4))))
459  nil)
460
461(deftest mismatch-string.9
462  (mismatch "1001" '(5 4 17 5) :test #'(lambda (x y)
463                                         (setq x (read-from-string (string x)))
464                                         (= x (- y 4))))
465  2)
466
467(deftest mismatch-string.9a
468  (mismatch '(5 4 17 5) "1001" :test #'(lambda (x y)
469                                         (setq y (read-from-string (string y)))
470                                         (= y (- x 4))))
471  2)
472
473(deftest mismatch-string.9b
474  (mismatch "0100" "1001" :test #'(lambda (x y) (eql x (if (eql y #\0) #\1 #\0))))
475  2)
476
477(deftest mismatch-string.10
478  (mismatch "1001" "0049" :test-not #'(lambda (x y)
479                                         (setq x (read-from-string (string x)))
480                                         (setq y (read-from-string (string y)))
481                                         (eql x (- y 4))))
482  2)
483
484(deftest mismatch-string.10a
485  (mismatch "1001" "3333" :test-not #'(lambda (x y)
486                                        (setq x (read-from-string (string x)))
487                                        (setq y (read-from-string (string y)))
488                                        (eql x (- y 4))))
489  nil)
490
491(deftest mismatch-string.11
492  (mismatch "1010" "5678"  :key #'evendigitp)
493  nil)
494
495(deftest mismatch-string.11a
496  (mismatch "5678" "1010" :key #'odddigitp)
497  nil)
498
499(deftest mismatch-string.11b
500  (mismatch "0101" "1010" :key #'evendigitp :test-not 'eql)
501  nil)
502
503(deftest mismatch-string.11c
504  (mismatch "5678" "10101" :key #'evendigitp)
505  4)
506
507(deftest mismatch-string.11d
508  (mismatch "56122" "1010" :key #'evendigitp)
509  4)
510
511(deftest mismatch-string.11e
512  (mismatch "0101" '(#\1 #\0 #\1 #\0) :key #'evendigitp :test-not 'eql)
513  nil)
514
515(deftest mismatch-string.12
516  (mismatch "1010" "1000" :key 'odddigitp)
517  2)
518
519(deftest mismatch-string.12a
520  (mismatch "1010" "5688" :key 'odddigitp)
521  2)
522
523(deftest mismatch-string.12b
524  (mismatch '(#\5 #\6 #\8 #\8) "1010" :key 'odddigitp)
525  2)
526
527(deftest mismatch-string.13
528  (mismatch "0001" "0001" :test 'eql)
529  nil)
530
531(deftest mismatch-string.14
532  (mismatch "10001" "01110" :test-not 'eql)
533  nil)
534
535(deftest mismatch-string.15
536  (mismatch "00100010100" "00110010000")
537  3)
538
539(deftest mismatch-string.16
540  (mismatch "00100010100" "00110010000" :from-end t)
541  9)
542
543(deftest mismatch-string.17
544  (mismatch "001" "0010010" :from-end t)
545  3)
546
547(deftest mismatch-string.18
548  (mismatch "0010010" "001" :from-end t)
549  7)
550
551(deftest mismatch-string.19
552  (mismatch "000" "11111011" :from-end t :test-not 'eql)
553  1)
554
555(deftest mismatch-string.20
556  (mismatch "1111111" "233" :from-end t :key #'evendigitp)
557  5)
558
559(deftest mismatch-string.20a
560  (mismatch "1111111" '(#\2 #\3 #\3) :from-end t :key #'evendigitp)
561  5)
562
563(deftest mismatch-string.21
564  (mismatch "111" "00000100" :from-end t :test-not #'equal)
565  1)
566
567(deftest mismatch-string.22
568  (mismatch "1111111" "233" :from-end t :key 'evendigitp)
569  5)
570
571(deftest mismatch-string.23
572  (let ((a (make-array '(9) :initial-contents "123456789"
573                       :fill-pointer 5
574                       :element-type 'character)))
575    (values
576     (mismatch "12345" a)
577     (mismatch "12345" a :from-end t)
578     (mismatch "1234" a)
579     (mismatch "123456" a)
580     (mismatch "6789" a :from-end t)
581     (mismatch "2345" a :from-end t)))
582  nil nil 4 5 4 0)
583
584(deftest mismatch-string.24
585  (let ((m (make-array '(6) :initial-contents "123456"
586                       :fill-pointer 4
587                       :element-type 'character))
588        (a "12345"))
589    (list
590     (mismatch m a)
591     (mismatch m a :from-end t)
592     (setf (fill-pointer m) 5)
593     (mismatch m a)
594     (mismatch m a :from-end t)
595     (setf (fill-pointer m) 6)
596     (mismatch m a)
597     (mismatch m a :from-end t)))
598  (4 4 5 nil nil 6 5 6))
599
600(deftest mistmatch-string.25
601  (let ((s0 "12345")
602        (s1 "123A")
603        (s2 "245"))
604    (do-special-strings
605     (s s0 nil)
606     (assert (null (mismatch s s0)))
607     (assert (null (mismatch s0 s)))
608     (assert (null (mismatch s s0 :from-end t)))
609     (assert (null (mismatch s0 s :from-end t)))
610     (assert (eql (mismatch s s1) 3))
611     (assert (eql (mismatch s1 s) 3))
612     ))
613  nil)
614
615;;; test and test-not tests
616
617(defharmless mismatch.test-and-test-not.1
618  (mismatch '(1 2 3) '(1 2 4) :test #'eql :test-not #'eql))
619
620(defharmless mismatch.test-and-test-not.2
621  (mismatch '(1 2 3) '(1 2 4) :test-not #'eql :test #'eql))
622
623(defharmless mismatch.test-and-test-not.3
624  (mismatch #(1 2 3) #(1 2 4) :test #'eql :test-not #'eql))
625
626(defharmless mismatch.test-and-test-not.4
627  (mismatch #(1 2 3) #(1 2 4) :test-not #'eql :test #'eql))
628
629(defharmless mismatch.test-and-test-not.5
630  (mismatch "abc" "abd" :test #'eql :test-not #'eql))
631
632(defharmless mismatch.test-and-test-not.6
633  (mismatch "abc" "abd" :test-not #'eql :test #'eql))
634
635(defharmless mismatch.test-and-test-not.7
636  (mismatch #*011 #*010 :test #'eql :test-not #'eql))
637
638(defharmless mismatch.test-and-test-not.8
639  (mismatch #*011 #*010 :test-not #'eql :test #'eql))
640
641;;; Keyword tests
642
643(deftest mismatch.allow-other-keys.1
644  (mismatch "1234" "1244" :allow-other-keys t :bad t)
645  2)
646
647(deftest mismatch.allow-other-keys.2
648  (mismatch "1234" "1244" :bad t :allow-other-keys t)
649  2)
650
651(deftest mismatch.allow-other-keys.3
652  (mismatch "1234" "1244" :bad t :allow-other-keys t :allow-other-keys nil)
653  2)
654
655(deftest mismatch.allow-other-keys.4
656  (mismatch "1234" "1244" :allow-other-keys t :bad t
657            :allow-other-keys nil)
658  2)
659
660(deftest mismatch.allow-other-keys.5
661  (mismatch "1234" "1244" :allow-other-keys t
662            :allow-other-keys nil
663            :bad t)
664  2)
665
666(deftest mismatch.keywords.6
667  (mismatch "1234" "1244" :test #'equal :test (complement #'equal))
668  2)
669
670(deftest mismatch.allow-other-keys.7
671  (mismatch "1234" "1244" :bad t :allow-other-keys t
672            :test (complement #'equal))
673  0)
674
675;;; Order of evaluation
676
677(deftest mismatch.order.1
678  (let ((i 0) a b)
679    (values
680     (mismatch (progn (setf a (incf i)) "abcd")
681               (progn (setf b (incf i)) "abzd"))
682     i a b))
683  2 2 1 2)
684
685(deftest mismatch.order.2
686  (let ((i 0) a b c d e f g h j)
687    (values
688     (mismatch (progn (setf a (incf i)) "abcdef")
689               (progn (setf b (incf i)) "abcdef")
690               :key (progn (setf c (incf i)) #'identity)
691               :test (progn (setf d (incf i)) #'equal)
692               :start1 (progn (setf e (incf i)) 1)
693               :start2 (progn (setf f (incf i)) 1)
694               :end1 (progn (setf g (incf i)) 4)
695               :end2 (progn (setf h (incf i)) 4)
696               :from-end (setf j (incf i)))
697     i a b c d e f g h j))
698  nil 9 1 2 3 4 5 6 7 8 9)
699
700(deftest mismatch.order.3
701  (let ((i 0) a b c d e f g h j)
702    (values
703     (mismatch (progn (setf a (incf i)) "abcdef")
704               (progn (setf b (incf i)) "abcdef")
705               :from-end (setf c (incf i))
706               :end2 (progn (setf d (incf i)) 4)
707               :end1 (progn (setf e (incf i)) 4)
708               :start2 (progn (setf f (incf i)) 1)
709               :start1 (progn (setf g (incf i)) 1)
710               :test (progn (setf h (incf i)) #'equal)
711               :key (progn (setf j (incf i)) #'identity))
712     i a b c d e f g h j))
713  nil 9 1 2 3 4 5 6 7 8 9)
714
715
716;;; Error cases
717
718(deftest mismatch.error.1
719  (signals-error (mismatch) program-error)
720  t)
721
722(deftest mismatch.error.2
723  (signals-error (mismatch nil) program-error)
724  t)
725
726(deftest mismatch.error.3
727  (signals-error (mismatch nil nil :bad t) program-error)
728  t)
729
730(deftest mismatch.error.4
731  (signals-error (mismatch nil nil :bad t :allow-other-keys nil)
732                 program-error)
733  t)
734
735(deftest mismatch.error.5
736  (signals-error (mismatch nil nil :key) program-error)
737  t)
738
739(deftest mismatch.error.6
740  (signals-error (mismatch nil nil 1 2) program-error)
741  t)
742
743(deftest mismatch.error.7
744  (signals-error (mismatch '(a b) '(a b) :test #'identity) program-error)
745  t)
746
747(deftest mismatch.error.8
748  (signals-error (mismatch '(a b) '(a b) :test-not #'identity) program-error)
749  t)
750
751(deftest mismatch.error.9
752  (signals-error (mismatch '(a b) '(a b) :key #'car) type-error)
753  t)
754
755(deftest mismatch.error.10
756  (signals-error (mismatch '(a b) '(a b) :key #'cons) program-error)
757  t)
758
Note: See TracBrowser for help on using the repository browser.