1 #![allow(non_snake_case)] 2 #![allow(clippy::cast_lossless)] 3 4 macro_rules! test { 5 ($($name:ident($value:expr, $expected:expr))*) => { 6 $( 7 #[test] 8 fn $name() { 9 let mut buffer = itoa::Buffer::new(); 10 let s = buffer.format($value); 11 assert_eq!(s, $expected); 12 } 13 )* 14 } 15 } 16 17 test! { 18 test_u64_0(0u64, "0") 19 test_u64_half(u32::max_value() as u64, "4294967295") 20 test_u64_max(u64::max_value(), "18446744073709551615") 21 test_i64_min(i64::min_value(), "-9223372036854775808") 22 23 test_i16_0(0i16, "0") 24 test_i16_min(i16::min_value(), "-32768") 25 26 test_u128_0(0u128, "0") 27 test_u128_max(u128::max_value(), "340282366920938463463374607431768211455") 28 test_i128_min(i128::min_value(), "-170141183460469231731687303715884105728") 29 test_i128_max(i128::max_value(), "170141183460469231731687303715884105727") 30 } 31