original-repl-tests.scm (2197B)
1 (define-library (sicp tests chapter-4 original-repl-tests) 2 (import (scheme base) 3 4 (srfi srfi-64) 5 6 (prefix (sicp solutions chapter-4 original-repl) repl:) 7 (sicp utils)) 8 9 (begin 10 (set! *debug* #t) 11 12 (test-begin "original-repl-tests") 13 (test-group "internal-tests" 14 (repl:run-internal-tests)) 15 16 (test-equal 1 17 (repl:eval 1 '())) 18 19 (test-equal '() 20 (repl:eval '(quote ()) '())) 21 22 (test-equal 1 23 (repl:eval '(+ -1 2) 24 (repl:extend-environment 25 '(+) 26 `((primitive ,+)) 27 (repl:setup-environment)))) 28 29 (test-equal 1 30 (repl:eval '(begin 31 (+ -1 2)) 32 (repl:extend-environment '(+) 33 `((primitive ,+)) 34 (repl:setup-environment)))) 35 36 ;; XXX: Not implemented yet! 37 (test-error 1 38 (repl:eval '(let ((a -1) 39 (b 2)) 40 (+ a b)) 41 (repl:extend-environment '(+) 42 `((primitive ,+)) 43 (repl:setup-environment)))) 44 45 (test-equal 1 46 (repl:eval '(begin 47 (define a -1) 48 (define b 2) 49 (+ a b)) 50 (repl:extend-environment '(+) 51 `((primitive ,+)) 52 (repl:setup-environment)))) 53 54 (test-equal 1 55 (repl:eval '((lambda (a b) 56 (+ a b)) 57 -1 2) 58 (repl:extend-environment '(+) 59 `((primitive ,+)) 60 (repl:setup-environment)))) 61 62 (test-equal 1 63 (repl:eval '(begin 64 (define (plus a b) 65 (+ a b)) 66 (plus -1 2)) 67 (repl:extend-environment '(+) 68 `((primitive ,+)) 69 (repl:setup-environment)))) 70 71 (test-end "original-repl-tests")))