#[test] fn n() { assert_eq!(Height(0).n(), 0); assert_eq!(Height(1).n(), 1); } #[test] fn add() { assert_eq!(Height(0) + 1, 1); assert_eq!(Height(1) + 100, 101); } #[test] fn sub() { assert_eq!(Height(1) - 1, 0); assert_eq!(Height(100) - 50, 50); } #[test] fn eq() { assert_eq!(Height(0), 0); assert_eq!(Height(100), 100); } #[test] fn from_str() { assert_eq!("0".parse::().unwrap(), 0); assert!("foo".parse::().is_err()); } #[test] fn subsidy() { assert_eq!(Height(0).subsidy(), 5000000000); assert_eq!(Height(1).subsidy(), 5000000000); assert_eq!(Height(SUBSIDY_HALVING_INTERVAL - 1).subsidy(), 5000000000); assert_eq!(Height(SUBSIDY_HALVING_INTERVAL).subsidy(), 2500000000); assert_eq!(Height(SUBSIDY_HALVING_INTERVAL + 1).subsidy(), 2500000000); } #[test] fn starting_sat() { assert_eq!(Height(0).starting_sat(), 0); assert_eq!(Height(1).starting_sat(), 5000000000); assert_eq!( Height(SUBSIDY_HALVING_INTERVAL - 1).starting_sat(),