logos.std.testing
Module std · package logos-std
Types
structTestCtx
struct TestCtx
Accumulates test pass/fail counts; each failing assertion prints a diagnostic to stderr.
Fields
current: String
failed: i32
passed: i32
Methods
fn assert_eq_i32(self: &mut TestCtx, actual: i32, expected: i32) -> void
Asserts actual == expected, widening to i64 and delegating to assert_eq_i64.
fn assert_eq_i64(self: &mut TestCtx, actual: i64, expected: i64) -> void
Asserts actual == expected; the failure diagnostic includes both values.
fn assert_eq_str(self: &mut TestCtx, actual: &[u8], expected: &[u8]) -> void
Asserts actual and expected are byte-for-byte equal.
fn assert_false(self: &mut TestCtx, cond: bool) -> void
Asserts cond is false; a failure is recorded and execution continues (no abort).
fn assert_true(self: &mut TestCtx, cond: bool) -> void
Asserts cond is true; a failure is recorded and execution continues (no abort).
fn begin(self: &mut TestCtx, name: &[u8]) -> void
Starts a named test case; name is included in failure messages until the next begin.
fn fail(self: &mut TestCtx, reason: &[u8]) -> void
Records an unconditional failure with reason in the diagnostic.
fn new() -> TestCtx
Creates a TestCtx with zero counts and no current test name.
fn summary(self: &TestCtx) -> i32
Prints a pass/fail summary to stderr; returns exit code 0 on success, 1 on any failure.