ndhistogram 0.12.0

multi-dimensional histogramming for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::num::Wrapping;

use ndhistogram::{axis::Uniform, ndhistogram, Error, Histogram};

#[test]
fn test_wrapping_fill_wraps_on_overflow() -> Result<(), Error> {
    let mut hist = ndhistogram!(Uniform::new(1, 0.0, 1.0)?; Wrapping<u32>);
    hist.fill_with(&0.0, Wrapping(u32::MAX));
    hist.fill(&0.0);
    let actual = *hist.value(&0.0).unwrap();
    let expected = Wrapping(0);
    assert_eq!(expected, actual);
    Ok(())
}