diff --git a/src/windows-emulator-test/emulation_test.cpp b/src/windows-emulator-test/emulation_test.cpp index bddf56e..1ec0ebd 100644 --- a/src/windows-emulator-test/emulation_test.cpp +++ b/src/windows-emulator-test/emulation_test.cpp @@ -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); } }