This crate is part of Russell - Rust Scientific Library
This repository implements macros to assist in tests (numerical checks).
Documentation:
Add this to your Cargo.toml:
toml
[dependencies]
russell_chk = "*"
```rust use russell_chk::*;
fn main() { assertapproxeq!(0.123456789, 0.12345678, 1e-8); assertapproxeq!(0.123456789, 0.1234567, 1e-7); assertapproxeq!(0.123456789, 0.123456, 1e-6); assertapproxeq!(0.123456789, 0.12345, 1e-5); assertapproxeq!(0.123456789, 0.1234, 1e-4); } ```
```rust use russell_chk::*;
fn main() { let a = [0.123456789, 0.123456789, 0.123456789]; let b = [0.12345678, 0.1234567, 0.123456]; assertvecapprox_eq!(&a, &b, 1e-6); } ```
```rust use russell_chk::*;
fn main() { let f = |x: f64| -x; let atx = 8.0; let dfdxatx = -1.01; assertderivapproxeq!(dfdxatx, f, at_x, 1e-2); } ```