exercise-4.scm (949B)
1 (import (srfi :64)) 2 (import (sicp solutions chapter-3 exercise-4)) 3 4 (define acc 5 (make-account 100 'secret-password)) 6 7 (test-begin "chapter-3-exercise-4") 8 (test-equal 9 60 10 ((acc 'secret-password 'withdraw) 40)) 11 (test-equal 12 "Incorrect password" 13 ((acc 'some-other-password 'deposit) 50)) 14 (test-equal 15 "Incorrect password" 16 ((acc 'some-other-password 'deposit) 50)) 17 (test-equal 18 "Incorrect password" 19 ((acc 'some-other-password 'deposit) 50)) 20 (test-equal 21 "Incorrect password" 22 ((acc 'some-other-password 'deposit) 50)) 23 (test-equal 24 "Incorrect password" 25 ((acc 'some-other-password 'deposit) 50)) 26 (test-equal 27 "Incorrect password" 28 ((acc 'some-other-password 'deposit) 50)) 29 (test-equal 30 "Cops called." 31 ((acc 'some-other-password 'deposit) 50)) 32 (test-equal 33 "Cops called." 34 ((acc 'some-other-password 'deposit) 50)) 35 (test-equal 36 "Cops called." 37 ((acc 'some-other-password 'deposit) 50)) 38 (test-end "chapter-3-exercise-4")