exercise-7.scm (812B)
1 (define-library (sicp tests chapter-3 exercise-7) 2 (import (scheme base)) 3 (import (scheme write)) 4 (import (srfi :64)) 5 (import (only (sicp solutions chapter-3 exercise-3) make-account)) 6 (import (sicp solutions chapter-3 exercise-7)) 7 8 (begin 9 (define acc 10 (make-account 100 11 'secret-password)) 12 13 (define joint-acc (make-joint acc 14 'secret-password 15 'another-secret-password)) 16 17 (test-begin "chapter-3-exercise-7") 18 (test-equal 19 60 20 ((acc 'secret-password 'withdraw) 40)) 21 (test-equal 22 "Incorrect password" 23 ((acc 'incorrect-password 'deposit) 50)) 24 (test-equal 25 110 26 ((joint-acc 'another-secret-password 'deposit) 50)) 27 (test-end "chapter-3-exercise-7")))