1 ; tests of arithmetic, logical, and bit funcitons
4 ;arith with integer args
5 (check #'= (+ 1 3) (* 2 2))
6 (check #'= (- (list -
3 1789) 20) (list -
23 1769))
7 (check #'= (* (list -
7 09 -
7 09) (list 100 -
10 1 -
9)) (- (list 700 90 7 81)))
9 (abs (- (/ (list 5 3 1 340) 3) (list 1.6666667 1.
.3333333 113.3333333)))
11 (check #'= (floor (/ (list 5 3 1 340) 3)) (list 1 1 0 113))
12 (check #'= (^
(list 12 35 159) 2) (list 144 1225 25281))
13 (check #'= (rem (list 86 -
33 123456) 5) (list 1 -
3 1))
15 ;arith with real or mixed args
16 (check #'= (+ 15 .0078) 15.0078)
17 (check #'< (abs (- (- (list 23.4 1 -
50) 17) (list 6.4 -
16 -
67))) eps
)
18 (check #'< (abs (- (* 1.234e12
.02) 2.468e10
)) eps
)
19 (check #'< (abs (- (/ (list 15 -
2 1.e3
) 7.2)
20 (list 2.0833333 -
.2777778 138.8888889)))
22 (check #'< (abs (- (rem 17.53 (list 5.
1.5)) (list 2.53 1.03))) eps
)
23 (check #'< (abs (- (^
(list 1.2 5.67) 2.001) (list 1.440263 32.204733))) eps
)
25 ;arith with double complex args
26 (check #'= (+ 15 .0078e0
) 15.0078)
28 (abs (- (- (list 23.4 1 -
50) #c
(17 5))
29 (list #c
(6.4 -
5) #c
(-16 -
5) #c
(-67 -
5))))
31 (check #'< (abs (- (* 1.23456789012345e10
.02) 246913578.024690)) eps
)
33 (abs (- (/ (list 15 -
2.
1.e3
) 7.2)
34 (list 2.0833333 -
.2777778 138.8888889)))
37 ;logical with integer args
38 (check #'eq
(< 5 (list 4 6 -
5)) (list nil T nil
))
39 (check #'eq
(> (list 7 12345) 500) (list nil T
))
40 (check #'eq
(<= 17 (list 17 -
1 100)) (list T nil T
))
41 (check #'eq
(>= -
12 (list 500 0 -
5 -
12 -
30)) (list nil nil nil T T
))
42 (check #'eq
(= (list 2 3 -
3 4) (list 2 -
3 -
3 1)) (list T nil T nil
))
44 ;logical with real or mixed arguments
45 (check #'eq
(< 5 (list 4.9 6.123 -
5)) (list nil T nil
))
46 (check #'eq
(> (list 7.3 12345) 7.3) (list nil T
))
47 (check #'eq
(> (list 7.3 12345) 7.3) (list nil T
))
48 (check #'eq
(<= 1.17 (list 1.17 -
1.1 100.1)) (list T nil T
))
50 (>= -
12.001 (list 500.001 0.001 -
5.001 -
12.001 -
30))
51 (list nil nil nil T T
))
52 (check #'eq
(not T
) nil
)
53 (check #'eq
(not (and T nil
)) T
)
54 (check #'= (if-else (> (iseq 1 3) 2) 100 0) (list 0 0 100))