Skip to content

Commit beadf75

Browse files
author
Cyres
committed
Add ident function to the rest of the tests
1 parent e54c5a9 commit beadf75

File tree

3 files changed

+34
-22
lines changed

3 files changed

+34
-22
lines changed

src/test/run-pass/const-int-overflowing.rs

+14-10
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,23 @@ const SHL_B: (u32, bool) = 0x1u32.overflowing_shl(132);
2525
const SHR_A: (u32, bool) = 0x10u32.overflowing_shr(4);
2626
const SHR_B: (u32, bool) = 0x10u32.overflowing_shr(132);
2727

28+
fn ident<T>(ident: T) -> T {
29+
ident
30+
}
31+
2832
fn main() {
29-
assert_eq!(ADD_A, (7, false));
30-
assert_eq!(ADD_B, (0, true));
33+
assert_eq!(ADD_A, ident((7, false)));
34+
assert_eq!(ADD_B, ident((0, true)));
3135

32-
assert_eq!(SUB_A, (3, false));
33-
assert_eq!(SUB_B, (u32::max_value(), true));
36+
assert_eq!(SUB_A, ident((3, false)));
37+
assert_eq!(SUB_B, ident((u32::max_value(), true)));
3438

35-
assert_eq!(MUL_A, (10, false));
36-
assert_eq!(MUL_B, (1410065408, true));
39+
assert_eq!(MUL_A, ident((10, false)));
40+
assert_eq!(MUL_B, ident((1410065408, true)));
3741

38-
assert_eq!(SHL_A, (0x10, false));
39-
assert_eq!(SHL_B, (0x10, true));
42+
assert_eq!(SHL_A, ident((0x10, false)));
43+
assert_eq!(SHL_B, ident((0x10, true)));
4044

41-
assert_eq!(SHR_A, (0x1, false));
42-
assert_eq!(SHR_B, (0x1, true));
45+
assert_eq!(SHR_A, ident((0x1, false)));
46+
assert_eq!(SHR_B, ident((0x1, true)));
4347
}

src/test/run-pass/const-int-rotate.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
const LEFT: u32 = 0x10000b3u32.rotate_left(8);
1414
const RIGHT: u32 = 0xb301u32.rotate_right(8);
1515

16+
fn ident<T>(ident: T) -> T {
17+
ident
18+
}
19+
1620
fn main() {
17-
assert_eq!(LEFT, 0xb301);
18-
assert_eq!(RIGHT, 0x10000b3);
21+
assert_eq!(LEFT, ident(0xb301));
22+
assert_eq!(RIGHT, ident(0x10000b3));
1923
}

src/test/run-pass/const-int-wrapping.rs

+14-10
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,23 @@ const SHL_B: u32 = 1u32.wrapping_shl(128);
2525
const SHR_A: u32 = 128u32.wrapping_shr(7);
2626
const SHR_B: u32 = 128u32.wrapping_shr(128);
2727

28+
fn ident<T>(ident: T) -> T {
29+
ident
30+
}
31+
2832
fn main() {
29-
assert_eq!(ADD_A, 255);
30-
assert_eq!(ADD_B, 199);
33+
assert_eq!(ADD_A, ident(255));
34+
assert_eq!(ADD_B, ident(199));
3135

32-
assert_eq!(SUB_A, 0);
33-
assert_eq!(SUB_B, 101);
36+
assert_eq!(SUB_A, ident(0));
37+
assert_eq!(SUB_B, ident(101));
3438

35-
assert_eq!(MUL_A, 120);
36-
assert_eq!(MUL_B, 44);
39+
assert_eq!(MUL_A, ident(120));
40+
assert_eq!(MUL_B, ident(44));
3741

38-
assert_eq!(SHL_A, 128);
39-
assert_eq!(SHL_B, 1);
42+
assert_eq!(SHL_A, ident(128));
43+
assert_eq!(SHL_B, ident(1));
4044

41-
assert_eq!(SHR_A, 1);
42-
assert_eq!(SHR_B, 128);
45+
assert_eq!(SHR_A, ident(1);
46+
assert_eq!(SHR_B, ident(128));
4347
}

0 commit comments

Comments
 (0)