Expand description
Support code for rustc’s built in unit-test and micro-benchmarking framework.
Almost all user code will only be interested in Bencher
and
black_box
. All other interactions (such as writing tests and
benchmarks themselves) should be done via the #[test]
and
#[bench]
attributes.
See the Testing Chapter of the book for more details.
Re-exports
pub use self::bench::black_box;
pub use self::bench::Bencher;
pub use self::types::TestName::*;
pub use NamePadding::*;
pub use TestFn::*;
pub use TestName::*;
pub use self::ColorConfig::*;
Modules
- Benchmarking module.
Structs
- Options for the test run defined by the caller (instead of CLI arguments). In case we want to add other options as well, just add them in this struct.
Enums
- Whether should console output be colored or not
- Format of the test results output
- Whether ignored test should be run or not
- Whether test is expected to panic or not
- Type of the test according to the rust book conventions.
Traits
- Represents a benchmark function.
- Invoked when unit tests terminate. Should panic if the unit Tests is considered a failure. By default, invokes
report()
and checks for a0
result.
Functions
- Invoked when unit tests terminate. Should panic if the unit Tests is considered a failure. By default, invokes
report()
and checks for a0
result. - A simple console test runner. Runs provided tests reporting process and results to the stdout.
- A variant optimized for invocation with a static test vector. This will panic (intentionally) when fed any dynamic tests.
- A variant optimized for invocation with a static test vector. This will panic (intentionally) when fed any dynamic tests.