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
//! **rvtest** — A Next Level Testing Framework for Rust.
//!
//! `rvtest` extends Rust's built-in testing capabilities with:
//!
//! - **BDD-style specs** — organise tests with `describe` / `it` blocks,
//! nested hierarchies, tags, timeouts, and retries.
//! - **Property-based testing** — verify invariants over randomly generated
//! inputs, with automatic counterexample shrinking.
//! - **Parametrized tests** — run the same test logic against multiple
//! inputs without boilerplate.
//! - **Rich reporting** — Pretty (human-readable with colour), TAP, JUnit
//! XML, JSON, and Compact formats.
//! - **Code coverage** — measure line/function/region coverage via LLVM
//! instrumentation (`cargo rvtest --coverage`).
//! - **Configurable runner** — parallel execution, name and tag filtering,
//! fail-fast, configurable timeouts and retries.
//!
//! # Usage inside `#[test]` (recommended)
//!
//! Rvtest is designed to be used inside standard `#[test]` functions.
//! Build a spec with [`describe`] and [`it`](spec::Spec::it), call
//! [`run`](spec::Spec::run), then verify with [`assert_all_pass`](core::TestSuite::assert_all_pass):
//!
//! ```ignore
//! use rvtest::spec::describe;
//!
//! #[test]
//! fn calculator_tests() {
//! describe("Calculator")
//! .it("adds two positive numbers", || {
//! assert_eq!(2 + 2, 4);
//! })
//! .it("subtracts", || {
//! assert_eq!(5 - 3, 2);
//! })
//! .tag("arithmetic")
//! .run()
//! .assert_all_pass();
//! }
//! ```
//!
//! If any spec fails, `assert_all_pass` will panic with a detailed report,
//! which causes the `#[test]` to fail naturally — no need for `main()`.
//!
//! # Property-based testing inside `#[test]`
//!
//! ```ignore
//! use rvtest::property::{check, any};
//!
//! #[test]
//! fn addition_is_commutative() {
//! check("commutativity", any::<i32>(), |a: &i32| {
//! let b: i32 = 42; // fixed second operand
//! a + b == b + *a
//! });
//! }
//! ```
//!
//! # Parametrized tests inside `#[test]`
//!
//! ```ignore
//! use rvtest::param::parametrize;
//!
//! #[test]
//! fn addition_cases() {
//! for case in parametrize("add", [(1, 1, 2), (0, 0, 0), (-1, 1, 0)], |(a, b, exp)| {
//! assert_eq!(a + b, *exp);
//! }) {
//! assert!(case.status.is_passed(), "{} failed", case.name);
//! }
//! }
//! ```
//!
//! # CLI usage (`cargo rvtest`)
//!
//! The `cargo-rvtest` binary runs specs defined in your project and
//! produces formatted output. See `cargo rvtest --help`.
/// The `prelude` module re-exports the most commonly used types and
/// functions for convenience.