Skip to main content

Crate unittest

Crate unittest 

Source

Macros§

assert_eq
Asserts that two expressions are equal and short-circuits on failure.
assert_false
Asserts that the expression evaluates to false and short-circuits on failure.
assert_ge
Asserts that the first expression is greater than or equal to the second and short-circuits on failure.
assert_gt
Asserts that the first expression is greater than the second and short-circuits on failure.
assert_le
Asserts that the first expression is less than or equal to the second and short-circuits on failure.
assert_lt
Asserts that the first expression is less than the second and short-circuits on failure.
assert_ne
Asserts that two expressions are not equal and short-circuits on failure.
assert_nonnull
Asserts that the pointer is non-null and short-circuits on failure.
assert_null
Asserts that the pointer is null and short-circuits on failure.
assert_ok
Asserts that the expression evaluates to OK and short-circuits on failure.
assert_true
Asserts that the expression evaluates to true and short-circuits on failure.
expect_eq
Asserts that two expressions are equal, but does not short-circuit on failure.
expect_false
Asserts that the expression evaluates to false, but does not short-circuit on failure.
expect_ge
Asserts that the first expression is greater than or equal to the second, but does not short-circuit on failure.
expect_gt
Asserts that the first expression is greater than the second, but does not short-circuit on failure.
expect_le
Asserts that the first expression is less than or equal to the second, but does not short-circuit on failure.
expect_lt
Asserts that the first expression is less than the second, but does not short-circuit on failure.
expect_ne
Asserts that two expressions are not equal, but does not short-circuit on failure.
expect_nonnull
Asserts that the pointer is non-null, but does not short-circuit on failure.
expect_null
Asserts that the pointer is null, but does not short-circuit on failure.
expect_ok
Asserts that the expression evaluates to OK, but does not short-circuit on failure.
expect_true
Asserts that the expression evaluates to true, but does not short-circuit on failure.
unwrap_ok
Asserts that the expression evaluates to Result::Ok and returns the resulting value, otherwise short-circuits.

Structs§

UserMemory
UserMemory facilitates testing code that requires user memory.

Functions§

printf

Attribute Macros§

test_suite
Attribute macro defining suite of unit tests defined as module. The attribute may only be used in a cfg(ktest) context.