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

Macro

                        (assert-dynamic-equal state x y descr)
                    

Assert that the dynamic expressions x and y are equal.

assert-dynamic-op

macro

Macro

                        (assert-dynamic-op state x y descr op)
                    

Assert that the dynamic expressions x and y are equal.

assert-equal

defn

(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

defn

(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

defn

(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

defn

(Fn [(Ref Test.State a), Bool, (Ref b c)] Test.State)

                        (assert-false state x descr)
                    

Assert that x is false.

assert-just

defn

(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

defn

(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

defn

(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

defn

(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

defn

(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

defn

(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

defn

(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

defn

(Fn [(Ref Test.State a), Bool, (Ref b c)] Test.State)

                        (assert-true state x descr)
                    

Assert that x is true.

defn

(Fn [(Ref Test.State a)] ())

                        (print-test-results state)
                    

Print test results.

reset

defn

(Fn [Test.State] Test.State)

                        (reset state)
                    

Reset test state.