Expand description
A collection of mathematical properties for random testing.
It’s based on dicetest.
§Example
use diceprop::{props, Fun2, Set};
use dicetest::prelude::*;
#[test]
fn wrapping_add_is_associative_for_u32() {
Dicetest::repeatedly().run(|mut fate| {
let set = Set::new("u32", dice::u32(..));
let vars = fate.roll(set.vars(["x", "y", "z"]));
let add = Fun2::infix("+", |x, y| u32::wrapping_add(x, y));
props::binop::associative(vars, add);
})
}Modules§
- ops
- A collection of operations on
Evalthat are useful for writing properties. - props
- A collection of properties that can be verified with randomly generated test data.
Structs§
- Elem
- Represents an element of type
S. - Eval
- Represents a evaluated expression of type
S. - Fun1
- Represents a function of arity 1.
- Fun2
- Represents a function of arity 2.
- Fun3
- Represents a function of arity 3.
- Fun1
Label - A human-readable label that describes a
Fun1applied to an argument. - Fun2
Label - A human-readable label that describes a
Fun2applied to arguments. - Fun3
Label - A human-readable label that describes a
Fun3applied to arguments. - Set
- A mathematical set that can be used to randomly choose
Vars. - Vars
- Represents elements that were chosen from a set and that can be used as variables in properties.