]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/const-int-sign.rs
Rollup merge of #61705 - petrhosek:llvm-cflags, r=alexcrichton
[rust.git] / src / test / run-pass / const-int-sign.rs
index 9d656a020306921d4cc851fa592a32cd39b051fd..fcd3ef4ea025b805c7b8f20ab7261861bbaa47e4 100644 (file)
@@ -1,11 +1,21 @@
+#![feature(const_int_sign)]
+
 const NEGATIVE_A: bool = (-10i32).is_negative();
 const NEGATIVE_B: bool = 10i32.is_negative();
-const POSITIVE_A: bool= (-10i32).is_positive();
-const POSITIVE_B: bool= 10i32.is_positive();
+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();
 
 fn main() {
     assert!(NEGATIVE_A);
     assert!(!NEGATIVE_B);
     assert!(!POSITIVE_A);
     assert!(POSITIVE_B);
+
+    assert_eq!(SIGNUM_POS, 1);
+    assert_eq!(SIGNUM_NIL, 0);
+    assert_eq!(SIGNUM_NEG, -1);
 }