]> git.lizzy.rs Git - rust.git/commitdiff
const-int-overflowing.rs += overflowing_neg
authorLokathor <zefria@gmail.com>
Sat, 2 Feb 2019 01:50:21 +0000 (18:50 -0700)
committerLokathor <zefria@gmail.com>
Sat, 2 Feb 2019 01:50:21 +0000 (18:50 -0700)
src/test/run-pass/const-int-overflowing.rs

index 289b1236cf1e214149afed505a62170ab7aea49a..e8fd022e6829633ecf1c6a970d282778c89f9a74 100644 (file)
@@ -13,6 +13,9 @@
 const SHR_A: (u32, bool) = 0x10u32.overflowing_shr(4);
 const SHR_B: (u32, bool) = 0x10u32.overflowing_shr(132);
 
+const NEG_A: (u32, bool) = 0.overflowing_neg();
+const NEG_B: (u32, bool) = core::u32::MAX.overflowing_neg();
+
 fn ident<T>(ident: T) -> T {
     ident
 }
@@ -32,4 +35,7 @@ fn main() {
 
     assert_eq!(SHR_A, ident((0x1, false)));
     assert_eq!(SHR_B, ident((0x1, true)));
+
+    assert_eq!(NEG_A, ident((0, false)));
+    assert_eq!(NEG_B, ident((1, true)));
 }