Skip to main content

Crate unittest

Crate unittest 

Source

Macros§

assert_eq
Asserts that two expressions are equal and short-circuits on failure.
assert_err
Asserts that the expression evaluates to the specified error status 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_err
Asserts that the expression evaluates to the specified error status, 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.
subtest
Creates an isolated subtest closure with its own failure tracking.
unwrap_ok
Asserts that the expression evaluates to Result::Ok and returns the resulting value, otherwise short-circuits.
unwrap_some
Asserts that the expression evaluates to Option::Some and returns the resulting value, otherwise short-circuits.

Attribute Macros§

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