38 lines
739 B
Plaintext
38 lines
739 B
Plaintext
(define (test-cond x)
|
|
(cond ((< 0 x) +1)
|
|
((> 0 x) -1)
|
|
(else 0)))
|
|
|
|
(assert (= (test-cond 10) 1))
|
|
(assert (= (test-cond 1) 1))
|
|
(assert (= (test-cond 123) 1))
|
|
|
|
(assert (= (test-cond -10) -1))
|
|
(assert (= (test-cond -1) -1))
|
|
(assert (= (test-cond -123) -1))
|
|
|
|
(assert (= (test-cond 0) 0))
|
|
(assert (= (test-cond -0) 0))
|
|
(assert (= (test-cond +0) 0))
|
|
|
|
|
|
(define (test-case x)
|
|
(case x
|
|
((a b 3) 1)
|
|
((4 5 6) -1)
|
|
(else 'xD)))
|
|
|
|
|
|
(assert (= (test-case 'a) 1))
|
|
(assert (= (test-case 'b) 1))
|
|
(assert (= (test-case 3) 1))
|
|
|
|
(assert (= (test-case 4) -1))
|
|
(assert (= (test-case 5) -1))
|
|
(assert (= (test-case 6) -1))
|
|
|
|
(assert (= (test-case 0) 'xD))
|
|
(assert (= (test-case 1) 'xD))
|
|
(assert (= (test-case :asd) 'xD))
|
|
|