From 42f49c1d79df7dcf4ba7a64dc15a2691672de6bf Mon Sep 17 00:00:00 2001 From: Brendan Hansknecht Date: Sun, 20 Mar 2022 22:09:11 -0700 Subject: [PATCH] also add test for overshifting to make sure we don't get bits from higher up in the type --- compiler/test_gen/src/gen_num.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/test_gen/src/gen_num.rs b/compiler/test_gen/src/gen_num.rs index 7b13747a5f..18bf887fc0 100644 --- a/compiler/test_gen/src/gen_num.rs +++ b/compiler/test_gen/src/gen_num.rs @@ -1853,6 +1853,8 @@ fn shift_right_by() { assert_evals_to!("Num.shiftRightBy 2 0b0100_0000i8", 0b0001_0000i8, i8); assert_evals_to!("Num.shiftRightBy 1 0b1110_0000u8", 0b1111_0000u8, u8); assert_evals_to!("Num.shiftRightBy 2 0b1100_0000u8", 0b1111_0000u8, u8); + assert_evals_to!("Num.shiftRightBy 12 0b1000_0000u8", 0b1111_1111u8, u8); + assert_evals_to!("Num.shiftRightBy 12 0b0100_0000u8", 0b0000_0000u8, u8); } #[test] @@ -1867,6 +1869,7 @@ fn shift_right_zf_by() { assert_evals_to!("Num.shiftRightZfBy 2 0b1100_0000u8", 0b0011_0000u8, u8); assert_evals_to!("Num.shiftRightZfBy 1 0b0000_0010u8", 0b0000_0001u8, u8); assert_evals_to!("Num.shiftRightZfBy 2 0b0000_1100u8", 0b0000_0011u8, u8); + assert_evals_to!("Num.shiftRightZfBy 12 0b1000_0000u8", 0b0000_0000u8, u8); } #[test]