# 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
```
## Configuration file
```toml
# Cargo.toml
[package]
name = "<package_name_here>"
version = "0.1.0"
edition = "2021"
description = "<package_description_here>"
license = "GPL-2.0-or-later"
repository = "<repository_url>"
documentation= "https://docs.rs/<package_name>"
[lib]
name = "<your_lib_name>"
path = "src/lib.rs"
crate-type = ["lib"]
test = true # Is tested by default.
doctest = true # Documentation examples are tested by default.
bench = true # Is benchmarked by default.
doc = true # Is documented by default.
harness = true # Use libtest harness.
[[bin]]
name = "unit-testing"
path = "src/bin.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
colored_truecolor = "0.1.0"
mockall = "0.11.3"
progress_bar = "1.0.3"
unit-testing = "0.3.2"
```
# Usage
```rust
use unit::zuu::Unit;
fn kool() -> bool
{
return false;
}
fn look() -> bool
{
return true;
}
fn s() -> i32
{
return 0;
}
fn f() -> i32
{
return 1;
}
fn get_fans() -> i32
{
return 5;
}
fn main() {
assert!(Unit::new("Test the unit framework")
.failure(&f).success(&s).expect(kool(), false).expect(look(), true).expect(f(), 1).expect(s(), 0)
.equals(&s, 0)
.equals(&f, 1)
.success(&s).failure(&f)
.contains("I love linux", "linux")
.finnish("I love linux", "linux")
.begin("Linux it's the best", "Linux")
.contains("Linux is superb", "Linux")
.different("linux", "windows")
.chaos("windows love linux", &kool)
.theory("windows love linux", &look, true)
.between(&get_fans, 1, 10)
.inferior(&get_fans, 10)
.superior(&get_fans, 1)
.exist("/home")
.empty("")
.not_empty(" ")
.has("window love linux", "linux")
.defined("linux")
.not("linux", "windows")
.end()
.is_ok());
}
```
```shell
./target/debug/unit-testing
```
