2019-07-26 16:54:25 -05:00
|
|
|
//@ run-pass
|
|
|
|
|
2018-09-01 08:05:55 -05:00
|
|
|
const NEGATIVE_A: bool = (-10i32).is_negative();
|
|
|
|
const NEGATIVE_B: bool = 10i32.is_negative();
|
2019-06-07 18:23:33 -05:00
|
|
|
const POSITIVE_A: bool = (-10i32).is_positive();
|
|
|
|
const POSITIVE_B: bool = 10i32.is_positive();
|
|
|
|
|
|
|
|
const SIGNUM_POS: i32 = 10i32.signum();
|
|
|
|
const SIGNUM_NIL: i32 = 0i32.signum();
|
|
|
|
const SIGNUM_NEG: i32 = (-42i32).signum();
|
2018-09-01 08:05:55 -05:00
|
|
|
|
2019-08-21 08:40:12 -05:00
|
|
|
const ABS_A: i32 = 10i32.abs();
|
|
|
|
const ABS_B: i32 = (-10i32).abs();
|
|
|
|
|
2018-09-01 08:05:55 -05:00
|
|
|
fn main() {
|
|
|
|
assert!(NEGATIVE_A);
|
|
|
|
assert!(!NEGATIVE_B);
|
|
|
|
assert!(!POSITIVE_A);
|
|
|
|
assert!(POSITIVE_B);
|
2019-06-07 18:23:33 -05:00
|
|
|
|
|
|
|
assert_eq!(SIGNUM_POS, 1);
|
|
|
|
assert_eq!(SIGNUM_NIL, 0);
|
|
|
|
assert_eq!(SIGNUM_NEG, -1);
|
2019-08-21 08:40:12 -05:00
|
|
|
|
|
|
|
assert_eq!(ABS_A, 10);
|
|
|
|
assert_eq!(ABS_B, 10);
|
2018-09-01 08:05:55 -05:00
|
|
|
}
|