# Lib unit
> To run unit test for your rust applications
* [Documentation](https://docs.rs/unit-testing/)
* [Report a bugs](https://github.com/taishingi/zuu/issues)
* [Source code](https://github.com/taishingi/zuu/tree/master/src/unit-testing)
* [Donate](https://www.paypal.com/donate/?hosted_button_id=LTYH2BXQF57AA)
* [Crate](https://crates.io/crates/unit-testing)
* [Getting cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html)
* [Rust guide](https://doc.rust-lang.org/cargo/guide/)
# 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 test_string(u: Unit) -> Unit
{
let phrase = String::from("The humanity develop the linux kernel.");
return u.empty("").not_empty(" ").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
```