run-suite suite
Runs a test suite if tests are enabled, or returns without doing anything if they are disabled (default). See enable-unit-tests
and disable-unit-tests
for more information.
enable-unit-tests
Enables unit test execution. Subsequent calls to run-suite
will now run tests.
disable-unit-tests
Disables test execution. Subsequent calls to run-suite
will be a no-op.
assert val [optional: message]
Asserts that val
is true, and fails with an error if it is not.
assert-not val
Asserts that val
is not true, and fails with an error if it is.
assert-equal expected actual
Asserts that two values are equal, and fails with an error if they are not.
assert-equal-fp expected actual [optional: precision]
Asserts that two floating point values are equal within the given precision.
test-suite name {unit-test/test-suite}
Creates a new test suite. A test suite consists of either other suites or unit tests. For example:
(test-suite "Example Suite" (unit-test "example test" (assert-equal 5 (+ 2 3)) (assert-equal-fp 0 1e-14 1e-13) (assert (even? 3) "Expected 3 to be even")))You can then run the suite with
run-suite
. The output will look like this: * Running "Example Suite"... * Running "example test"... FAILED: Expected 3 to be even ------------------------------------- SUITE SUMMARY (Example Suite) 0/1 tests passed. There were 1 failures. -------------------------------------
unit-test name {expression}
Creates a new unit test. See test-suite
for an example.
Scheme Power Tools Documentation
(c) Maciej Pacula 2010-2011
http://mpacula.com