} #[test] fn is_common() { #[track_caller] fn case(n: u64) { assert_eq!(Sat(n).is_common(), Sat(n).rarity() == Rarity::Common); } case(0); case(1); case(50 * COIN_VALUE - 1); case(50 * COIN_VALUE); case(50 * COIN_VALUE + 1); case(2067187500000000 - 1); case(2067187500000000); case(2067187500000000 + 1); } #[test] fn nineball() { for height in 0..10 { let sat = Sat(height * 50 * COIN_VALUE); assert_eq!( sat.nineball(), sat.height() == 9, "nineball: {} height: {}", sat.nineball(), sat.height() ); } } }