Skip to content

Commit

Permalink
add a test for the extension array adder.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lokathor committed Sep 1, 2023
1 parent 234854b commit 7162af0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pcg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,17 @@ impl<const K: usize> PCG32K<K> {
}
}
}

#[test]
fn test_ext_add() {
let mut x = PCG32K::<2> { state: 0, ext: [u32::MAX, 0] };
x.ext_add(1);
assert_eq!(x.ext[0], 0);
assert_eq!(x.ext[1], 1);
//
let mut x = PCG32K::<3> { state: 0, ext: [u32::MAX, u32::MAX, 0] };
x.ext_add(1);
assert_eq!(x.ext[0], 0);
assert_eq!(x.ext[1], 0);
assert_eq!(x.ext[2], 1);
}

0 comments on commit 7162af0

Please sign in to comment.