exercise-1.scm (934B)
1 (define-library (sicp tests chapter-1 exercise-1) 2 (import 3 (scheme base) 4 (sicp solutions chapter-1 exercise-1) 5 (srfi srfi-64)) 6 7 (begin 8 (test-begin "chapter-1-exercise-1") 9 10 (test-equal 10 10) 11 12 (test-equal 13 (+ 5 3 4) 14 15 12) 16 17 (test-equal 18 (- 9 1) 19 20 8) 21 22 (test-equal 23 (/ 6 2) 24 25 3) 26 27 (test-equal 28 (+ (* 2 4) (- 4 6)) 29 30 6) 31 32 (test-equal 33 (+ a b (* a b)) 34 35 19) 36 37 (test-equal 38 (= a b) 39 40 #f) 41 42 (test-equal 43 (if (and (> b a) (< b (* a b))) 44 b 45 a) 46 47 4) 48 49 (test-equal 50 (cond ((= a 4) 6) 51 ((= b 4) (+ 6 7 a)) 52 (else 25)) 53 54 16) 55 56 (test-equal 57 (+ 2 (if (> b a) b a)) 58 59 6) 60 61 (test-equal 62 (* (cond ((> a b) a) 63 ((< a b) b) 64 (else -1)) 65 (+ a 1)) 66 16) 67 (test-end "chapter-1-exercise-1")))