Skip to content

Commit

Permalink
fixed eq opcode test
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKhowalGithub committed Apr 13, 2024
1 parent a8f29aa commit b5152a4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,14 @@ mod tests {
let mut test_vm = get_test_vm();
test_vm.registers[0] = 10;
test_vm.registers[1] = 10;
test_vm.program = vec![9, 0, 1, 0, 10, 0, 1, 0];
test_vm.program = vec![9, 0, 1, 0]; // EQ Opcode followed by its operands
test_vm.run_once();
assert_eq!(test_vm.equal_flag, true);

// Reset PC and change the value of register 1 for the next test
test_vm.pc = 0;
test_vm.registers[1] = 20;
test_vm.program = vec![9, 0, 1, 0]; // Reset the program for the next EQ test
test_vm.run_once();
assert_eq!(test_vm.equal_flag, false);
}
Expand Down

0 comments on commit b5152a4

Please sign in to comment.