Skip to main content

QCStrategy

Struct QCStrategy 

Source
pub struct QCStrategy<A: Arbitrary + Debug> { /* private fields */ }
Expand description

QCStrategy is a Strategy that provides interoperability with quickcheck’s Arbitrary trait. If you have any type implementing Arbitrary and Debug, which a temporary requirement, then you may get back the equivalent Strategy in proptest.

Implementations§

Source§

impl<A: Arbitrary + Debug> QCStrategy<A>

Source

pub fn new(size: usize) -> Self

Constructs a new QCStrategy given a size parameter that:

controls the size of random values generated. For example, it specifies the maximum length of a randomly generated vector and also will specify the maximum magnitude of a randomly generated number.

as defined by quickcheck

Trait Implementations§

Source§

impl<A: Clone + Arbitrary + Debug> Clone for QCStrategy<A>

Source§

fn clone(&self) -> QCStrategy<A>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Copy + Arbitrary + Debug> Copy for QCStrategy<A>

Source§

impl<A: Debug + Arbitrary + Debug> Debug for QCStrategy<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: Eq + Arbitrary + Debug> Eq for QCStrategy<A>

Source§

impl<A: Hash + Arbitrary + Debug> Hash for QCStrategy<A>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<A: Ord + Arbitrary + Debug> Ord for QCStrategy<A>

Source§

fn cmp(&self, other: &QCStrategy<A>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<A: PartialEq + Arbitrary + Debug> PartialEq for QCStrategy<A>

Source§

fn eq(&self, other: &QCStrategy<A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A: PartialOrd + Arbitrary + Debug> PartialOrd for QCStrategy<A>

Source§

fn partial_cmp(&self, other: &QCStrategy<A>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<A: Arbitrary + Debug> Strategy for QCStrategy<A>

Source§

type Value = QCValueTree<A>

The value tree generated by this Strategy. Read more
Source§

fn new_value(&self, runner: &mut TestRunner) -> NewTree<Self>

Generate a new value tree from the given runner. Read more
Source§

fn prop_map<O, F>(self, fun: F) -> Map<Self, F>
where O: Debug, F: Fn(<Self::Value as ValueTree>::Value) -> O, Self: Sized,

Returns a strategy which produces values transformed by the function fun. Read more
Source§

fn prop_perturb<O, F>(self, fun: F) -> Perturb<Self, F>
where O: Debug, F: Fn(<Self::Value as ValueTree>::Value, XorShiftRng) -> O, Self: Sized,

Returns a strategy which produces values transformed by the function fun, which is additionally given a random number generator. Read more
Source§

fn prop_flat_map<S, F>(self, fun: F) -> Flatten<Map<Self, F>>
where S: Strategy, F: Fn(<Self::Value as ValueTree>::Value) -> S, Self: Sized,

Maps values produced by this strategy into new strategies and picks values from those strategies. Read more
Source§

fn prop_ind_flat_map<S, F>(self, fun: F) -> IndFlatten<Map<Self, F>>
where S: Strategy, F: Fn(<Self::Value as ValueTree>::Value) -> S, Self: Sized,

Maps values produced by this strategy into new strategies and picks values from those strategies while considering the new strategies to be independent. Read more
Source§

fn prop_ind_flat_map2<S, F>(self, fun: F) -> IndFlattenMap<Self, F>
where S: Strategy, F: Fn(<Self::Value as ValueTree>::Value) -> S, Self: Sized,

Similar to prop_ind_flat_map(), but produces 2-tuples with the input generated from self in slot 0 and the derived strategy in slot 1. Read more
Source§

fn prop_filter<R, F>(self, whence: R, fun: F) -> Filter<Self, F>
where R: Into<Reason>, F: Fn(&<Self::Value as ValueTree>::Value) -> bool, Self: Sized,

Returns a strategy which only produces values accepted by fun. Read more
Source§

fn prop_union(self, other: Self) -> Union<Self>
where Self: Sized,

Returns a strategy which picks uniformly from self and other. Read more
Source§

fn prop_recursive<F>( self, depth: u32, desired_size: u32, expected_branch_size: u32, recurse: F, ) -> Recursive<Box<dyn Strategy<Value = Box<dyn ValueTree<Value = <Self::Value as ValueTree>::Value>>>>, F>
where F: Fn(Arc<Box<dyn Strategy<Value = Box<dyn ValueTree<Value = <Self::Value as ValueTree>::Value>>>>>) -> Box<dyn Strategy<Value = Box<dyn ValueTree<Value = <Self::Value as ValueTree>::Value>>>>, Self: Sized + 'static,

Generate a recursive structure with self items as leaves. Read more
Source§

fn prop_shuffle(self) -> Shuffle<Self>
where Self: Sized, <Self::Value as ValueTree>::Value: Shuffleable,

Shuffle the contents of the values produced by this strategy. Read more
Source§

fn boxed( self, ) -> Box<dyn Strategy<Value = Box<dyn ValueTree<Value = <Self::Value as ValueTree>::Value>>>>
where Self: Sized + 'static,

Erases the type of this Strategy so it can be passed around as a simple trait object. Read more
Source§

fn sboxed( self, ) -> Box<dyn Strategy<Value = Box<dyn ValueTree<Value = <Self::Value as ValueTree>::Value>>> + Sync + Send>
where Self: Sized + Send + Sync + 'static,

Erases the type of this Strategy so it can be passed around as a simple trait object. Read more
Source§

fn no_shrink(self) -> NoShrink<Self>
where Self: Sized,

Wraps this strategy to prevent values from being subject to shrinking. Read more
Source§

impl<A: PartialEq + Arbitrary + Debug> StructuralPartialEq for QCStrategy<A>

Auto Trait Implementations§

§

impl<A> Freeze for QCStrategy<A>

§

impl<A> RefUnwindSafe for QCStrategy<A>
where A: RefUnwindSafe,

§

impl<A> Send for QCStrategy<A>

§

impl<A> Sync for QCStrategy<A>
where A: Sync,

§

impl<A> Unpin for QCStrategy<A>
where A: Unpin,

§

impl<A> UnsafeUnpin for QCStrategy<A>

§

impl<A> UnwindSafe for QCStrategy<A>
where A: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.