aboutsummaryrefslogtreecommitdiff
path: root/tests/arithmetic.lisp
blob: 38b11851b974664e45a6b3a51cc4090b16d83394 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(assert (= 1 (+ 1 0)))
(assert (= -1 (- 0 1)))
(assert (= -1 (- 1)))
(assert (= 1.1 (+ 1 0.1)))
(assert (= 2 (i/ 11 5)))
(assert (= 1 (mod 11 5)))

(assert (zero? 0))
(assert (not (zero? 1)))
(assert (not (zero? -1)))

(assert (plus? 1))
(assert (plus? 1.0))
(assert (not (plus? 0)))
(assert (not (plus? -1)))

(assert (minus? -1))
(assert (not (minus? 0)))
(assert (not (minus? 1)))

(assert (< 1 2))
(assert (< 1.0 2))
(assert (not (> 1 2)))
(assert (= 1.0 1.0))
(assert (= 1 1.0))
(assert (not (= 1 2)))
(assert (>= 2 1))
(assert (>= 1 1))
(assert (not (>= 0 1)))
(assert (/= 2 1.0))
(assert (not (/= 1 1)))

(assert (= 1.0 (max -2 0.1 0.2 1)))
(assert (= 1.0 (min 1 2.0 3.2 4 100)))
(assert (= 3 (max 3)))
(assert (= 3 (min 3)))
(assert-error (max))
(assert-error (min))

(assert-error (+ 1 "a"))
(assert-error (- 1 "a"))
(assert-error (* 1 "a"))
(assert-error (/ 1 "a"))