Skip to main content

Crate falsify

Crate falsify 

Source
Expand description

Simple usage example (wrap it in a test):

use falsify::*;

let rng = make_test_rng();
let arb = arb_usize(rng);
let property = |n| n < 10;
if let Some(falsifier) = falsify(property, arb) {
    let shrinker = shrink_usize_binary_search(falsifier);
    let smallest_falsifier = shrink(property, shrinker);
    assert_eq!(smallest_falsifier, 10);
}

Structs§

HasherBuilder
All HashSet/HashMap collections in tested code need to use this HasherBuilder for the tests to be reproducible!

Enums§

TestResult

Traits§

ArbGen
Every generator of arbitrary test inputs of type Y is impl ArbGen<Y>.
ShrinkCoro
Every Y type shrinker is impl ShrinkCoro<Y>.

Functions§

arb_binary_heap_of
arb_bool
arb_box_of
arb_btreemap_of
arb_btreeset_of
arb_char
arb_f32
arb_f64
arb_hashmap_of
arb_hashset_of
arb_i8
arb_i16
arb_i32
arb_i64
arb_i128
arb_isize
arb_linked_list_of
arb_option_of
arb_rc_of
arb_result_of
arb_string
arb_tuple2_of
arb_tuple3_of
arb_u8
arb_u16
arb_u32
arb_u64
arb_u128
arb_usize
arb_vec_deque_of
arb_vec_of
arb_vec_of_rc_refcell_of
falsify
falsify_times
falsify_with_rejections
falsify_with_reset
make_rng_with_seed
make_test_rng
Takes the seed value from the FALSIFY_SEED environment variable, if set.
shrink
shrink_binary_heap_len_binary_search
shrink_bool
shrink_btreemap_len_binary_search
shrink_btreeset_len_binary_search
shrink_char_binary_search
shrink_f32
shrink_f64
shrink_hashmap_len_binary_search
shrink_hashset_len_binary_search
shrink_i8_binary_search
shrink_i16_binary_search
shrink_i32_binary_search
shrink_i64_binary_search
shrink_i128_binary_search
shrink_isize_binary_search
shrink_linked_list_len_binary_search
shrink_option
Tactic: Run test with None. If it failed, we have our smallest falsifier. If the test succeeded, produce successive Some(t), where t comes from the underlying shirinker for t.
shrink_u8_binary_search
shrink_u16_binary_search
shrink_u32_binary_search
shrink_u64_binary_search
shrink_u128_binary_search
shrink_usize_binary_search
shrink_usize_exhaustive
shrink_vec_deque_len_binary_search
shrink_vec_len_binary_search
shrink_with_rejections