learning-sicp

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

utils-tests.scm (707B)


      1 (define-library (utils-tests)
      2   (import (srfi srfi-64))
      3   (import (scheme base))
      4   (import (sicp utils))
      5 
      6   (begin
      7     (test-begin "enumerate-interval")
      8     (test-equal
      9         '()
     10       (enumerate-interval 1 0))
     11     (test-equal
     12         '(1)
     13       (enumerate-interval 1 1))
     14     (test-equal
     15         '(1 2)
     16       (enumerate-interval 1 2))
     17     (test-equal
     18         '(1 2 3)
     19       (enumerate-interval 1 3))
     20     (test-end "enumerate-interval")
     21 
     22     (test-begin "accumulate")
     23     (test-equal
     24         15
     25       (accumulate + 0 '(1 2 3 4 5)))
     26     (test-equal
     27         120
     28       (accumulate * 1 '(1 2 3 4 5)))
     29     (test-equal
     30         '(1 2 3 4 5)
     31       (accumulate cons '() '(1 2 3 4 5)))
     32     (test-end "accumulate")))