Lib unit

To run unit test for your rust applications

Installation

sh cargo add unit-testing

Usage

```rust use crate::zuu::Unit;

fn kool() -> bool { return false; }

fn look() -> bool { return true; }

fn f() -> i32 { return 1; }

fn theorem() -> bool { return 4 * 4 + 3 * 3 == 5 * 5; }

fn s() -> i32 { return 0; }

fn status(u: Unit) -> Unit { return u.failure(&f).success(&s); }

fn diff(u: Unit) -> Unit { return u.unequals(&f, 2).different("a", "b"); }

fn files(u: Unit) -> Unit { return u.exist("."); }

fn numbers(u: Unit) -> Unit { return u.equals(&s, 0).equals(&f, 1).unequals(&f, 2).between(&s, -1, 10).superior(&f, 0).inferior(&f, 10); }

fn teststring(u: Unit) -> Unit { let phrase = String::from("The humanity develop the linux kernel."); return u.empty("").notempty(" ").identical(&phrase, "The humanity develop the linux kernel.").contains(&phrase, "linux").begin(&phrase, "The").finnish(&phrase, "kernel."); }

fn boolean(u: Unit) -> Unit { return u.ok(&look).ko(&kool); }

fn main() -> i32 { Unit::new("Test the unit framework"); u.describe("Test all boolean", &boolean) .describe("Test numbers", &numbers) .describe("Test success and failure", &status) .describe("Test differences", &diff) .describe("Test string", &test_string) .describe("Test files", &files) .theory("Test pythagore", &theorem, true) .end(); } ```

Run the test

shell cargo run