Crate sample_test

Source
Expand description

Testing utilities for use with samplers defined via sample_std.

The easiest way to use these facilities is with the exported sample_test macro:

use sample_test::{sample_test, Sample};

#[sample_test]
fn test_order(#[sample(0..10)] a: usize, #[sample(20..30)] b: usize) -> bool {
    a < b
}

You may also use tester::SampleTest or tester::sample_test directly:

use sample_test::{Random, tester::sample_test};
fn test(a: usize, b: usize) -> bool {
    let sum = a + b;
    sum >= a && sum >= b
}

let mut r = Random::new();
let mut s = (0..10, 0..10);

sample_test(s, test as fn(usize, usize) -> bool);

Re-exports§

pub use tester::SampleTest;
pub use tester::TestResult;
pub use tester::Testable;

Modules§

tester
Test utilities for sample_std::Sample.

Structs§

Gen
Gen represents a PRNG.
Random
Random represents a PRNG.

Traits§

Arbitrary
Arbitrary describes types whose values can be randomly generated and shrunk.
Sample
User-defined strategies for generating and shrinking an Output type.

Functions§

env_logger_init

Attribute Macros§

sample_test