X64EmitterTest: Check bytes instead of disassembly in JMP test

Check bytes directly to avoid ambiguity in the disassembly between short
and near jumps, which could hypothetically cause the test to pass when
it shouldn't.
This commit is contained in:
Dentomologist 2023-08-05 13:47:11 -07:00
parent dcd5ba6587
commit 4ccac53e9f
1 changed files with 5 additions and 7 deletions

View File

@ -297,15 +297,13 @@ TEST_F(x64EmitterTest, POP_Register)
TEST_F(x64EmitterTest, JMP)
{
emitter->NOP(6);
emitter->JMP(code_buffer);
ExpectDisassembly("multibyte nop "
"jmp .-8");
emitter->NOP(1);
emitter->JMP(code_buffer, XEmitter::Jump::Short);
ExpectBytes({/* nop */ 0x90, /* short jmp */ 0xeb, /* offset -3 */ 0xfd});
emitter->NOP(6);
emitter->NOP(1);
emitter->JMP(code_buffer, XEmitter::Jump::Near);
ExpectDisassembly("multibyte nop "
"jmp .-11");
ExpectBytes({/* nop */ 0x90, /* near jmp */ 0xe9, /* offset -6 */ 0xfa, 0xff, 0xff, 0xff});
}
TEST_F(x64EmitterTest, JMPptr_Register)