Trait sample_std::Testable

source ·
pub trait Testable: 'static {
    // Required method
    fn result(&self, _: &mut Gen) -> TestResult;
}
Expand description

Testable describes types (e.g., a function) whose values can be tested.

Anything that can be tested must be capable of producing a TestResult given a random number generator. This is trivial for types like bool, which are just converted to either a passing or failing test result.

For functions, an implementation must generate random arguments and potentially shrink those arguments if they produce a failure.

It’s unlikely that you’ll have to implement this trait yourself.

Required Methods§

source

fn result(&self, _: &mut Gen) -> TestResult

Implementations on Foreign Types§

source§

impl<T> Testable for fn() -> Twhere T: Testable,

source§

fn result(&self, g: &mut Gen) -> TestResult

source§

impl<T, A, B, C, D, E, F, G, H> Testable for fn(_: A, _: B, _: C, _: D, _: E, _: F, _: G, _: H) -> Twhere T: Testable, A: Arbitrary + Debug, B: Arbitrary + Debug, C: Arbitrary + Debug, D: Arbitrary + Debug, E: Arbitrary + Debug, F: Arbitrary + Debug, G: Arbitrary + Debug, H: Arbitrary + Debug,

source§

fn result(&self, g: &mut Gen) -> TestResult

source§

impl<T, A> Testable for fn(_: A) -> Twhere T: Testable, A: Arbitrary + Debug,

source§

fn result(&self, g: &mut Gen) -> TestResult

source§

impl<T, A, B> Testable for fn(_: A, _: B) -> Twhere T: Testable, A: Arbitrary + Debug, B: Arbitrary + Debug,

source§

fn result(&self, g: &mut Gen) -> TestResult

source§

impl<T, A, B, C, D, E, F, G> Testable for fn(_: A, _: B, _: C, _: D, _: E, _: F, _: G) -> Twhere T: Testable, A: Arbitrary + Debug, B: Arbitrary + Debug, C: Arbitrary + Debug, D: Arbitrary + Debug, E: Arbitrary + Debug, F: Arbitrary + Debug, G: Arbitrary + Debug,

source§

fn result(&self, g: &mut Gen) -> TestResult

source§

impl<A, E> Testable for Result<A, E>where A: Testable, E: Debug + 'static,

source§

fn result(&self, g: &mut Gen) -> TestResult

source§

impl Testable for bool

source§

fn result(&self, _: &mut Gen) -> TestResult

source§

impl Testable for ()

source§

fn result(&self, _: &mut Gen) -> TestResult

source§

impl<T, A, B, C, D> Testable for fn(_: A, _: B, _: C, _: D) -> Twhere T: Testable, A: Arbitrary + Debug, B: Arbitrary + Debug, C: Arbitrary + Debug, D: Arbitrary + Debug,

source§

fn result(&self, g: &mut Gen) -> TestResult

source§

impl<T, A, B, C, D, E> Testable for fn(_: A, _: B, _: C, _: D, _: E) -> Twhere T: Testable, A: Arbitrary + Debug, B: Arbitrary + Debug, C: Arbitrary + Debug, D: Arbitrary + Debug, E: Arbitrary + Debug,

source§

fn result(&self, g: &mut Gen) -> TestResult

source§

impl<T, A, B, C> Testable for fn(_: A, _: B, _: C) -> Twhere T: Testable, A: Arbitrary + Debug, B: Arbitrary + Debug, C: Arbitrary + Debug,

source§

fn result(&self, g: &mut Gen) -> TestResult

source§

impl<T, A, B, C, D, E, F> Testable for fn(_: A, _: B, _: C, _: D, _: E, _: F) -> Twhere T: Testable, A: Arbitrary + Debug, B: Arbitrary + Debug, C: Arbitrary + Debug, D: Arbitrary + Debug, E: Arbitrary + Debug, F: Arbitrary + Debug,

source§

fn result(&self, g: &mut Gen) -> TestResult

Implementors§