Crate test

source ·
🔬This is a nightly-only experimental API. (test)
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§

Modules§

  • benchExperimental
    Benchmarking module.
  • statsExperimental
  • testExperimental

Structs§

  • OptionsExperimental
    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.
  • TestDescExperimental
  • TestDescAndFnExperimental
  • TestIdExperimental
  • TestOptsExperimental

Enums§

Functions§

  • assert_test_resultExperimental
    Invoked when unit tests terminate. Returns Result::Err if the test is considered a failure. By default, invokes report() and checks for a 0 result.
  • filter_testsExperimental
  • run_testExperimental
  • run_testsExperimental
  • run_tests_consoleExperimental
    A simple console test runner. Runs provided tests reporting process and results to the stdout.
  • test_mainExperimental
  • test_main_staticExperimental
    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.