From 6d88469b93ecf864aceaa3d3cee1c5e4483acf33 Mon Sep 17 00:00:00 2001 From: Ayush Kumar Mishra Date: Wed, 18 Nov 2020 17:56:26 +0530 Subject: [PATCH] Added tests in int module library as a part of #76268 --- library/core/tests/num/i32.rs | 5 +++++ library/core/tests/num/i8.rs | 9 +++++++++ src/test/ui/numbers-arithmetic/i32-sub.rs | 6 ------ src/test/ui/numbers-arithmetic/i8-incr.rs | 12 ------------ 4 files changed, 14 insertions(+), 18 deletions(-) delete mode 100644 src/test/ui/numbers-arithmetic/i32-sub.rs delete mode 100644 src/test/ui/numbers-arithmetic/i8-incr.rs diff --git a/library/core/tests/num/i32.rs b/library/core/tests/num/i32.rs index 4acc760ffac99..0f2398d433df1 100644 --- a/library/core/tests/num/i32.rs +++ b/library/core/tests/num/i32.rs @@ -28,3 +28,8 @@ fn test_arith_operation() { i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3) ); } + +#[test] +fn test_sub_operation() { + let mut x: i32 = -400; x = 0 - x; assert_eq!(x, 400); +} diff --git a/library/core/tests/num/i8.rs b/library/core/tests/num/i8.rs index ccec6915fe090..039e96fdbbe69 100644 --- a/library/core/tests/num/i8.rs +++ b/library/core/tests/num/i8.rs @@ -1 +1,10 @@ int_module!(i8, i8); + +#[test] +fn test_incr_operation() { + let mut x: i8 = -12; + let y: i8 = -12; + x = x + 1; + x = x - 1; + assert_eq!(x, y); +} diff --git a/src/test/ui/numbers-arithmetic/i32-sub.rs b/src/test/ui/numbers-arithmetic/i32-sub.rs deleted file mode 100644 index 56df772b4e18a..0000000000000 --- a/src/test/ui/numbers-arithmetic/i32-sub.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass - - - - -pub fn main() { let mut x: i32 = -400; x = 0 - x; assert_eq!(x, 400); } diff --git a/src/test/ui/numbers-arithmetic/i8-incr.rs b/src/test/ui/numbers-arithmetic/i8-incr.rs deleted file mode 100644 index 718d259f735f4..0000000000000 --- a/src/test/ui/numbers-arithmetic/i8-incr.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass - - - - -pub fn main() { - let mut x: i8 = -12; - let y: i8 = -12; - x = x + 1; - x = x - 1; - assert_eq!(x, y); -}