cleanup test type sizes and add more cases for i8

This commit is contained in:
Brendan Hansknecht 2022-03-20 22:01:13 -07:00
parent 46fc305d56
commit 20ed4cbacb

View file

@ -1845,18 +1845,28 @@ fn shift_left_by() {
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn shift_right_by() { fn shift_right_by() {
// Sign Extended Right Shift // Sign Extended Right Shift
assert_evals_to!("Num.shiftRightBy 2 0b0100_0000i8", 0b0001_0000, i8); assert_evals_to!(
assert_evals_to!("Num.shiftRightBy 1 0b1110_0000u8", 0b1111_0000u8 as i8, i8); "Num.shiftRightBy 2 (Num.toI8 0b1100_0000u8)",
assert_evals_to!("Num.shiftRightBy 2 0b1100_0000u8", 0b1111_0000u8 as i8, i8); 0b1111_0000u8 as i8,
i8
);
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);
} }
#[test] #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn shift_right_zf_by() { fn shift_right_zf_by() {
// Logical Right Shift // Logical Right Shift
assert_evals_to!("Num.shiftRightZfBy 2 0b1100_0000u8", 0b0011_0000, i64); assert_evals_to!(
assert_evals_to!("Num.shiftRightZfBy 1 0b0000_0010u8", 0b0000_0001, i64); "Num.shiftRightZfBy 2 (Num.toI8 0b1100_0000u8)",
assert_evals_to!("Num.shiftRightZfBy 2 0b0000_1100u8", 0b0000_0011, i64); 0b0011_0000i8,
i8
);
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);
} }
#[test] #[test]