To run unit test for your rust applications
sh
cargo add unit-testing
```toml
[package]
name = "
[lib]
name = "
[[bin]] name = "unit-testing" path = "src/bin.rs"
[dependencies] coloredtruecolor = "0.1.0" mockall = "0.11.3" progressbar = "1.0.3" unit-testing = "0.3.3" ```
```rust
use unit::Tdd;
fn pythagore(t: &mut Tdd) -> &mut Tdd { t.assert ( 4 * 4 + 3 * 3 == 5 * 5, "The triangle 4 by 3 is rectangle", "The triangle 4 by 3 is not rectangle", ) .assert ( 8 * 8 + 15 * 15 == 17 * 17, "The triangle 8 by 15 is rectangle", "The triangle 8 by 15 is not rectangle", ).assert ( 5 * 5 + 12 * 12 == 13 * 13, "The triangle 5 by 12 is rectangle", "The triangle 5 by 12 is not rectangle", ) } Tdd::describe( "Check the pythagore theorem", &pythagore, ).ok().expect("A triangle is not rectangle"); ```
shell
./target/debug/unit-testing