test/assert
assert-eq
(assert-eq [expected :int actual :int] :bool)
assert two integer values are equal.
| expected | the expected value | |
| actual | the actual value |
true if equal, false with a diagnostic if not.
(assert-eq (+ 1 2) 3) ; => true
Since: P1
assert-ne
(assert-ne [a :int b :int] :bool)
assert two integer values are not equal.
| a | first value | |
| b | second value |
true if different, false with a diagnostic if equal.
(assert-ne 1 2) ; => true
Since: P1
assert-true
(assert-true [x :bool] :bool)
assert a value is truthy.
| x | the condition to check |
true if truthy, false with a diagnostic otherwise.
(assert-true (> 3 2)) ; => true
Since: P1
assert-false
(assert-false [x :bool] :bool)
assert a value is falsy.
| x | the condition to check |
true if falsy, false with a diagnostic otherwise.
(assert-false (= 1 2)) ; => true
Since: P1
assert-some
(assert-some [o :int] :bool)
assert an option value is some (non-NULL with is_some=true).
| o | option value (opaque :int handle) |
true if some, false with a diagnostic if none.
(assert-some (some 42)) ; => true
Since: P1
assert-none
(assert-none [o :int] :bool)
assert an option value is none (NULL or is_some=false).
| o | option value (opaque :int handle) |
true if none, false with a diagnostic if some.
(assert-none (none)) ; => true
Since: P1
assert-ok
(assert-ok [r :int] :bool)
assert a result value is ok.
| r | result value (opaque :int handle) |
true if ok, false with a diagnostic if err.
(assert-ok (ok 42)) ; => true
Since: P1
assert-err
(assert-err [r :int] :bool)
assert a result value is err.
| r | result value (opaque :int handle) |
true if err, false with a diagnostic if ok.
(assert-err (err 1)) ; => true
Since: P1