std/testing
Runtime assertions for @test functions.
Each helper panics via the std/abort host intrinsic panic on failure,
with a self-explanatory message that names the expected/actual values.
The vader test runner intercepts those panics and reports the offending
arm as a failed test.
Composition: every helper builds on panic (the only primitive that
actually traps). @assert is a comptime-only top-level decorator and is
not what these run-time assertions hook into.
Functions
assert :: fn(cond: bool, msg: string) -> void Plain boolean assertion. assert(false, "...") traps with msg.
Parameters
| cond | bool | No description. |
| msg | string | No description. |
fail :: fn(msg: string) -> void Fail unconditionally with msg. Useful for unreachable-arm guards
inside tests (match x { is Foo -> ok() _ -> fail("x was not Foo") }).
Parameters
| msg | string | No description. |
assert_lt :: fn<T: Display & Comparable>(actual: T, bound: T) -> void Assert actual < bound.
Parameters
| actual | T | No description. |
| bound | T | No description. |
assert_lte :: fn<T: Display & Comparable>(actual: T, bound: T) -> void Assert actual <= bound.
Parameters
| actual | T | No description. |
| bound | T | No description. |
assert_gt :: fn<T: Display & Comparable>(actual: T, bound: T) -> void Assert actual > bound.
Parameters
| actual | T | No description. |
| bound | T | No description. |
assert_gte :: fn<T: Display & Comparable>(actual: T, bound: T) -> void Assert actual >= bound.
Parameters
| actual | T | No description. |
| bound | T | No description. |
assert_close :: fn(actual: f64, expected: f64, eps: f64) -> void Assert |actual - expected| <= eps. Float-friendly equality.
Parameters
| actual | f64 | No description. |
| expected | f64 | No description. |
| eps | f64 | No description. |