[−][src]Struct quickcheck::QuickCheck
The main QuickCheck type for setting configuration and running QuickCheck.
Implementations
impl QuickCheck
[src]
pub fn new() -> QuickCheck
[src]
Creates a new QuickCheck value.
This can be used to run QuickCheck on things that implement Testable
.
You may also adjust the configuration, such as the number of tests to
run.
By default, the maximum number of passed tests is set to 100
, the max
number of overall tests is set to 10000
and the generator is created
with a size of 100
.
pub fn gen(self, gen: Gen) -> QuickCheck
[src]
Set the random number generator to be used by QuickCheck.
pub fn tests(mut self: Self, tests: u64) -> QuickCheck
[src]
Set the number of tests to run.
This actually refers to the maximum number of passed tests that
can occur. Namely, if a test causes a failure, future testing on that
property stops. Additionally, if tests are discarded, there may be
fewer than tests
passed.
pub fn max_tests(mut self: Self, max_tests: u64) -> QuickCheck
[src]
Set the maximum number of tests to run.
The number of invocations of a property will never exceed this number. This is necessary to cap the number of tests because QuickCheck properties can discard tests.
pub fn min_tests_passed(mut self: Self, min_tests_passed: u64) -> QuickCheck
[src]
Set the minimum number of tests that needs to pass.
This actually refers to the minimum number of valid passed tests that needs to pass for the property to be considered successful.
pub fn quicktest<A>(&mut self, f: A) -> Result<u64, TestResult> where
A: Testable,
[src]
A: Testable,
Tests a property and returns the result.
The result returned is either the number of tests passed or a witness of failure.
(If you're using Rust's unit testing infrastructure, then you'll
want to use the quickcheck
method, which will panic!
on failure.)
pub fn quickcheck<A>(&mut self, f: A) where
A: Testable,
[src]
A: Testable,
Tests a property and calls panic!
on failure.
The panic!
message will include a (hopefully) minimal witness of
failure.
It is appropriate to use this method with Rust's unit testing infrastructure.
Note that if the environment variable RUST_LOG
is set to enable
info
level log messages for the quickcheck
crate, then this will
include output on how many QuickCheck tests were passed.
Example
use quickcheck::QuickCheck; fn prop_reverse_reverse() { fn revrev(xs: Vec<usize>) -> bool { let rev: Vec<_> = xs.clone().into_iter().rev().collect(); let revrev: Vec<_> = rev.into_iter().rev().collect(); xs == revrev } QuickCheck::new().quickcheck(revrev as fn(Vec<usize>) -> bool); }
Auto Trait Implementations
impl RefUnwindSafe for QuickCheck
[src]
impl Send for QuickCheck
[src]
impl Sync for QuickCheck
[src]
impl Unpin for QuickCheck
[src]
impl UnwindSafe for QuickCheck
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,