From aa616c470091175500d8de048f87d980972b25df Mon Sep 17 00:00:00 2001 From: Franco Barpp Gomes Date: Sun, 14 Jan 2024 16:43:30 -0300 Subject: [PATCH] Replace eq asserts with assert_eq! macros --- src/math/src/tests/math_test.cairo | 372 ++++++++++++----------------- 1 file changed, 157 insertions(+), 215 deletions(-) diff --git a/src/math/src/tests/math_test.cairo b/src/math/src/tests/math_test.cairo index ea866a9c..1860cc8f 100644 --- a/src/math/src/tests/math_test.cairo +++ b/src/math/src/tests/math_test.cairo @@ -227,238 +227,180 @@ fn test_rotr_max() { #[test] fn test_wrapping_math_non_wrapping() { - assert(10_u8.wrapping_add(10_u8) == 20_u8, 'invalid result'); - assert(0_u8.wrapping_add(10_u8) == 10_u8, 'invalid result'); - assert(10_u8.wrapping_add(0_u8) == 10_u8, 'invalid result'); - assert(0_u8.wrapping_add(0_u8) == 0_u8, 'invalid result'); - assert(20_u8.wrapping_sub(10_u8) == 10_u8, 'invalid result'); - assert(10_u8.wrapping_sub(0_u8) == 10_u8, 'invalid result'); - assert(0_u8.wrapping_sub(0_u8) == 0_u8, 'invalid result'); - assert(10_u8.wrapping_mul(10_u8) == 100_u8, 'invalid result'); - assert(10_u8.wrapping_mul(0_u8) == 0_u8, 'invalid result'); - assert(0_u8.wrapping_mul(10_u8) == 0_u8, 'invalid result'); - assert(0_u8.wrapping_mul(0_u8) == 0_u8, 'invalid result'); + assert_eq!(10_u8.wrapping_add(10_u8), 20_u8); + assert_eq!(0_u8.wrapping_add(10_u8), 10_u8); + assert_eq!(10_u8.wrapping_add(0_u8), 10_u8); + assert_eq!(0_u8.wrapping_add(0_u8), 0_u8); + assert_eq!(20_u8.wrapping_sub(10_u8), 10_u8); + assert_eq!(10_u8.wrapping_sub(0_u8), 10_u8); + assert_eq!(0_u8.wrapping_sub(0_u8), 0_u8); + assert_eq!(10_u8.wrapping_mul(10_u8), 100_u8); + assert_eq!(10_u8.wrapping_mul(0_u8), 0_u8); + assert_eq!(0_u8.wrapping_mul(10_u8), 0_u8); + assert_eq!(0_u8.wrapping_mul(0_u8), 0_u8); - assert(10_u16.wrapping_add(10_u16) == 20_u16, 'invalid result'); - assert(0_u16.wrapping_add(10_u16) == 10_u16, 'invalid result'); - assert(10_u16.wrapping_add(0_u16) == 10_u16, 'invalid result'); - assert(0_u16.wrapping_add(0_u16) == 0_u16, 'invalid result'); - assert(20_u16.wrapping_sub(10_u16) == 10_u16, 'invalid result'); - assert(10_u16.wrapping_sub(0_u16) == 10_u16, 'invalid result'); - assert(0_u16.wrapping_sub(0_u16) == 0_u16, 'invalid result'); - assert(10_u16.wrapping_mul(10_u16) == 100_u16, 'invalid result'); - assert(10_u16.wrapping_mul(0_u16) == 0_u16, 'invalid result'); - assert(0_u16.wrapping_mul(10_u16) == 0_u16, 'invalid result'); - assert(0_u16.wrapping_mul(0_u16) == 0_u16, 'invalid result'); + assert_eq!(10_u16.wrapping_add(10_u16), 20_u16); + assert_eq!(0_u16.wrapping_add(10_u16), 10_u16); + assert_eq!(10_u16.wrapping_add(0_u16), 10_u16); + assert_eq!(0_u16.wrapping_add(0_u16), 0_u16); + assert_eq!(20_u16.wrapping_sub(10_u16), 10_u16); + assert_eq!(10_u16.wrapping_sub(0_u16), 10_u16); + assert_eq!(0_u16.wrapping_sub(0_u16), 0_u16); + assert_eq!(10_u16.wrapping_mul(10_u16), 100_u16); + assert_eq!(10_u16.wrapping_mul(0_u16), 0_u16); + assert_eq!(0_u16.wrapping_mul(10_u16), 0_u16); + assert_eq!(0_u16.wrapping_mul(0_u16), 0_u16); - assert(10_u32.wrapping_add(10_u32) == 20_u32, 'invalid result'); - assert(0_u32.wrapping_add(10_u32) == 10_u32, 'invalid result'); - assert(10_u32.wrapping_add(0_u32) == 10_u32, 'invalid result'); - assert(0_u32.wrapping_add(0_u32) == 0_u32, 'invalid result'); - assert(20_u32.wrapping_sub(10_u32) == 10_u32, 'invalid result'); - assert(10_u32.wrapping_sub(0_u32) == 10_u32, 'invalid result'); - assert(0_u32.wrapping_sub(0_u32) == 0_u32, 'invalid result'); - assert(10_u32.wrapping_mul(10_u32) == 100_u32, 'invalid result'); - assert(10_u32.wrapping_mul(0_u32) == 0_u32, 'invalid result'); - assert(0_u32.wrapping_mul(10_u32) == 0_u32, 'invalid result'); - assert(0_u32.wrapping_mul(0_u32) == 0_u32, 'invalid result'); + assert_eq!(10_u32.wrapping_add(10_u32), 20_u32); + assert_eq!(0_u32.wrapping_add(10_u32), 10_u32); + assert_eq!(10_u32.wrapping_add(0_u32), 10_u32); + assert_eq!(0_u32.wrapping_add(0_u32), 0_u32); + assert_eq!(20_u32.wrapping_sub(10_u32), 10_u32); + assert_eq!(10_u32.wrapping_sub(0_u32), 10_u32); + assert_eq!(0_u32.wrapping_sub(0_u32), 0_u32); + assert_eq!(10_u32.wrapping_mul(10_u32), 100_u32); + assert_eq!(10_u32.wrapping_mul(0_u32), 0_u32); + assert_eq!(0_u32.wrapping_mul(10_u32), 0_u32); + assert_eq!(0_u32.wrapping_mul(0_u32), 0_u32); - assert(10_u64.wrapping_add(10_u64) == 20_u64, 'invalid result'); - assert(0_u64.wrapping_add(10_u64) == 10_u64, 'invalid result'); - assert(10_u64.wrapping_add(0_u64) == 10_u64, 'invalid result'); - assert(0_u64.wrapping_add(0_u64) == 0_u64, 'invalid result'); - assert(20_u64.wrapping_sub(10_u64) == 10_u64, 'invalid result'); - assert(10_u64.wrapping_sub(0_u64) == 10_u64, 'invalid result'); - assert(0_u64.wrapping_sub(0_u64) == 0_u64, 'invalid result'); - assert(10_u64.wrapping_mul(10_u64) == 100_u64, 'invalid result'); - assert(10_u64.wrapping_mul(0_u64) == 0_u64, 'invalid result'); - assert(0_u64.wrapping_mul(10_u64) == 0_u64, 'invalid result'); - assert(0_u64.wrapping_mul(0_u64) == 0_u64, 'invalid result'); + assert_eq!(10_u64.wrapping_add(10_u64), 20_u64); + assert_eq!(0_u64.wrapping_add(10_u64), 10_u64); + assert_eq!(10_u64.wrapping_add(0_u64), 10_u64); + assert_eq!(0_u64.wrapping_add(0_u64), 0_u64); + assert_eq!(20_u64.wrapping_sub(10_u64), 10_u64); + assert_eq!(10_u64.wrapping_sub(0_u64), 10_u64); + assert_eq!(0_u64.wrapping_sub(0_u64), 0_u64); + assert_eq!(10_u64.wrapping_mul(10_u64), 100_u64); + assert_eq!(10_u64.wrapping_mul(0_u64), 0_u64); + assert_eq!(0_u64.wrapping_mul(10_u64), 0_u64); + assert_eq!(0_u64.wrapping_mul(0_u64), 0_u64); - assert(10_u128.wrapping_add(10_u128) == 20_u128, 'invalid result'); - assert(0_u128.wrapping_add(10_u128) == 10_u128, 'invalid result'); - assert(10_u128.wrapping_add(0_u128) == 10_u128, 'invalid result'); - assert(0_u128.wrapping_add(0_u128) == 0_u128, 'invalid result'); - assert(20_u128.wrapping_sub(10_u128) == 10_u128, 'invalid result'); - assert(10_u128.wrapping_sub(0_u128) == 10_u128, 'invalid result'); - assert(0_u128.wrapping_sub(0_u128) == 0_u128, 'invalid result'); - assert(10_u128.wrapping_mul(10_u128) == 100_u128, 'invalid result'); - assert(10_u128.wrapping_mul(0_u128) == 0_u128, 'invalid result'); - assert(0_u128.wrapping_mul(10_u128) == 0_u128, 'invalid result'); - assert(0_u128.wrapping_mul(0_u128) == 0_u128, 'invalid result'); + assert_eq!(10_u128.wrapping_add(10_u128), 20_u128); + assert_eq!(0_u128.wrapping_add(10_u128), 10_u128); + assert_eq!(10_u128.wrapping_add(0_u128), 10_u128); + assert_eq!(0_u128.wrapping_add(0_u128), 0_u128); + assert_eq!(20_u128.wrapping_sub(10_u128), 10_u128); + assert_eq!(10_u128.wrapping_sub(0_u128), 10_u128); + assert_eq!(0_u128.wrapping_sub(0_u128), 0_u128); + assert_eq!(10_u128.wrapping_mul(10_u128), 100_u128); + assert_eq!(10_u128.wrapping_mul(0_u128), 0_u128); + assert_eq!(0_u128.wrapping_mul(10_u128), 0_u128); + assert_eq!(0_u128.wrapping_mul(0_u128), 0_u128); - assert(10_u256.wrapping_add(10_u256) == 20_u256, 'invalid result'); - assert(0_u256.wrapping_add(10_u256) == 10_u256, 'invalid result'); - assert(10_u256.wrapping_add(0_u256) == 10_u256, 'invalid result'); - assert(0_u256.wrapping_add(0_u256) == 0_u256, 'invalid result'); - assert(20_u256.wrapping_sub(10_u256) == 10_u256, 'invalid result'); - assert(10_u256.wrapping_sub(0_u256) == 10_u256, 'invalid result'); - assert(0_u256.wrapping_sub(0_u256) == 0_u256, 'invalid result'); - assert(10_u256.wrapping_mul(10_u256) == 100_u256, 'invalid result'); - assert(10_u256.wrapping_mul(0_u256) == 0_u256, 'invalid result'); - assert(0_u256.wrapping_mul(10_u256) == 0_u256, 'invalid result'); - assert(0_u256.wrapping_mul(0_u256) == 0_u256, 'invalid result'); + assert_eq!(10_u256.wrapping_add(10_u256), 20_u256); + assert_eq!(0_u256.wrapping_add(10_u256), 10_u256); + assert_eq!(10_u256.wrapping_add(0_u256), 10_u256); + assert_eq!(0_u256.wrapping_add(0_u256), 0_u256); + assert_eq!(20_u256.wrapping_sub(10_u256), 10_u256); + assert_eq!(10_u256.wrapping_sub(0_u256), 10_u256); + assert_eq!(0_u256.wrapping_sub(0_u256), 0_u256); + assert_eq!(10_u256.wrapping_mul(10_u256), 100_u256); + assert_eq!(10_u256.wrapping_mul(0_u256), 0_u256); + assert_eq!(0_u256.wrapping_mul(10_u256), 0_u256); + assert_eq!(0_u256.wrapping_mul(0_u256), 0_u256); } #[test] fn test_wrapping_math_wrapping() { - assert(BoundedInt::::max().wrapping_add(1_u8) == 0_u8, 'invalid result'); - assert(1_u8.wrapping_add(BoundedInt::::max()) == 0_u8, 'invalid result'); - assert(BoundedInt::::max().wrapping_add(2_u8) == 1_u8, 'invalid result'); - assert(2_u8.wrapping_add(BoundedInt::::max()) == 1_u8, 'invalid result'); - assert( - BoundedInt::::max().wrapping_add(BoundedInt::::max()) == BoundedInt::::max() - - 1_u8, - 'invalid result' - ); - assert(BoundedInt::::min().wrapping_sub(1_u8) == BoundedInt::::max(), 'invalid result'); - assert( - BoundedInt::::min().wrapping_sub(2_u8) == BoundedInt::::max() - 1_u8, - 'invalid result' - ); - assert(1_u8.wrapping_sub(BoundedInt::::max()) == 2_u8, 'invalid result'); - assert(0_u8.wrapping_sub(BoundedInt::::max()) == 1_u8, 'invalid result'); - assert(BoundedInt::::max().wrapping_mul(BoundedInt::::max()) == 1_u8, 'invalid result'); - assert( - (BoundedInt::::max() - 1_u8).wrapping_mul(2_u8) == BoundedInt::::max() - 3_u8, - 'invalid result' - ); + assert_eq!(BoundedInt::::max().wrapping_add(1_u8), 0_u8); + assert_eq!(1_u8.wrapping_add(BoundedInt::::max()), 0_u8); + assert_eq!(BoundedInt::::max().wrapping_add(2_u8), 1_u8); + assert_eq!(2_u8.wrapping_add(BoundedInt::::max()), 1_u8); + assert_eq!( + BoundedInt::::max().wrapping_add(BoundedInt::::max()), + BoundedInt::::max() - 1_u8 + ); + assert_eq!(BoundedInt::::min().wrapping_sub(1_u8), BoundedInt::::max()); + assert_eq!(BoundedInt::::min().wrapping_sub(2_u8), BoundedInt::::max() - 1_u8); + assert_eq!(1_u8.wrapping_sub(BoundedInt::::max()), 2_u8); + assert_eq!(0_u8.wrapping_sub(BoundedInt::::max()), 1_u8); + assert_eq!(BoundedInt::::max().wrapping_mul(BoundedInt::::max()), 1_u8); + assert_eq!((BoundedInt::::max() - 1_u8).wrapping_mul(2_u8), BoundedInt::::max() - 3_u8); - assert(BoundedInt::::max().wrapping_add(1_u16) == 0_u16, 'invalid result'); - assert(1_u16.wrapping_add(BoundedInt::::max()) == 0_u16, 'invalid result'); - assert(BoundedInt::::max().wrapping_add(2_u16) == 1_u16, 'invalid result'); - assert(2_u16.wrapping_add(BoundedInt::::max()) == 1_u16, 'invalid result'); - assert( - BoundedInt::::max().wrapping_add(BoundedInt::::max()) == BoundedInt::::max() - - 1_u16, - 'invalid result' - ); - assert( - BoundedInt::::min().wrapping_sub(1_u16) == BoundedInt::::max(), 'invalid result' - ); - assert( - BoundedInt::::min().wrapping_sub(2_u16) == BoundedInt::::max() - 1_u16, - 'invalid result' - ); - assert(1_u16.wrapping_sub(BoundedInt::::max()) == 2_u16, 'invalid result'); - assert(0_u16.wrapping_sub(BoundedInt::::max()) == 1_u16, 'invalid result'); - assert( - BoundedInt::::max().wrapping_mul(BoundedInt::::max()) == 1_u16, 'invalid result' - ); - assert( - (BoundedInt::::max() - 1_u16).wrapping_mul(2_u16) == BoundedInt::::max() - 3_u16, - 'invalid result' + assert_eq!(BoundedInt::::max().wrapping_add(1_u16), 0_u16); + assert_eq!(1_u16.wrapping_add(BoundedInt::::max()), 0_u16); + assert_eq!(BoundedInt::::max().wrapping_add(2_u16), 1_u16); + assert_eq!(2_u16.wrapping_add(BoundedInt::::max()), 1_u16); + assert_eq!( + BoundedInt::::max().wrapping_add(BoundedInt::::max()), + BoundedInt::::max() - 1_u16 + ); + assert_eq!(BoundedInt::::min().wrapping_sub(1_u16), BoundedInt::::max()); + assert_eq!(BoundedInt::::min().wrapping_sub(2_u16), BoundedInt::::max() - 1_u16); + assert_eq!(1_u16.wrapping_sub(BoundedInt::::max()), 2_u16); + assert_eq!(0_u16.wrapping_sub(BoundedInt::::max()), 1_u16); + assert_eq!(BoundedInt::::max().wrapping_mul(BoundedInt::::max()), 1_u16); + assert_eq!( + (BoundedInt::::max() - 1_u16).wrapping_mul(2_u16), BoundedInt::::max() - 3_u16 ); - assert(BoundedInt::::max().wrapping_add(1_u32) == 0_u32, 'invalid result'); - assert(1_u32.wrapping_add(BoundedInt::::max()) == 0_u32, 'invalid result'); - assert(BoundedInt::::max().wrapping_add(2_u32) == 1_u32, 'invalid result'); - assert(2_u32.wrapping_add(BoundedInt::::max()) == 1_u32, 'invalid result'); - assert( - BoundedInt::::max().wrapping_add(BoundedInt::::max()) == BoundedInt::::max() - - 1_u32, - 'invalid result' - ); - assert( - BoundedInt::::min().wrapping_sub(1_u32) == BoundedInt::::max(), 'invalid result' - ); - assert( - BoundedInt::::min().wrapping_sub(2_u32) == BoundedInt::::max() - 1_u32, - 'invalid result' - ); - assert(1_u32.wrapping_sub(BoundedInt::::max()) == 2_u32, 'invalid result'); - assert(0_u32.wrapping_sub(BoundedInt::::max()) == 1_u32, 'invalid result'); - assert( - BoundedInt::::max().wrapping_mul(BoundedInt::::max()) == 1_u32, 'invalid result' - ); - assert( - (BoundedInt::::max() - 1_u32).wrapping_mul(2_u32) == BoundedInt::::max() - 3_u32, - 'invalid result' + assert_eq!(BoundedInt::::max().wrapping_add(1_u32), 0_u32); + assert_eq!(1_u32.wrapping_add(BoundedInt::::max()), 0_u32); + assert_eq!(BoundedInt::::max().wrapping_add(2_u32), 1_u32); + assert_eq!(2_u32.wrapping_add(BoundedInt::::max()), 1_u32); + assert_eq!( + BoundedInt::::max().wrapping_add(BoundedInt::::max()), + BoundedInt::::max() - 1_u32 + ); + assert_eq!(BoundedInt::::min().wrapping_sub(1_u32), BoundedInt::::max()); + assert_eq!(BoundedInt::::min().wrapping_sub(2_u32), BoundedInt::::max() - 1_u32); + assert_eq!(1_u32.wrapping_sub(BoundedInt::::max()), 2_u32); + assert_eq!(0_u32.wrapping_sub(BoundedInt::::max()), 1_u32); + assert_eq!(BoundedInt::::max().wrapping_mul(BoundedInt::::max()), 1_u32); + assert_eq!( + (BoundedInt::::max() - 1_u32).wrapping_mul(2_u32), BoundedInt::::max() - 3_u32 ); - assert(BoundedInt::::max().wrapping_add(1_u64) == 0_u64, 'invalid result'); - assert(1_u64.wrapping_add(BoundedInt::::max()) == 0_u64, 'invalid result'); - assert(BoundedInt::::max().wrapping_add(2_u64) == 1_u64, 'invalid result'); - assert(2_u64.wrapping_add(BoundedInt::::max()) == 1_u64, 'invalid result'); - assert( - BoundedInt::::max().wrapping_add(BoundedInt::::max()) == BoundedInt::::max() - - 1_u64, - 'invalid result' - ); - assert( - BoundedInt::::min().wrapping_sub(1_u64) == BoundedInt::::max(), 'invalid result' - ); - assert( - BoundedInt::::min().wrapping_sub(2_u64) == BoundedInt::::max() - 1_u64, - 'invalid result' - ); - assert(1_u64.wrapping_sub(BoundedInt::::max()) == 2_u64, 'invalid result'); - assert(0_u64.wrapping_sub(BoundedInt::::max()) == 1_u64, 'invalid result'); - assert( - BoundedInt::::max().wrapping_mul(BoundedInt::::max()) == 1_u64, 'invalid result' - ); - assert( - (BoundedInt::::max() - 1_u64).wrapping_mul(2_u64) == BoundedInt::::max() - 3_u64, - 'invalid result' + assert_eq!(BoundedInt::::max().wrapping_add(1_u64), 0_u64); + assert_eq!(1_u64.wrapping_add(BoundedInt::::max()), 0_u64); + assert_eq!(BoundedInt::::max().wrapping_add(2_u64), 1_u64); + assert_eq!(2_u64.wrapping_add(BoundedInt::::max()), 1_u64); + assert_eq!( + BoundedInt::::max().wrapping_add(BoundedInt::::max()), + BoundedInt::::max() - 1_u64 + ); + assert_eq!(BoundedInt::::min().wrapping_sub(1_u64), BoundedInt::::max()); + assert_eq!(BoundedInt::::min().wrapping_sub(2_u64), BoundedInt::::max() - 1_u64); + assert_eq!(1_u64.wrapping_sub(BoundedInt::::max()), 2_u64); + assert_eq!(0_u64.wrapping_sub(BoundedInt::::max()), 1_u64); + assert_eq!(BoundedInt::::max().wrapping_mul(BoundedInt::::max()), 1_u64); + assert_eq!( + (BoundedInt::::max() - 1_u64).wrapping_mul(2_u64), BoundedInt::::max() - 3_u64 ); - assert(BoundedInt::::max().wrapping_add(1_u128) == 0_u128, 'invalid result'); - assert(1_u128.wrapping_add(BoundedInt::::max()) == 0_u128, 'invalid result'); - assert(BoundedInt::::max().wrapping_add(2_u128) == 1_u128, 'invalid result'); - assert(2_u128.wrapping_add(BoundedInt::::max()) == 1_u128, 'invalid result'); - assert( - BoundedInt::::max() - .wrapping_add(BoundedInt::::max()) == BoundedInt::::max() - - 1_u128, - 'invalid result' - ); - assert( - BoundedInt::::min().wrapping_sub(1_u128) == BoundedInt::::max(), - 'invalid result' - ); - assert( - BoundedInt::::min().wrapping_sub(2_u128) == BoundedInt::::max() - 1_u128, - 'invalid result' - ); - assert(1_u128.wrapping_sub(BoundedInt::::max()) == 2_u128, 'invalid result'); - assert(0_u128.wrapping_sub(BoundedInt::::max()) == 1_u128, 'invalid result'); - assert( - BoundedInt::::max().wrapping_mul(BoundedInt::::max()) == 1_u128, - 'invalid result' - ); - assert( - (BoundedInt::::max() - 1_u128).wrapping_mul(2_u128) == BoundedInt::::max() - - 3_u128, - 'invalid result' + assert_eq!(BoundedInt::::max().wrapping_add(1_u128), 0_u128); + assert_eq!(1_u128.wrapping_add(BoundedInt::::max()), 0_u128); + assert_eq!(BoundedInt::::max().wrapping_add(2_u128), 1_u128); + assert_eq!(2_u128.wrapping_add(BoundedInt::::max()), 1_u128); + assert_eq!( + BoundedInt::::max().wrapping_add(BoundedInt::::max()), + BoundedInt::::max() - 1_u128 + ); + assert_eq!(BoundedInt::::min().wrapping_sub(1_u128), BoundedInt::::max()); + assert_eq!(BoundedInt::::min().wrapping_sub(2_u128), BoundedInt::::max() - 1_u128); + assert_eq!(1_u128.wrapping_sub(BoundedInt::::max()), 2_u128); + assert_eq!(0_u128.wrapping_sub(BoundedInt::::max()), 1_u128); + assert_eq!(BoundedInt::::max().wrapping_mul(BoundedInt::::max()), 1_u128); + assert_eq!( + (BoundedInt::::max() - 1_u128).wrapping_mul(2_u128), + BoundedInt::::max() - 3_u128 ); - assert(BoundedInt::::max().wrapping_add(1_u256) == 0_u256, 'invalid result'); - assert(1_u256.wrapping_add(BoundedInt::::max()) == 0_u256, 'invalid result'); - assert(BoundedInt::::max().wrapping_add(2_u256) == 1_u256, 'invalid result'); - assert(2_u256.wrapping_add(BoundedInt::::max()) == 1_u256, 'invalid result'); - assert( - BoundedInt::::max() - .wrapping_add(BoundedInt::::max()) == BoundedInt::::max() - - 1_u256, - 'invalid result' - ); - assert( - BoundedInt::::min().wrapping_sub(1_u256) == BoundedInt::::max(), - 'invalid result' - ); - assert( - BoundedInt::::min().wrapping_sub(2_u256) == BoundedInt::::max() - 1_u256, - 'invalid result' - ); - assert(1_u256.wrapping_sub(BoundedInt::::max()) == 2_u256, 'invalid result'); - assert(0_u256.wrapping_sub(BoundedInt::::max()) == 1_u256, 'invalid result'); - assert( - BoundedInt::::max().wrapping_mul(BoundedInt::::max()) == 1_u256, - 'invalid result' - ); - assert( - (BoundedInt::::max() - 1_u256).wrapping_mul(2_u256) == BoundedInt::::max() - - 3_u256, - 'invalid result' + assert_eq!(BoundedInt::::max().wrapping_add(1_u256), 0_u256); + assert_eq!(1_u256.wrapping_add(BoundedInt::::max()), 0_u256); + assert_eq!(BoundedInt::::max().wrapping_add(2_u256), 1_u256); + assert_eq!(2_u256.wrapping_add(BoundedInt::::max()), 1_u256); + assert_eq!( + BoundedInt::::max().wrapping_add(BoundedInt::::max()), + BoundedInt::::max() - 1_u256 + ); + assert_eq!(BoundedInt::::min().wrapping_sub(1_u256), BoundedInt::::max()); + assert_eq!(BoundedInt::::min().wrapping_sub(2_u256), BoundedInt::::max() - 1_u256); + assert_eq!(1_u256.wrapping_sub(BoundedInt::::max()), 2_u256); + assert_eq!(0_u256.wrapping_sub(BoundedInt::::max()), 1_u256); + assert_eq!(BoundedInt::::max().wrapping_mul(BoundedInt::::max()), 1_u256); + assert_eq!( + (BoundedInt::::max() - 1_u256).wrapping_mul(2_u256), + BoundedInt::::max() - 3_u256 ); }