Movatterモバイル変換


[0]ホーム

URL:


Docs.rs

QuickCheck

StructQuickCheck 

Source
pub struct QuickCheck {/* private fields */ }
Expand description

The main QuickCheck type for setting configuration and running QuickCheck.

Implementations§

Source§

implQuickCheck

Source

pub fnnew() ->QuickCheck

Creates a new QuickCheck value.

This can be used to run QuickCheck on things that implementTestable.You may also adjust the configuration, such as the number of tests torun.

By default, the maximum number of passed tests is set to100, the maxnumber of overall tests is set to10000 and the generator is createdwith a size of100.

Source

pub fngen(self, gen:Gen) ->QuickCheck

Set the random number generator to be used by QuickCheck.

Source

pub fntests(self, tests:u64) ->QuickCheck

Set the number of tests to run.

This actually refers to the maximum number ofpassed tests thatcan occur. Namely, if a test causes a failure, future testing on thatproperty stops. Additionally, if tests are discarded, there may befewer thantests passed.

Source

pub fnmax_tests(self, max_tests:u64) ->QuickCheck

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 QuickCheckproperties can discard tests.

Source

pub fnmin_tests_passed(self, min_tests_passed:u64) ->QuickCheck

Set the minimum number of tests that needs to pass.

This actually refers to the minimum number ofvalidpassed teststhat needs to pass for the property to be considered successful.

Source

pub fnquicktest<A>(&mut self, f: A) ->Result<u64,TestResult>
where A:Testable,

Tests a property and returns the result.

The result returned is either the number of tests passed or a witnessof failure.

(If you’re using Rust’s unit testing infrastructure, then you’llwant to use thequickcheck method, which willpanic! on failure.)

Source

pub fnquickcheck<A>(&mut self, f: A)
where A:Testable,

Tests a property and callspanic! on failure.

Thepanic! message will include a (hopefully) minimal witness offailure.

It is appropriate to use this method with Rust’s unit testinginfrastructure.

Note that if the environment variableRUST_LOG is set to enableinfo level log messages for thequickcheck crate, then this willinclude output on how many QuickCheck tests were passed.

§Example
usequickcheck::QuickCheck;fnprop_reverse_reverse() {fnrevrev(xs: Vec<usize>) -> bool {letrev: Vec<_> = xs.clone().into_iter().rev().collect();letrevrev: Vec<_> = rev.into_iter().rev().collect();        xs == revrev    }    QuickCheck::new().quickcheck(revrevas fn(Vec<usize>) -> bool);}

Auto Trait Implementations§

§

implFreeze forQuickCheck

§

implRefUnwindSafe forQuickCheck

§

implSend forQuickCheck

§

implSync forQuickCheck

§

implUnpin forQuickCheck

§

implUnwindSafe forQuickCheck

Blanket Implementations§

Source§

impl<T>Any for T
where T: 'static + ?Sized,

Source§

fntype_id(&self) ->TypeId

Gets theTypeId ofself.Read more
Source§

impl<T>Borrow<T> for T
where T: ?Sized,

Source§

fnborrow(&self) ->&T

Immutably borrows from an owned value.Read more
Source§

impl<T>BorrowMut<T> for T
where T: ?Sized,

Source§

fnborrow_mut(&mut self) ->&mut T

Mutably borrows from an owned value.Read more
Source§

impl<T>From<T> for T

Source§

fnfrom(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U>Into<U> for T
where U:From<T>,

Source§

fninto(self) -> U

CallsU::from(self).

That is, this conversion is whatever the implementation ofFrom<T> for U chooses to do.

Source§

impl<T, U>TryFrom<U> for T
where U:Into<T>,

Source§

typeError =Infallible

The type returned in the event of a conversion error.
Source§

fntry_from(value: U) ->Result<T, <T asTryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U>TryInto<U> for T
where U:TryFrom<T>,

Source§

typeError = <U asTryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fntry_into(self) ->Result<U, <U asTryFrom<T>>::Error>

Performs the conversion.

[8]ページ先頭

©2009-2025 Movatter.jp