I created $TEST-ASSERT to give a macro that provides a function similar to "assert" in other languages. This macro evaluates both forms before comparing them.
The tests in verify/all.sh pass.
I refactored $TEST to use $TEST-EQUAL.
> (import "test")
T
> ($test (+ 1 2) 3)
T
> ($test (+ 1 2) 4)
(+ 1 2) is bad. correct is 4 but got 3
T
> ($test (+ 1 2) (+ 2 2))
(+ 1 2) is bad. correct is (+ 2 2) but got 3
T
> ($test (+ 1 2) (+ 2 1))
(+ 1 2) is bad. correct is (+ 2 1) but got 3
T
> ($test (list 1 2) (1 2))
T
> ($test-assert (+ 1 2) 3)
T
> ($test-assert (+ 1 2) 4)
(+ 1 2) is bad. correct is 4 but got 3
T
> ($test-assert (+ 1 2) (+ 2 2))
(+ 1 2) is bad. correct is 4 but got 3
T
> ($test-assert (+ 1 2) (+ 2 1))
T
> ($test-assert (list 1 2) (1 2))
Unbound function at EVAL 1
I cleaned up the documentation to make it sound more natural.
I created $TEST-ASSERT to give a macro that provides a function similar to "assert" in other languages. This macro evaluates both forms before comparing them. The tests in
verify/all.sh
pass.I refactored $TEST to use $TEST-EQUAL.
I cleaned up the documentation to make it sound more natural.