Test
is the standard test framework.
Example:
(load-and-use Test)
(deftest test
(assert-equal test
2
(+ 1 1)
"addition works"
)
)
assert-dynamic-equal
Macro
(assert-dynamic-equal state x y descr)
Assert that the dynamic expressions x
and y
are equal.
assert-dynamic-op
Macro
(assert-dynamic-op state x y descr op)
Assert that the dynamic expressions x
and y
are equal.
assert-equal
(Fn [(Ref Test.State a), b, b, (Ref c d)] Test.State)
(assert-equal state x y descr)
Assert that x and y are equal. Equality needs to be implemented for their type.
assert-error
(Fn [(Ref Test.State a), (Ref (Result b c) d), (Ref e f)] Test.State)
(assert-error state x descr)
Assert that x is an Error
.
assert-exit
(Fn [(Ref Test.State a), Int, (Fn [] () b), (Ref c d)] Test.State)
(assert-exit state exit-code f descr)
Assert that function f exits with exit code exit-code.
assert-false
(Fn [(Ref Test.State a), Bool, (Ref b c)] Test.State)
(assert-false state x descr)
Assert that x is false.
assert-just
(Fn [(Ref Test.State a), (Ref (Maybe b) c), (Ref d e)] Test.State)
(assert-just state x descr)
Assert that x is a Just
.
assert-not-equal
(Fn [(Ref Test.State a), b, b, (Ref c d)] Test.State)
(assert-not-equal state x y descr)
Assert that x and y are not equal. Equality needs to be implemented for their type.
assert-nothing
(Fn [(Ref Test.State a), (Ref (Maybe b) c), (Ref d e)] Test.State)
(assert-nothing state x descr)
Assert that x is a Nothing
.
assert-op
(Fn [(Ref Test.State a), b, c, (Ref d e), (Fn [b, c] Bool f)] Test.State)
(assert-op state x y descr op)
Assert that op returns true when given x and y.
assert-ref-equal
(Fn [(Ref Test.State a), b, b, (Ref c d)] Test.State)
(assert-ref-equal state x y descr)
Assert that x and y are equal by reference. Reference equality needs to be implemented for their type.
assert-signal
(Fn [(Ref Test.State a), Int, (Fn [] () b), (Ref c d)] Test.State)
(assert-signal state signal x descr)
Assert that function f aborts with OS signal signal.
assert-success
(Fn [(Ref Test.State a), (Ref (Result b c) d), (Ref e f)] Test.State)
(assert-success state x descr)
Assert that x is a Success
.
assert-true
(Fn [(Ref Test.State a), Bool, (Ref b c)] Test.State)
(assert-true state x descr)
Assert that x is true.