prop_check_rs/lib.rs
1/// # prop-check-rs
2///
3/// A property-based testing library written in Rust. It leverages functional programming concepts
4/// to efficiently generate and validate test data.
5///
6/// ## What is Property-Based Testing?
7///
8/// Property-based testing is a testing methodology where instead of testing specific input values,
9/// you define properties that your program should satisfy and then verify these properties against
10/// a large number of randomly generated inputs. This approach helps discover edge cases that
11/// developers might not have anticipated.
12///
13/// ## Key Components
14///
15/// - `Gen<A>`: A generator for values of type `A`. It provides methods like `map`, `flat_map`,
16/// and `and_then` to create new generators from existing ones.
17///
18/// - `Gens`: A factory for creating various generators for basic types, lists, optional values,
19/// and more.
20///
21/// - `Prop`: A structure representing a property. A property defines a condition to verify against
22/// values generated by a generator.
23///
24/// - `State<S, A>`: A monad representing a computation with state `S` that produces a value of
25/// type `A`. This allows composing computations while maintaining state.
26///
27/// ## Example
28///
29/// ```rust
30/// use prop_check_rs::gen::Gens;
31/// use prop_check_rs::prop::{for_all_gen, test_with_prop};
32/// use prop_check_rs::rng::RNG;
33///
34/// // Generator for a list of integers from 0 to 100
35/// let gen = Gens::list_of_n(10, Gens::choose_i32(0, 100));
36///
37/// // Property: The list length is always 10
38/// let prop = for_all_gen(gen, |list| {
39/// list.len() == 10
40/// });
41///
42/// // Test the property (max size 1, 100 test cases)
43/// let result = test_with_prop(prop, 1, 100, RNG::new());
44/// ```
45pub mod gen;
46pub mod machine;
47pub mod prop;
48pub mod rng;
49pub mod state;