Add a fuzz check for `Uint128::increment`

This commit is contained in:
Matt Corallo 2021-06-08 22:21:54 +00:00
parent a15f263c4e
commit 9c256cc88e
1 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,10 @@ fn do_test(data: &[u8]) {
assert_eq!(128 - a_native.leading_zeros() as usize, a.bits()); assert_eq!(128 - a_native.leading_zeros() as usize, a.bits());
assert_eq!(a_native as u64, bitcoin::util::uint::Uint128::from_u64(a_native as u64).unwrap().low_u64()); assert_eq!(a_native as u64, bitcoin::util::uint::Uint128::from_u64(a_native as u64).unwrap().low_u64());
let mut a_inc = a.clone();
a_inc.increment();
check_eq!(a_native.wrapping_add(1), a_inc);
// Checks with two numbers: // Checks with two numbers:
let (b_native, b) = read_ints!(16); let (b_native, b) = read_ints!(16);