Crate ntest

Source
Expand description

The ntest lib enhances the rust test framework with some useful functions.

Macros§

assert_about_eq
Compare floating point values or vectors of floating points wether they are approximately equal. The default value for epsilon is 1.0e-6.
assert_false
Expects a false expression. Otherwise panics.
assert_panics
A panic in Rust is not always implemented via unwinding, but can be implemented by aborting the process as well. This function only catches unwinding panics, not those that abort the process. See the catch unwind documentation for more information.
assert_true
Expects a true expression. Otherwise panics.

Traits§

MaxDifference
Helper trait for assert_about_equal macro. Returns the max difference between two vectors of floats. Can also be used for single floats.

Attribute Macros§

test_case
Test cases can be used to have multiple inputs for a given function. With the #[test_case] attribute multiple tests will be generated using the Procedural Macros capabilities of rust.
timeout
The timeout attribute can be used for tests to let them fail if they exceed a certain execution time. With the #[timeout] attribute a timeout in milliseconds is added to a test.