mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
cleanup test type sizes and add more cases for i8
This commit is contained in:
parent
46fc305d56
commit
20ed4cbacb
1 changed files with 16 additions and 6 deletions
|
@ -1845,18 +1845,28 @@ fn shift_left_by() {
|
|||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn shift_right_by() {
|
||||
// Sign Extended Right Shift
|
||||
assert_evals_to!("Num.shiftRightBy 2 0b0100_0000i8", 0b0001_0000, i8);
|
||||
assert_evals_to!("Num.shiftRightBy 1 0b1110_0000u8", 0b1111_0000u8 as i8, i8);
|
||||
assert_evals_to!("Num.shiftRightBy 2 0b1100_0000u8", 0b1111_0000u8 as i8, i8);
|
||||
assert_evals_to!(
|
||||
"Num.shiftRightBy 2 (Num.toI8 0b1100_0000u8)",
|
||||
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]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn shift_right_zf_by() {
|
||||
// Logical Right Shift
|
||||
assert_evals_to!("Num.shiftRightZfBy 2 0b1100_0000u8", 0b0011_0000, i64);
|
||||
assert_evals_to!("Num.shiftRightZfBy 1 0b0000_0010u8", 0b0000_0001, i64);
|
||||
assert_evals_to!("Num.shiftRightZfBy 2 0b0000_1100u8", 0b0000_0011, i64);
|
||||
assert_evals_to!(
|
||||
"Num.shiftRightZfBy 2 (Num.toI8 0b1100_0000u8)",
|
||||
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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue