assert!(parse("0°2016′0″0‴").is_ok()); assert!(parse("0°2016′1″0‴").is_err()); assert!(parse("0°0′336″0‴").is_ok()); } #[test] fn from_str_degree_post_distribution() { assert!(parse("5°209999′1007″0‴").is_ok()); assert!(parse("5°0′1008″0‴").is_err()); } #[test] fn from_str_name() { assert_eq!(parse("nvtdijuwxlp").unwrap(), 0); assert_eq!(parse("a").unwrap(), 2099999997689999); assert!(parse("(").is_err()); assert!(parse("").is_err()); assert!(parse("nvtdijuwxlq").is_err()); assert!(parse("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").is_err()); } #[test] fn cycle() { assert_eq!( SUBSIDY_HALVING_INTERVAL * CYCLE_EPOCHS % DIFFCHANGE_INTERVAL, 0 ); for i in 1..CYCLE_EPOCHS { assert_ne!(i * SUBSIDY_HALVING_INTERVAL % DIFFCHANGE_INTERVAL, 0); } assert_eq!( CYCLE_EPOCHS * SUBSIDY_HALVING_INTERVAL % DIFFCHANGE_INTERVAL, 0 ); assert_eq!(Sat(0).cycle(), 0); assert_eq!(Sat(2067187500000000 - 1).cycle(), 0);