1 ;;;; Tests for numeric functions
9 (test (= (max 1 2 3) 3))
10 (test (= (max 3 2 1) 3))
14 (test (= (min 1 2 3) 1))
15 (test (= (min 3 2 1) 1))
20 (test (not (evenp 1)))
30 ;;; The builtin definition of these is variadic, but the function definition
31 ;;; should be as well. So, test it using MAPCAR
35 (test (equal (mapcar #'+ a b c) '( 3 6)))
36 (test (equal (mapcar #'- a b c) '(-1 -2)))
37 (test (equal (mapcar #'* a b c) '( 1 8)))
38 ;; This test will need to be changed when rationals are introduced
39 (test (equal (mapcar #'/ a b c) '( 1 0.5))))
41 ;;; >, >=, =, <, <=, /=
42 ;;; As above, we need to make sure the function is called, not the builtin
43 (let ((a '(1 3 1 2 1))
46 (test (equal (mapcar #'> a b c) '(nil t nil nil nil)))
47 (test (equal (mapcar #'>= a b c) '(nil t nil t t)))
48 (test (equal (mapcar #'= a b c) '(nil nil nil nil t)))
49 (test (equal (mapcar #'< a b c) '( t nil nil nil nil)))
50 (test (equal (mapcar #'<= a b c) '( t nil t nil t)))
51 (test (equal (mapcar #'/= a b c) '( t t nil nil nil))))
60 ;; It is a known bug. Javascript does not distinguish between floats
61 ;; and integers, and we represent both numbers in the same way. So 1
62 ;; == 1.0 and integer and float types are not disjoint.
63 (expected-failure (floatp 1.0))
67 (test (floatp (- pi)))
68 (test (not (floatp 1)))