1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
pub use Check;
/// Turns a function into a property test.
///
/// It takes a list of generators as input, which are used to produce random
/// arguments for the function it's attached to.
///
/// The function can return `()`, `bool`, or `Result` to indicate whether the
/// property holds. Any `panic` within the function is also treated as a test
/// failure.
///
/// # Arguments
///
/// - **Generators**: The first arguments to the macro are a comma-separated
/// list of generators. The values produced by these generators will be passed
/// as arguments to the test function. You can use `_` to infer the default
/// generator for a type.
/// - `verbose`: A boolean (`true` or `false`) to enable or disable verbose
/// output, which shows every generation and shrink step. Defaults to `false`.
/// - `color`: A boolean (`true` or `false`) to enable or disable colored
/// output. Defaults to `true`.
/// - `debug`: A boolean (`true` or `false`) that controls the output format. If
/// `true`, the full `Debug` representation of test results is printed. If
/// `false`, a more minimal output is used. Defaults to `true`.
///
/// # Examples
///
/// A simple test with a range generator:
/// ```
/// # use checkito::check;
/// #[check(0..100)]
/// fn is_less_than_100(x: i32) {
/// assert!(x < 100);
/// }
/// ```
///
/// Using multiple generators and inferring a type:
/// ```
/// # use checkito::check;
/// #[check(.., 0.0..1.0, _)]
/// fn complex_test(x: i32, y: f64, z: bool) {
/// // ...
/// }
/// ```
///
/// Disabling color and enabling verbose output:
/// ```
/// # use checkito::check;
/// #[check(0..10, color = false, verbose = true)]
/// #[should_panic]
/// fn failing_test(x: i32) {
/// assert!(x > 5);
/// }
/// ```
pub use check;
/// Creates a generator from a compile-time constant value.
///
/// This macro is useful for embedding constant values directly into generators.
/// This is mainly relevant for static cardinality estimates. When possible, the
/// expression inside the macro is converted to a generator with constant
/// parameters.
pub use constant;
/// Creates a generator from a regular expression, validated at compile time.
///
/// This macro takes a string literal representing a regular expression and
/// produces a generator that yields strings matching that pattern. The regex is
/// parsed and validated at compile time, so any errors in the pattern will
/// result in a compilation failure.
///
/// # Examples
///
/// ```
/// # use checkito::{check, regex};
/// #[check(regex!("[a-zA-Z0-9]{1,10}"))]
/// fn has_alphanumeric_content(s: String) {
/// assert!(s.chars().all(|c| c.is_alphanumeric()));
/// assert!(s.len() >= 1 && s.len() <= 10);
/// }
/// ```
pub use regex;
pub use ;
pub use *;
pub use Prove;
pub use Sample;
pub use Shrink;
pub use Weight;
const GENERATES: usize = 1 << 10;
const SHRINKS: usize = 1 << 20;
const SAMPLES: usize = 1 << 7;
const COLLECTS: usize = 1 << 10;
const REPEATS: u32 = 1 << 6;