learning-sicp

My embarrassing half assed SICP run.
git clone https://kaka.farm/~git/learning-sicp
Log | Files | Refs

exercise-4.scm (1401B)


      1 (define-library (sicp tests chapter-4 exercise-4)
      2   (import (scheme base)
      3 
      4           (srfi :64)
      5 
      6           (sicp solutions chapter-4 exercise-4))
      7 
      8   (begin
      9     (test-begin "chapter-4-exercise-4")
     10 
     11     (test-equal #f
     12       (eval '(and)
     13             (setup-environment)))
     14 
     15     (test-equal #f
     16       (eval '(and false)
     17             (setup-environment)))
     18 
     19     (test-equal #t
     20       (eval '(and true)
     21             (setup-environment)))
     22 
     23     (test-equal 1
     24       (eval '(and 1)
     25             (setup-environment)))
     26 
     27     (test-equal 2
     28       (eval '(and 1 2)
     29             (setup-environment)))
     30 
     31     (test-equal #f
     32       (eval '(and false 2)
     33             (setup-environment)))
     34 
     35     (test-equal #f
     36       (eval '(and 1 false)
     37             (setup-environment)))
     38 
     39     (test-equal #f
     40       (eval '(and 1 false 3)
     41             (setup-environment)))
     42 
     43     (test-equal #f
     44       (eval '(or)
     45             (setup-environment)))
     46 
     47     (test-equal #f
     48       (eval '(or false)
     49             (setup-environment)))
     50 
     51     (test-equal #t
     52       (eval '(or true)
     53             (setup-environment)))
     54 
     55     (test-equal 1
     56       (eval '(or 1)
     57             (setup-environment)))
     58 
     59     (test-equal 2
     60       (eval '(or false 2)
     61             (setup-environment)))
     62 
     63     (test-equal 1
     64       (eval '(or 1 false)
     65             (setup-environment)))
     66 
     67     (test-equal 1
     68       (eval '(or 1 false 3)
     69             (setup-environment)))
     70 
     71     (test-end "chapter-4-exercise-4")))