In a class I am taking we are using the old R5RS standard of Scheme to solve SICP assignments. I like to do test first development, so I figured a unit testing framework would be nice, and I chose SchemeUnit for writing the small tests.
This has worked fine so far, just testing primitives in the output (strings, numbers, ...), but I hit a road block when trying to test lists. It has probably something to do with differences in the Scheme dialect used to run the tests:
foo.scm: (define a-list (list 2))
foo-tests.scm: (check-equal? a-list (list 2))
Result when running the tests:
Unnamed test
FAILURE
name: check-equal?
location: tester.scm:22:3
actual: {2}
expected: (2)
To make the test suite run, I have to add "#lang scheme/base
to the top of foo-tests.scm and require
the schemeunit package. In foo.scm I need to have #lang r5rs
and (#%provide (all-defined))
at the top.
I guess lists are somehow differently implemented in R5RS and "scheme/base". Any way to get them to work together? And why does it fail ({} vs ())?