diff --git a/ansi-tests/acons.lsp b/ansi-tests/acons.lsp index d4a6ca3b61c5445e74fc50f1e1fcb275b5d2a411..e97c9f6b5fa1da2d106e844585df06365128b872 100644 --- a/ansi-tests/acons.lsp +++ b/ansi-tests/acons.lsp @@ -47,6 +47,11 @@ ((a . b)(c . d)) 3 1 2 3) +(def-fold-test acons.fold.1 (acons 'x 'y nil)) +(def-fold-test acons.fold.2 (acons 1 2 '((3 . 4) (5 . 6)))) + +;;; Error tests + (deftest acons.error.1 (signals-error (acons) program-error) t) diff --git a/ansi-tests/adjoin.lsp b/ansi-tests/adjoin.lsp index c0848757bdb88129416d8cf431bd749751edf525..18c3e77a9df8d4e839dcf063cd88c8a1a78f81d4 100644 --- a/ansi-tests/adjoin.lsp +++ b/ansi-tests/adjoin.lsp @@ -133,6 +133,8 @@ (a b c d e) 5 1 2 3 4 5) +(def-fold-test adjoin.fold.1 (adjoin 'x '(a b c nil d))) + (deftest adjoin.allow-other-keys.1 (adjoin 'a '(b c) :bad t :allow-other-keys t) (a b c)) diff --git a/ansi-tests/append.lsp b/ansi-tests/append.lsp index 702a7b16a8ce9945f9df6b9f163115a76e3cbb2e..724b97708b8e5566dd92b406de00d12124489f28 100644 --- a/ansi-tests/append.lsp +++ b/ansi-tests/append.lsp @@ -62,6 +62,11 @@ (let ((i 0)) (values (append (incf i)) i)) 1 1) +(def-fold-test append.fold.1 (append '(a b c) nil)) +(def-fold-test append.fold.2 (append nil '(x) nil)) + +;;; Error tests + (deftest append.error.1 (signals-error (append '(a . b) '(z)) type-error) diff --git a/ansi-tests/butlast.lsp b/ansi-tests/butlast.lsp index 46ac2d4ee953347030f3a9fcb3b4199544960e12..f78e8f770e29ed157943de47724f0bf2d271410b 100644 --- a/ansi-tests/butlast.lsp +++ b/ansi-tests/butlast.lsp @@ -76,6 +76,12 @@ i)) (a b c) 1) +(def-fold-test butlast.fold.1 (butlast '(a b) 1)) +(def-fold-test butlast.fold.2 (butlast '(a b c d e f) 3)) +(def-fold-test butlast.fold.3 (butlast '(a b c d e f g h i) 7)) + +;;; Error tests + (deftest butlast.error.1 (signals-error (butlast (copy-tree '(a b c d)) 'a) type-error) diff --git a/ansi-tests/cons-aux.lsp b/ansi-tests/cons-aux.lsp index e5f2e1372c903105a194024a9a522831a15d4bed..a47467ac136dc0f555e426bf7998c551c2a7ec31 100644 --- a/ansi-tests/cons-aux.lsp +++ b/ansi-tests/cons-aux.lsp @@ -617,3 +617,8 @@ (cons nil (rev-assoc-list (cdr x)))) (t (acons (cdar x) (caar x) (rev-assoc-list (cdr x)))))) + +(defvar *mapc.6-var* nil) +(defun mapc.6-fun (x) + (push x *mapc.6-var*) + x) diff --git a/ansi-tests/cons.lsp b/ansi-tests/cons.lsp index ae3ee676343f52f773451a24cc519e791e237b73..2e1edab3be249cd34fb2002a01b601bb2a5e2727 100644 --- a/ansi-tests/cons.lsp +++ b/ansi-tests/cons.lsp @@ -36,6 +36,8 @@ (let ((i 0)) (values (cons (incf i) (incf i)) i)) (1 . 2) 2) +(def-fold-test cons.fold.1 (cons 'a 'b)) + ;;; Error tests (deftest cons.error.1 diff --git a/ansi-tests/copy-alist.lsp b/ansi-tests/copy-alist.lsp index 9eaed81d93ea53e96d7c9f51691cecfdbd38c7fc..b72d1574f60f78fd3324b91b346f3d1c2507ab53 100644 --- a/ansi-tests/copy-alist.lsp +++ b/ansi-tests/copy-alist.lsp @@ -25,6 +25,10 @@ t)) t) +(def-fold-test copy-alist.1 (copy-alist '((a . b) nil (c . d)))) +(def-fold-test copy-alist.2 (car (copy-alist '((a . b) nil (c . d))))) +(def-fold-test copy-alist.3 (caddr (copy-alist '((a . b) nil (c . d))))) + ;;; Error tests (deftest copy-alist.error.1 diff --git a/ansi-tests/copy-tree.lsp b/ansi-tests/copy-tree.lsp index 390c6a0b16f445486a09d3e49563ec0bac8a780f..1c6ad0e7137f240bc5b1c4de3f88473cf9c2b319 100644 --- a/ansi-tests/copy-tree.lsp +++ b/ansi-tests/copy-tree.lsp @@ -34,6 +34,10 @@ i)) (a b c) 1) +(def-fold-test copy-tree.fold.1 (copy-tree '(a . b))) +(def-fold-test copy-tree.fold.2 (copy-tree '(a))) +(def-fold-test copy-tree.fold.3 (copy-tree '(a b c d e))) + ;;; Error tests (deftest copy-tree.error.1 diff --git a/ansi-tests/intersection.lsp b/ansi-tests/intersection.lsp index 13ceaf37d3799b585746a12844d9afe526243987..2c76fb422669ee01a6432d5e3d88e5043a37e609 100644 --- a/ansi-tests/intersection.lsp +++ b/ansi-tests/intersection.lsp @@ -349,6 +349,8 @@ #'<) (3 4)) +(def-fold-test intersection.fold.1 (intersection '(a b c d e f) '(d w a x b y))) + ;;; Error tests (deftest intersection.error.1 diff --git a/ansi-tests/ldiff.lsp b/ansi-tests/ldiff.lsp index d682b0f0ff97e9e5a7de9ca05199d5c548a58879..6f502995cbc79ad1b9289809e097106e1add5bf7 100644 --- a/ansi-tests/ldiff.lsp +++ b/ansi-tests/ldiff.lsp @@ -105,7 +105,10 @@ (progn (setf y (incf i)) 'd)) i x y)) - (a b c) 2 1 2) + (a b c) 2 1 2) + +(def-fold-test ldiff.fold.1 (ldiff '(a b c) 'x)) +(def-fold-test ldiff.fold.2 (let ((x '(a b c))) (ldiff x (cddr x)))) ;; Error checking diff --git a/ansi-tests/list.lsp b/ansi-tests/list.lsp index 5fe585ad98dba54e5e2823be39dfc6799d239cce..2b352632425d4b1c06b8abdf792d2a84a3ad7534 100644 --- a/ansi-tests/list.lsp +++ b/ansi-tests/list.lsp @@ -34,6 +34,12 @@ (incf i) (incf i) (incf i) (incf i))) (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)) +(def-fold-test list.fold.1 (list 'a)) +(def-fold-test list.fold.2 (list 'a 'b)) +(def-fold-test list.fold.3 (list 'a 'b 'c 'd 'e 'f)) + +;;; LIST* tests + (deftest list*.1 (list* 1 2 3) (1 2 . 3)) @@ -62,3 +68,7 @@ (incf i) (incf i) (incf i) (incf i) (incf i) (incf i) (incf i) (incf i))) (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 . 16)) + +(def-fold-test list*.fold.1 (list* 'a 'b)) +(def-fold-test list*.fold.2 (list* 'a 'b 'c)) +(def-fold-test list*.fold.3 (list* 'a 'b 'c 'd 'e 'f)) diff --git a/ansi-tests/make-list.lsp b/ansi-tests/make-list.lsp index 671f1b61e132fe979c180a64c68673ca0232e34b..84010d2aad57c47ef8dd5fb72970bb4e3e87e0f4 100644 --- a/ansi-tests/make-list.lsp +++ b/ansi-tests/make-list.lsp @@ -69,6 +69,10 @@ (a a a a a) 3 1 2 3) +(def-fold-test make-list.fold.1 (make-list 1)) +(def-fold-test make-list.fold.2 (make-list 10 :initial-element 'x)) + +;;; Error tests (deftest make-list.error.1 (check-type-error #'make-list (typef 'unsigned-byte)) diff --git a/ansi-tests/mapc.lsp b/ansi-tests/mapc.lsp index cf1b78d032595983f5c34a54a4d0c3de9db8f3f9..70494fd07a9e63a60042088e50242e9e1175bb6e 100644 --- a/ansi-tests/mapc.lsp +++ b/ansi-tests/mapc.lsp @@ -46,11 +46,6 @@ x)) ((a a a a a) 3)) -(defvar *mapc.6-var* nil) -(defun mapc.6-fun (x) - (push x *mapc.6-var*) - x) - (deftest mapc.6 (let* ((x (copy-list '(a b c d e f g h))) (xcopy (make-scaffold-copy x))) @@ -73,6 +68,8 @@ i x y z)) (a b c) 3 1 2 3) +;;; Error tests + (deftest mapc.error.1 (check-type-error #'(lambda (x) (mapc #'identity x)) #'listp) nil) diff --git a/ansi-tests/mapcar.lsp b/ansi-tests/mapcar.lsp index 1b8598b16f489db738ea7a427abd1b59dded0cc8..e1db5f8c048602c17acd4c9d5ca923029037d39b 100644 --- a/ansi-tests/mapcar.lsp +++ b/ansi-tests/mapcar.lsp @@ -80,6 +80,11 @@ ((a 1) (b 2) (c 3)) 3 1 2 3) +(def-fold-test mapcar.fold.1 (mapcar 'identity '(a b c d))) +(def-fold-test mapcar.fold.2 (mapcar 'not '(t nil nil t t))) + +;;; Error tests + (deftest mapcar.error.1 (check-type-error #'(lambda (x) (mapcar #'identity x)) #'listp) nil) diff --git a/ansi-tests/maplist.lsp b/ansi-tests/maplist.lsp index b452ce05b515cb4e57c02ed0a7c53a4f287af402..14a759689a10f74bdd515d5b6700912441e6950a 100644 --- a/ansi-tests/maplist.lsp +++ b/ansi-tests/maplist.lsp @@ -94,6 +94,11 @@ i x y z)) (1 2 3) 3 1 2 3) +(def-fold-test maplist.fold.1 (maplist 'car '(a b c d e))) +(def-fold-test maplist.fold.2 (maplist #'cadr '(a b c d e))) + +;;; Error tests + (deftest maplist.error.1 (check-type-error #'(lambda (x) (maplist #'identity x)) #'listp) nil) diff --git a/ansi-tests/pairlis.lsp b/ansi-tests/pairlis.lsp index ad0e31f48502716b09f79d970e21e50b3dc4dfde..658e18e7b14cd7b64fad68651eae47aa2f045c10 100644 --- a/ansi-tests/pairlis.lsp +++ b/ansi-tests/pairlis.lsp @@ -63,6 +63,10 @@ t)) t) +(def-fold-test pairlis.fold.1 (pairlis '(a b) '(c d))) + +;;; Error tests + (deftest pairlis.error.1 (signals-error (pairlis) program-error) t) diff --git a/ansi-tests/revappend.lsp b/ansi-tests/revappend.lsp index f711cfa1777048d7f4306bc6534314b8b4987dd4..ba18db904d5eb8586ca387e52ef1c6087dffc857 100644 --- a/ansi-tests/revappend.lsp +++ b/ansi-tests/revappend.lsp @@ -41,6 +41,11 @@ i x y)) (c b a d e f) 2 1 2) +(def-fold-test revappend.fold.1 (revappend '(x) nil)) +(def-fold-test revappend.fold.2 (revappend '(x y z) nil)) + +;;; Error tests + (deftest revappend.error.1 (signals-error (revappend) program-error) t) diff --git a/ansi-tests/set-difference.lsp b/ansi-tests/set-difference.lsp index c10c7ffa74300f748a8bea7ab4151318a9d9e539..6bb8359fb83ae78eb5cf6fabb8ee7458f39f3e3d 100644 --- a/ansi-tests/set-difference.lsp +++ b/ansi-tests/set-difference.lsp @@ -270,6 +270,8 @@ #'<) nil) +(def-fold-test set-difference.fold.1 (set-difference '(a b c d e f g h) '(b w h x e y))) + ;;; Error tests diff --git a/ansi-tests/set-exclusive-or.lsp b/ansi-tests/set-exclusive-or.lsp index f2a3e2f3198ab96982415907f1b46f4c751e8003..0d7575a338cf08a66146f52d2eb3826e48502e1f 100644 --- a/ansi-tests/set-exclusive-or.lsp +++ b/ansi-tests/set-exclusive-or.lsp @@ -313,6 +313,10 @@ #'<) nil) +(def-fold-test set-exclusive-or.fold.1 (set-exclusive-or '(a b c d e f) '(b x e y z c))) + +;;; Error tests + (deftest set-exclusive-or.error.1 (signals-error (set-exclusive-or) program-error) t) diff --git a/ansi-tests/sublis.lsp b/ansi-tests/sublis.lsp index daa2e49e11399b25b37263b9501ed1274462174c..46d76d498ab524e87426799b7f7b56208268b7e7 100644 --- a/ansi-tests/sublis.lsp +++ b/ansi-tests/sublis.lsp @@ -116,6 +116,10 @@ (z b c d) 4 1 2 3 4) +;;; Const fold tests + +(def-fold-test sublis.fold.1 (sublis '((a . b)) '(a x y . a))) + ;;; Keyword tests diff --git a/ansi-tests/subst-if-not.lsp b/ansi-tests/subst-if-not.lsp index bbc93fe79b31174e8b8d32f93ffc65f9f92d3bea..664a0afbff0ca056166f2a4a58e8383b2dae9e6e 100644 --- a/ansi-tests/subst-if-not.lsp +++ b/ansi-tests/subst-if-not.lsp @@ -53,6 +53,8 @@ i w x y z)) (1 2 a a c) 4 1 2 3 4) + +(def-fold-test subst-if-not.fold.1 (subst-if-not 'a #'consp '((1 . 2) 3 . 4))) ;;; Keywords tests for subst-if-not diff --git a/ansi-tests/subst-if.lsp b/ansi-tests/subst-if.lsp index cb2cdaa77bb3f69c18402aec04a46b8849fbbf1f..0546248dc29ae19985956cfff4226584a9b555c6 100644 --- a/ansi-tests/subst-if.lsp +++ b/ansi-tests/subst-if.lsp @@ -56,6 +56,8 @@ (1 2 a a c) 4 1 2 3 4) +(def-fold-test subst-if.fold.1 (subst-if 'x 'numberp '(a b 3 (4) c d . 12))) + ;;; Keyword tests for subst-if (deftest subst-if.allow-other-keys.1 diff --git a/ansi-tests/subst.lsp b/ansi-tests/subst.lsp index 11a6026b8f9451fc21a762c7e3860da19ab205f6..0de24a19c23ad1caf44b743424cf86681c631684 100644 --- a/ansi-tests/subst.lsp +++ b/ansi-tests/subst.lsp @@ -107,7 +107,9 @@ ((10 b . b) b b c ((b)) z) 5 1 2 3 4 5) +;;; Const fold tests +(def-fold-test subst.fold.1 (subst 'a 'b '(a b c (a . b) . a))) ;;; Keyword tests for subst diff --git a/ansi-tests/union.lsp b/ansi-tests/union.lsp index b4309cd3493e2e7eec4185d66686f7642e2bcc41..0bb1fd5dec05bb4de12621fd78d04acf15292cfa 100644 --- a/ansi-tests/union.lsp +++ b/ansi-tests/union.lsp @@ -363,6 +363,8 @@ #'<) (1 1 2 2 3 3)) +(def-fold-test union.fold.1 (union '(a b c d e) '(d x y a w c))) + ;;; Error tests (deftest union.error.1