Skip to main content

Testable

Trait 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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Testable for ()

Source§

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

Source§

impl Testable for bool

Source§

fn result(&self, _: &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<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> Testable for fn(A, B, C, D, E, F, G, H) -> T

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§