Skip to content

Commit

Permalink
test analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
momo5502 committed Nov 3, 2024
1 parent 690f314 commit d6ede86
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions src/windows-emulator-test/emulation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,38 @@ namespace test

const auto executedInstructions = emu.process().executed_instructions;

auto new_emu = create_sample_emulator();
auto bad_offset = 1ULL;
auto good_offset = executedInstructions - 1ULL;

constexpr auto offset = 1;
const auto instructionsToExecute = executedInstructions - offset;
while (good_offset - bad_offset > 1)
{
const auto offset = ((good_offset - bad_offset) / 2) + bad_offset;

new_emu.start({}, instructionsToExecute);
auto new_emu = create_sample_emulator();
const auto instructionsToExecute = executedInstructions - offset;

ASSERT_EQ(new_emu.process().executed_instructions, instructionsToExecute);
ASSERT_NOT_TERMINATED(new_emu);
new_emu.start({}, instructionsToExecute);

new_emu.start({}, offset);
if (new_emu.process().executed_instructions != instructionsToExecute)
{
bad_offset = offset;
printf("New bad: %llX\n", bad_offset);
}
else
{
good_offset = offset;
printf("New good: %llX\n", good_offset);
}
}

ASSERT_TERMINATED_SUCCESSFULLY(new_emu);
ASSERT_EQ(new_emu.process().executed_instructions, executedInstructions);
printf("Offsets: %llX-%llX\n", good_offset, bad_offset);

//ASSERT_EQ(new_emu->process().executed_instructions, instructionsToExecute);
//ASSERT_NOT_TERMINATED(*new_emu);

//new_emu->start({}, offset);

//ASSERT_TERMINATED_SUCCESSFULLY(new_emu);
//ASSERT_EQ(new_emu.process().executed_instructions, executedInstructions);
}
}

0 comments on commit d6ede86

Please sign in to comment.