dsalgo 0.3.7

A package for Datastructures and Algorithms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[cfg(test)]
mod tests {
    #[test]
    fn test_next_power_of_two() {
        assert_eq!(0usize.next_power_of_two(), 1);
        assert_eq!(1usize.next_power_of_two(), 1);
        assert_eq!(2usize.next_power_of_two(), 2);
        assert_eq!(3usize.next_power_of_two(), 4);
    }

    #[test]
    fn negative_division() {
        assert_eq!(-5 % 2, -1);
        assert_eq!(-5 % -2, -1);
        assert_eq!(5 % -2, 1);
    }
}