Expand description
Extremely opinionated testing framework generating an exact specification and reducing code to its minimal implementation.
use ::sleuth::sleuth;
fn roundtrip<T, U, F, G>(f: F, g: G, x: T) -> bool
where
T: PartialEq + Clone,
F: Fn(U) -> T,
G: Fn(T) -> U,
{
x.clone() == f(g(x))
}
#[sleuth(
roundtrip(sub_one, 42),
!roundtrip(add_one, 42),
)]
fn add_one(x: u8) -> u8 {
x + 1_u8
}
#[sleuth(
roundtrip(add_one, 42),
!roundtrip(sub_one, 42),
)]
fn sub_one(x: u8) -> u8 {
x - 1_u8
}
Re-exports§
pub use expr::Expr;
pub use sleuth_mutator as mutator;
Modules§
- expr
- Nodes in an AST-aligned representation.
Macros§
- timid_
assert - Like an ordinary assertion, except success yields
None
and error yields the error message. - timid_
assert_ false - Like an ordinary assertion, except success yields
None
and error yields the error message.
Functions§
- testify
- Turns the output of a
timid_assert!
into a test.
Attribute Macros§
- sleuth
- Test that this is the shortest possible implementation to fulfill a set of properties.