Add band and bor operator for bit operations (#5936)

* Add `band` and `bor` Operator

* Add tests
This commit is contained in:
Justin Ma
2022-07-03 02:03:36 +08:00
committed by GitHub
parent 84caf8859f
commit b82dccf0bd
8 changed files with 91 additions and 17 deletions

View File

@ -55,6 +55,21 @@ fn or() -> TestResult {
run_test("true || false", "true")
}
#[test]
fn band() -> TestResult {
run_test("2 band 4", "0")
}
#[test]
fn bor() -> TestResult {
run_test("2 bor 4", "6")
}
#[test]
fn bit_and_or() -> TestResult {
run_test("2 bor 4 band 1 + 2", "2")
}
#[test]
fn pow() -> TestResult {
run_test("3 ** 3", "27")