12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- (import
- (scheme base)
- (scheme load)
- (srfi 64))
- (load "./12.exercises.scm")
- (define (test-exercise-12.1)
- (let ((result (exercise-12.1)))
- (test-equal "Exercise 12.1" result 10)))
- (define (test-exercise-12.22)
- (let ((result (exercise-12.22)))
- (for-each (lambda (p)
- (define key (car p))
- (define expected-v (cdr p))
- (send result
- 'lookup
- key
- (lambda (s)
- (define test-name (string-append "Exercise 12.22 - " key))
- (test-equal test-name expected-v s))
- (lambda ()
- (error "key not found" key))))
- '(("this" . 2)
- ("hash" . 4)
- ("table" . 2)
- ("is" . 1)
- ("inefficient" . 1)
- ("as" . 2)
- ("a" . 1)
- ("bucket" . 1)))))
- (define (test-12)
- (test-begin "Chapter 12 Exercises test suite")
- (test-exercise-12.1)
- (test-exercise-12.22)
- (test-end))
- (test-12)
|