Update #4202: Add shift operator bshl and bshr for integers (#5928)

* Update #4202: Add shift operator bshl and bshr for integers

* Add more tests
This commit is contained in:
Justin Ma
2022-07-02 19:48:43 +08:00
committed by GitHub
parent 3b357e5402
commit 3917fda7ed
8 changed files with 94 additions and 0 deletions

View File

@ -25,6 +25,26 @@ fn modulo2() -> TestResult {
run_test("5.25 mod 2", "1.25")
}
#[test]
fn bshr() -> TestResult {
run_test("16 bshr 1", "8")
}
#[test]
fn bshl() -> TestResult {
run_test("5 bshl 1", "10")
}
#[test]
fn bshl_add() -> TestResult {
run_test("2 bshl 1 + 2", "16")
}
#[test]
fn sub_bshr() -> TestResult {
run_test("10 - 2 bshr 2", "2")
}
#[test]
fn and() -> TestResult {
run_test("true && false", "false")