Skip to content

Commit

Permalink
extend another test
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbepop committed Nov 20, 2023
1 parent 4e2c3fa commit 4830169
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions crates/wasmi/src/engine/regmach/tests/op/cmp_br.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,25 +143,29 @@ fn loop_backward_imm() {
#[test]
#[cfg_attr(miri, ignore)]
fn loop_backward_imm_eqz() {
let wasm = wat2wasm(
r"
(module
(func (param i32 i32)
(loop
(local.get 0)
(i32.const 0)
(i32.eq)
(br_if 0)
fn test_for(op: &str, expect_instr: fn(Register, BranchOffset) -> Instruction) {
let wasm = wat2wasm(&format!(
r"
(module
(func (param i32 i32)
(loop
(local.get 0)
(i32.const 0)
(i32.{op})
(br_if 0)
)
)
)
)",
);
TranslationTest::new(wasm)
.expect_func_instrs([
Instruction::branch_eqz(Register::from_i16(0), BranchOffset::from(0_i32)),
Instruction::Return,
])
.run()
)",
));
TranslationTest::new(wasm)
.expect_func_instrs([
expect_instr(Register::from_i16(0), BranchOffset::from(0_i32)),
Instruction::Return,
])
.run()
}
test_for("eq", Instruction::branch_eqz);
test_for("ne", Instruction::branch_nez);
}

#[test]
Expand Down

0 comments on commit 4830169

Please sign in to comment.