Skip to content
Snippets Groups Projects
Commit de7545de authored by pfdietz's avatar pfdietz
Browse files

Add tests for map, map-into, count-if, more tests for count.

parent 7c96dd9c
No related branches found
No related tags found
No related merge requests found
......@@ -68,7 +68,60 @@
3)
;;; map tests here
(def-type-prop-test map.1 'map
(list '(member list vector)
'(member list #.#'list)
'(or list vector))
3)
(def-type-prop-test map.2 'map
(list '(member list vector)
'(member list #.#'list)
'(or list vector)
'(or list vector))
4)
(def-type-prop-test map.3 'map
(list '(member list vector)
'(member list #.#'list)
'(or list vector)
'(or list vector)
'(or list vector))
5)
(def-type-prop-test map.4 'map
(list '(member list vector (vector (unsigned-byte 32)))
'(member 1+ #.#'1+)
`(or ,@(loop for i from 1 to 31 collect `(vector (unsigned-byte ,i)))))
3)
(def-type-prop-test map.5 'map
(list `(member ,@(loop for i from 1 to 32 collect `(vector (unsigned-byte ,i))))
'(member 1+ #.#'1+)
#'(lambda (type fun)
(declare (ignore fun))
(let ((i (cadadr type)))
`(or ,@(loop for j from i to 32 collect `(vector (integer 0 ,(- (ash 1 i) 2))))))))
3)
;;; map-into tests here
(def-type-prop-test map-into.1 'map-into
(list '(or list (vector t))
'(member list #.#'list)
'(or list vector))
3 :replicate '(t nil nil))
(def-type-prop-test map-into.2 'map-into
(list '(or list (vector t))
'(member list #.#'list)
'(or list vector)
'(or list vector))
4 :replicate '(t nil nil nil))
;;; reduce tests here
(def-type-prop-test count.1 'count '(t sequence) 2)
......@@ -97,7 +150,53 @@
`(integer ,start ,(length s))))
6)
;;; count-if, count-if-not tests here
(def-type-prop-test count.6 'count
(list '(or short-float single-float double-float long-float)
#'(lambda (f) `(vector (or ,(typecase f
(short-float 'short-float)
(single-float 'single-float)
(double-float 'double-float)
(long-float 'long-float)
(t 'float))
(eql ,f)))))
2)
(def-type-prop-test count.7 'count '(bit (vector bit)) 2)
(def-type-prop-test count.8 'count '((unsigned-byte 2) (vector (unsigned-byte 2))) 2)
(def-type-prop-test count.9 'count '((unsigned-byte 4) (vector (unsigned-byte 4))) 2)
(def-type-prop-test count.10 'count '((unsigned-byte 8) (vector (unsigned-byte 8))) 2)
;;; count-if tests
(def-type-prop-test count-if.1 'count-if
(list (let ((funs '(numberp rationalp realp floatp complexp
symbolp identity null functionp listp consp
arrayp vectorp simple-vector-p
stringp simple-string-p
bit-vector-p simple-bit-vector-p)))
`(member ,@funs ,@(mapcar #'symbol-function funs)))
'(or list vector))
2)
(def-type-prop-test count-if.2 'count-if
(list (let ((funs '(numberp rationalp realp floatp complexp
symbolp identity null functionp listp consp
arrayp vectorp simple-vector-p
stringp simple-string-p
bit-vector-p simple-bit-vector-p)))
`(member ,@funs ,@(mapcar #'symbol-function funs)))
'(or list vector)
'(eql :test)
(let ((test-funs '(eq eql equal equalp)))
`(member ,@test-funs ,@(mapcar #'symbol-function test-funs))))
4)
;;; Put count-if-not tests here
(def-type-prop-test length.1 'length '(sequence) 1)
......@@ -172,5 +271,3 @@
(member < <= > >= ,#'< ,#'<= ,#'> ,#'>=))
2 :replicate '(t nil))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment