95 |
:key nil) |
:key nil) |
96 |
(2 2 b b)) |
(2 2 b b)) |
97 |
|
|
98 |
(deftest sublis-9 |
;;; Keyword tests |
99 |
(sublis nil 'a :bad-keyword t :allow-other-keys t) |
|
100 |
|
(deftest sublis.allow-other-keys.1 |
101 |
|
(sublis nil 'a :bad t :allow-other-keys t) |
102 |
|
a) |
103 |
|
|
104 |
|
(deftest sublis.allow-other-keys.2 |
105 |
|
(sublis nil 'a :allow-other-keys t :bad t) |
106 |
|
a) |
107 |
|
|
108 |
|
(deftest sublis.allow-other-keys.3 |
109 |
|
(sublis nil 'a :allow-other-keys t) |
110 |
|
a) |
111 |
|
|
112 |
|
(deftest sublis.allow-other-keys.4 |
113 |
|
(sublis nil 'a :allow-other-keys nil) |
114 |
|
a) |
115 |
|
|
116 |
|
(deftest sublis.allow-other-keys.5 |
117 |
|
(sublis nil 'a :allow-other-keys t :allow-other-keys t :bad t) |
118 |
a) |
a) |
119 |
|
|
120 |
|
(deftest sublis.keywords.6 |
121 |
|
(sublis '((1 . a)) (list 0 1 2) :key #'(lambda (x) (if (numberp x) (1+ x) x)) |
122 |
|
:key #'identity) |
123 |
|
(a 1 2)) |
124 |
|
|
125 |
|
|
126 |
;; Argument error cases |
;; Argument error cases |
127 |
|
|
128 |
(deftest sublis.error.1 |
(deftest sublis.error.1 |
205 |
:key nil) |
:key nil) |
206 |
(2 2 b b)) |
(2 2 b b)) |
207 |
|
|
208 |
|
;;; Keyword tests |
209 |
|
|
210 |
|
(deftest nsublis.allow-other-keys.1 |
211 |
|
(nsublis nil 'a :bad t :allow-other-keys t) |
212 |
|
a) |
213 |
|
|
214 |
|
(deftest nsublis.allow-other-keys.2 |
215 |
|
(nsublis nil 'a :allow-other-keys t :bad t) |
216 |
|
a) |
217 |
|
|
218 |
|
(deftest nsublis.allow-other-keys.3 |
219 |
|
(nsublis nil 'a :allow-other-keys t) |
220 |
|
a) |
221 |
|
|
222 |
|
(deftest nsublis.allow-other-keys.4 |
223 |
|
(nsublis nil 'a :allow-other-keys nil) |
224 |
|
a) |
225 |
|
|
226 |
|
(deftest nsublis.allow-other-keys.5 |
227 |
|
(nsublis nil 'a :allow-other-keys t :allow-other-keys t :bad t) |
228 |
|
a) |
229 |
|
|
230 |
|
(deftest nsublis.keywords.6 |
231 |
|
(nsublis '((1 . a)) (list 0 1 2) |
232 |
|
:key #'(lambda (x) (if (numberp x) (1+ x) x)) |
233 |
|
:key #'identity) |
234 |
|
(a 1 2)) |
235 |
|
|
236 |
;; Argument error cases |
;; Argument error cases |
237 |
|
|
238 |
(deftest nsublis.error.1 |
(deftest nsublis.error.1 |
314 |
:key nil) |
:key nil) |
315 |
(a a c d a a)) |
(a a c d a a)) |
316 |
|
|
317 |
(deftest subst-10 |
;;; Keyword tests for subst |
318 |
(subst 'a 'b nil :bad t :allow-other-keys t) |
|
319 |
nil) |
(deftest subst.allow-other-keys.1 |
320 |
|
(subst 'a 'b (list 'a 'b 'c) :bad t :allow-other-keys t) |
321 |
|
(a a c)) |
322 |
|
|
323 |
|
(deftest subst.allow-other-keys.2 |
324 |
|
(subst 'a 'b (list 'a 'b 'c) :allow-other-keys t) |
325 |
|
(a a c)) |
326 |
|
|
327 |
|
(deftest subst.allow-other-keys.3 |
328 |
|
(subst 'a 'b (list 'a 'b 'c) :allow-other-keys nil) |
329 |
|
(a a c)) |
330 |
|
|
331 |
|
(deftest subst.allow-other-keys.4 |
332 |
|
(subst 'a 'b (list 'a 'b 'c) :allow-other-keys t :bad t) |
333 |
|
(a a c)) |
334 |
|
|
335 |
|
(deftest subst.allow-other-keys.5 |
336 |
|
(subst 'a 'b (list 'a 'b 'c) :allow-other-keys t :allow-other-keys nil |
337 |
|
:bad t) |
338 |
|
(a a c)) |
339 |
|
|
340 |
|
(deftest subst.keywords.6 |
341 |
|
(subst 'a 'b (list 'a 'b 'c) :test #'eq :test (complement #'eq)) |
342 |
|
(a a c)) |
343 |
|
|
344 |
|
|
345 |
|
;;; Tests for subst-if, subst-if-not |
346 |
|
|
347 |
(deftest subst-if-1 |
(deftest subst-if-1 |
348 |
(check-subst-if 'a #'consp '((100 1) (2 3) (4 3 2 1) (a b c))) |
(check-subst-if 'a #'consp '((100 1) (2 3) (4 3 2 1) (a b c))) |
410 |
:key nil) |
:key nil) |
411 |
((a) (a) (c) (d))) |
((a) (a) (c) (d))) |
412 |
|
|
|
(deftest subst-if-7 |
|
|
(subst-if 'a #'null nil :bad t :allow-other-keys t) |
|
|
a) |
|
|
|
|
413 |
(deftest subst-if-not-5 |
(deftest subst-if-not-5 |
414 |
(check-subst-if-not 'a #'(lambda (x) (not (eql x 'b))) |
(check-subst-if-not 'a #'(lambda (x) (not (eql x 'b))) |
415 |
'((a) (b) (c) (d)) |
'((a) (b) (c) (d)) |
416 |
:key nil) |
:key nil) |
417 |
((a) (a) (c) (d))) |
((a) (a) (c) (d))) |
418 |
|
|
419 |
(deftest subst-if-not-7 |
;;; Keyword tests for subst-if |
|
(subst-if 'a #'identity nil :bad t :allow-other-keys t) |
|
|
nil) |
|
420 |
|
|
421 |
|
(deftest subst-if.allow-other-keys.1 |
422 |
|
(subst-if 'a #'null nil :bad t :allow-other-keys t) |
423 |
|
a) |
424 |
|
|
425 |
|
(deftest subst-if.allow-other-keys.2 |
426 |
|
(subst-if 'a #'null nil :allow-other-keys t) |
427 |
|
a) |
428 |
|
|
429 |
|
(deftest subst-if.allow-other-keys.3 |
430 |
|
(subst-if 'a #'null nil :allow-other-keys nil) |
431 |
|
a) |
432 |
|
|
433 |
|
(deftest subst-if.allow-other-keys.4 |
434 |
|
(subst-if 'a #'null nil :allow-other-keys t :bad t) |
435 |
|
a) |
436 |
|
|
437 |
|
(deftest subst-if.allow-other-keys.5 |
438 |
|
(subst-if 'a #'null nil :allow-other-keys t :allow-other-keys nil :bad t) |
439 |
|
a) |
440 |
|
|
441 |
|
(deftest subst-if.keywords.6 |
442 |
|
(subst-if 'a #'null nil :key nil :key (constantly 'b)) |
443 |
|
a) |
444 |
|
|
445 |
|
;;; Keywords tests for subst-if-not |
446 |
|
|
447 |
|
(deftest subst-if-not.allow-other-keys.1 |
448 |
|
(subst-if-not 'a #'identity nil :bad t :allow-other-keys t) |
449 |
|
a) |
450 |
|
|
451 |
|
(deftest subst-if-not.allow-other-keys.2 |
452 |
|
(subst-if-not 'a #'identity nil :allow-other-keys t) |
453 |
|
a) |
454 |
|
|
455 |
|
(deftest subst-if-not.allow-other-keys.3 |
456 |
|
(subst-if-not 'a #'identity nil :allow-other-keys nil) |
457 |
|
a) |
458 |
|
|
459 |
|
(deftest subst-if-not.allow-other-keys.4 |
460 |
|
(subst-if-not 'a #'identity nil :allow-other-keys t :bad t) |
461 |
|
a) |
462 |
|
|
463 |
|
(deftest subst-if-not.allow-other-keys.5 |
464 |
|
(subst-if-not 'a #'identity nil :allow-other-keys t :allow-other-keys nil :bad t) |
465 |
|
a) |
466 |
|
|
467 |
|
(deftest subst-if-not.keywords.6 |
468 |
|
(subst-if-not 'a #'identity nil :key nil :key (constantly 'b)) |
469 |
|
a) |
470 |
|
|
471 |
|
|
472 |
(defvar *nsubst-tree-1* '(10 (30 20 10) (20 10) (10 20 30 40))) |
(defvar *nsubst-tree-1* '(10 (30 20 10) (20 10) (10 20 30 40))) |
525 |
:key nil) |
:key nil) |
526 |
(a a c d a a)) |
(a a c d a a)) |
527 |
|
|
528 |
(deftest nsubst-10 |
;;; Keyword tests for nsubst |
529 |
(nsubst 'a 'b nil :bad t :allow-other-keys t) |
|
530 |
nil) |
(deftest nsubst.allow-other-keys.1 |
531 |
|
(nsubst 'a 'b (list 'a 'b 'c) :bad t :allow-other-keys t) |
532 |
|
(a a c)) |
533 |
|
|
534 |
|
(deftest nsubst.allow-other-keys.2 |
535 |
|
(nsubst 'a 'b (list 'a 'b 'c) :allow-other-keys t) |
536 |
|
(a a c)) |
537 |
|
|
538 |
|
(deftest nsubst.allow-other-keys.3 |
539 |
|
(nsubst 'a 'b (list 'a 'b 'c) :allow-other-keys nil) |
540 |
|
(a a c)) |
541 |
|
|
542 |
|
(deftest nsubst.allow-other-keys.4 |
543 |
|
(nsubst 'a 'b (list 'a 'b 'c) :allow-other-keys t :bad t) |
544 |
|
(a a c)) |
545 |
|
|
546 |
|
(deftest nsubst.allow-other-keys.5 |
547 |
|
(nsubst 'a 'b (list 'a 'b 'c) :allow-other-keys t :allow-other-keys nil |
548 |
|
:bad t) |
549 |
|
(a a c)) |
550 |
|
|
551 |
|
(deftest nsubst.keywords.6 |
552 |
|
(nsubst 'a 'b (list 'a 'b 'c) :test #'eq :test (complement #'eq)) |
553 |
|
(a a c)) |
554 |
|
|
555 |
|
;;; Tests for nsubst-if, nsubst-if-not |
556 |
|
|
557 |
(deftest nsubst-if-1 |
(deftest nsubst-if-1 |
558 |
(check-nsubst-if 'a #'consp '((100 1) (2 3) (4 3 2 1) (a b c))) |
(check-nsubst-if 'a #'consp '((100 1) (2 3) (4 3 2 1) (a b c))) |
559 |
A) |
A) |
634 |
(nsubst-if-not 'a #'null nil :bad t :allow-other-keys t) |
(nsubst-if-not 'a #'null nil :bad t :allow-other-keys t) |
635 |
nil) |
nil) |
636 |
|
|
637 |
|
;;; Keyword tests for nsubst-if |
638 |
|
|
639 |
|
(deftest nsubst-if.allow-other-keys.1 |
640 |
|
(nsubst-if 'a #'null nil :bad t :allow-other-keys t) |
641 |
|
a) |
642 |
|
|
643 |
|
(deftest nsubst-if.allow-other-keys.2 |
644 |
|
(nsubst-if 'a #'null nil :allow-other-keys t) |
645 |
|
a) |
646 |
|
|
647 |
|
(deftest nsubst-if.allow-other-keys.3 |
648 |
|
(nsubst-if 'a #'null nil :allow-other-keys nil) |
649 |
|
a) |
650 |
|
|
651 |
|
(deftest nsubst-if.allow-other-keys.4 |
652 |
|
(nsubst-if 'a #'null nil :allow-other-keys t :bad t) |
653 |
|
a) |
654 |
|
|
655 |
|
(deftest nsubst-if.allow-other-keys.5 |
656 |
|
(nsubst-if 'a #'null nil :allow-other-keys t :allow-other-keys nil :bad t) |
657 |
|
a) |
658 |
|
|
659 |
|
(deftest nsubst-if.keywords.6 |
660 |
|
(nsubst-if 'a #'null nil :key nil :key (constantly 'b)) |
661 |
|
a) |
662 |
|
|
663 |
|
;;; Keywords tests for nsubst-if-not |
664 |
|
|
665 |
|
(deftest nsubst-if-not.allow-other-keys.1 |
666 |
|
(nsubst-if-not 'a #'identity nil :bad t :allow-other-keys t) |
667 |
|
a) |
668 |
|
|
669 |
|
(deftest nsubst-if-not.allow-other-keys.2 |
670 |
|
(nsubst-if-not 'a #'identity nil :allow-other-keys t) |
671 |
|
a) |
672 |
|
|
673 |
|
(deftest nsubst-if-not.allow-other-keys.3 |
674 |
|
(nsubst-if-not 'a #'identity nil :allow-other-keys nil) |
675 |
|
a) |
676 |
|
|
677 |
|
(deftest nsubst-if-not.allow-other-keys.4 |
678 |
|
(nsubst-if-not 'a #'identity nil :allow-other-keys t :bad t) |
679 |
|
a) |
680 |
|
|
681 |
|
(deftest nsubst-if-not.allow-other-keys.5 |
682 |
|
(nsubst-if-not 'a #'identity nil :allow-other-keys t :allow-other-keys nil :bad t) |
683 |
|
a) |
684 |
|
|
685 |
|
(deftest nsubst-if-not.keywords.6 |
686 |
|
(nsubst-if-not 'a #'identity nil :key nil :key (constantly 'b)) |
687 |
|
a) |
688 |
|
|
689 |
;;; Error cases |
;;; Error cases |
690 |
|
|
691 |
;;; subst |
;;; subst |