extern crate nmbr_signed; use nmbr_signed::{Sign,Signed}; #[test] fn test_signed_integer_values() { let t1: isize = -15; let t2: i8 = 100; let t3: i16 = -350; let t4: i32 = -1000; let t5: i64 = -2551; let tz: i64 = 0; assert_eq!(t1.sign(), Sign::Negative); assert_eq!(t1.is_positive(), false ); assert_eq!(t1.is_negative(), true ); assert_eq!(t1.abs(), 15isize); assert_eq!(t2.sign(), Sign::Positive); assert_eq!(t2.is_positive(), true ); assert_eq!(t2.is_negative(), false ); assert_eq!(t2.abs(), 100i8); assert_eq!(t3.sign(), Sign::Negative); assert_eq!(t3.is_positive(), false ); assert_eq!(t3.is_negative(), true ); assert_eq!(t3.abs(), 350i16); assert_eq!(t4.sign(), Sign::Negative); assert_eq!(t4.is_positive(), false ); assert_eq!(t4.is_negative(), true ); assert_eq!(t4.abs(), 1000i32); assert_eq!(t5.sign(), Sign::Negative); assert_eq!(t5.is_positive(), false ); assert_eq!(t5.is_negative(), true ); assert_eq!(t5.abs(), 2551i64 ); assert_eq!(tz.sign(), Sign::Zero ); assert_eq!(tz.is_positive(), false ); assert_eq!(tz.is_negative(), false ); assert_eq!(tz.abs(), 0); }