malachite-base 0.4.6

A collection of utilities, including new arithmetic traits and iterators that generate all values of a type
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use itertools::Itertools;
use malachite_base::iterators::nonzero_values;

#[test]
pub fn test_nonzero_values() {
    let test = |xs: &[u32], out: &[u32]| {
        assert_eq!(nonzero_values(xs.iter().cloned()).collect_vec(), out);
    };
    test(&[], &[]);
    test(&[1, 2, 3], &[1, 2, 3]);
    test(&[1, 0, 3], &[1, 3]);
    test(&[1, 2, 0, 0, 0], &[1, 2]);
    test(&[0, 0, 0], &[]);
}