Commit 0c4b44c5 authored by pfdietz's avatar pfdietz

More const fold tests

parent d31bd2e6
......@@ -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)
......
......@@ -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))
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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))
......@@ -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))
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment