Russell Chk - Functions to check vectors and other data in tests

This crate is part of Russell - Rust Scientific Library

This repository implements macros to assist in tests (numerical checks).

Documentation:

Installation

Crates.io

👆 Check the crate version and update your Cargo.toml accordingly:

toml [dependencies] russell_chk = "*"

Examples

Check float point numbers

```rust use russellchk::approxeq;

fn main() { approxeq(0.123456789, 0.12345678, 1e-8); approxeq(0.123456789, 0.1234567, 1e-7); approxeq(0.123456789, 0.123456, 1e-6); approxeq(0.123456789, 0.12345, 1e-5); approx_eq(0.123456789, 0.1234, 1e-4); } ```

Check a vector of float point numbers

```rust use russellchk::vecapprox_eq;

fn main() { let a = [0.123456789, 0.123456789, 0.123456789]; let b = [0.12345678, 0.1234567, 0.123456]; vecapproxeq(&a, &b, 1e-6); } ```

Check derivatives

```rust use russellchk::derivapprox_eq;

struct Arguments {}

fn main() { let f = |x: f64, : &mut Arguments| -x; let args = &mut Arguments {}; let atx = 8.0; let dfdx = -1.01; derivapproxeq(dfdx, at_x, args, 1e-2, f); } ```

Check complex numbers

```rust use russellchk::complexvecapproxeq; use num_complex::Complex64;

fn main() { let a = &[ Complex64::new(0.123456789, 5.01), Complex64::new(0.123456789, 5.01), Complex64::new(0.123456789, 5.01)]; let b = &[ Complex64::new(0.12345678, 5.01), Complex64::new(0.1234567, 5.01), Complex64::new(0.123456, 5.01)]; complexvecapprox_eq(a, b, 1e-6); } ```