Module std::testing

Testing assertion library for Hew.

Provides assertion functions that panic with descriptive messages on failure. No Rust FFI โ€” pure Hew only.

Examples

import std::testing;

fn main() {
    testing.assert_eq(1 + 1, 2);
    testing.assert_true(10 > 5);
    testing.assert_eq_str("hello", "hello");
}

Contents

Functions

Function assert_eq

pub fn assert_eq(actual: i64, expected: i64)

Assert that two integers are equal. Panics with a message showing the expected and actual values when they differ.

Function assert_eq_u8

pub fn assert_eq_u8(actual: u8, expected: u8)

Assert that two u8 byte values are equal. Panics with a message showing the expected and actual values when they differ.

Function assert_ne_u8

pub fn assert_ne_u8(a: u8, b: u8)

Assert that two u8 byte values are not equal. Panics when a == b.

Function assert_eq_str

pub fn assert_eq_str(actual: string, expected: string)

Assert that two strings are equal. Panics with a message showing the expected and actual values when they differ.

Function assert_ne

pub fn assert_ne(a: i64, b: i64)

Assert that two integers are not equal. Panics when a == b.

Function assert_true

pub fn assert_true(condition: bool)

Assert that a condition is true. Panics when condition is false.

Function assert_false

pub fn assert_false(condition: bool)

Assert that a condition is false. Panics when condition is true.

Function assert_gt

pub fn assert_gt(a: i64, b: i64)

Assert that a is strictly greater than b.

Function assert_lt

pub fn assert_lt(a: i64, b: i64)

Assert that a is strictly less than b.