More proper unit test conditions.

This commit is contained in:
Izzat Bahadirov 2013-06-04 21:40:42 -04:00
parent 180529840c
commit 46619d11bf

View File

@ -75,8 +75,8 @@ public class PayloadAlignmentTest {
int codeOffset = 0; int codeOffset = 0;
for (Instruction instr: writeUtil.getInstructions()) { for (Instruction instr: writeUtil.getInstructions()) {
if (codeOffset == 1) { if (instr.getOpcode().equals(Opcode.ARRAY_PAYLOAD)) {
Assert.assertEquals("array payload was not aligned properly", instr.getOpcode(), Opcode.NOP); Assert.assertEquals("array payload was not aligned properly", codeOffset%2, 0);
break; break;
} }
codeOffset += instr.getCodeUnits(); codeOffset += instr.getCodeUnits();
@ -97,8 +97,8 @@ public class PayloadAlignmentTest {
int codeOffset = 0; int codeOffset = 0;
for (Instruction instr: writeUtil.getInstructions()) { for (Instruction instr: writeUtil.getInstructions()) {
if (codeOffset == 1) { if (instr.getOpcode().equals(Opcode.PACKED_SWITCH_PAYLOAD)) {
Assert.assertEquals("packed switch payload was not aligned properly", instr.getOpcode(), Opcode.NOP); Assert.assertEquals("packed switch payload was not aligned properly", codeOffset%2, 0);
break; break;
} }
codeOffset += instr.getCodeUnits(); codeOffset += instr.getCodeUnits();
@ -121,8 +121,8 @@ public class PayloadAlignmentTest {
int codeOffset = 0; int codeOffset = 0;
for (Instruction instr: writeUtil.getInstructions()) { for (Instruction instr: writeUtil.getInstructions()) {
if (codeOffset == 1) { if (instr.getOpcode().equals(Opcode.SPARSE_SWITCH_PAYLOAD)) {
Assert.assertEquals("packed switch payload was not aligned properly", instr.getOpcode(), Opcode.NOP); Assert.assertEquals("packed switch payload was not aligned properly", codeOffset%2, 0);
break; break;
} }
codeOffset += instr.getCodeUnits(); codeOffset += instr.getCodeUnits();