test.scm 643 B

1234567891011121314151617181920212223242526
  1. (import
  2. (scheme base)
  3. (scheme write)
  4. (srfi 64)
  5. (scheme load))
  6. (load "./solution.scm")
  7. (define test-values
  8. '(("Example 1" ("babad") "bab") ;; aba is also acceptable
  9. ("Example 2" ("cbbd") "bb")))
  10. (define (test-solution proc)
  11. (test-begin "Problem 5 Test Suite")
  12. (for-each (lambda (test-pair)
  13. (define name (list-ref test-pair 0))
  14. (define input (list-ref test-pair 1))
  15. (define output (list-ref test-pair 2))
  16. (define actual-output (apply proc input))
  17. (test-equal name output actual-output))
  18. test-values)
  19. (test-end))
  20. (test-solution solution5)