Add comprehensive tests for collision detection, entity dispatch, file system, isometric controls, map rendering, and sorting

- Implemented collision tests to verify overlap and movement logic for collision bodies.
- Enhanced entity dispatch entry tests to cover initialization, group ID management, and process handling.
- Expanded file system tests to include crash diagnostics and ensure proper game data root detection.
- Created isometric controls tests to validate movement requests and screen projection calculations.
- Added map renderer tests to check fixed map loading and rendering functionality.
- Introduced map sorter tests to confirm correct rendering order for various items.
This commit is contained in:
Maddo 2026-09-25 21:41:20 +02:00
commit 202679f857
27 changed files with 3530 additions and 81 deletions

View file

@ -13,6 +13,7 @@
int main(int argc, char** argv)
{
remorse::installCrashDiagnostics();
const std::filesystem::path manifestPath = argc > 1
? std::filesystem::path(argv[1])
: remorse::defaultManifestPath(std::filesystem::current_path());
@ -24,9 +25,48 @@ int main(int argc, char** argv)
}
remorse::printStartupReport(*manifest);
remorse::EntityDispatchEntryBase entry{};
remorse::EntityDispatchEntry::initBase(&entry);
remorse::EntityDispatchEntry::setGroupId(entry, 1);
remorse::ProcessKernel kernel;
remorse::u16 groupCounts[32]{};
const auto* entry = kernel.createProcess(1, groupCounts);
std::cout << "Registered process ID: " << (entry ? entry->bytes[0x02] : 0) << '\n';
for (int index = 0; index < 3; ++index) {
kernel.createProcess(1, groupCounts);
}
kernel.createSystemTimerProcess(1, groupCounts);
kernel.createKeyboardProcess(1, groupCounts);
kernel.createKeyDaemonProcess(1, groupCounts);
kernel.terminateProcess(3, groupCounts);
kernel.clearTerminatedProcesses();
auto* reused = kernel.createStandProcess(1, 1, groupCounts);
std::cout << "Reused Stand process ID: " << (reused ? reused->base.bytes[0x02] : 0) << '\n';
remorse::NpcBehaviorServices npcServices{
[](remorse::u16, void*) { return false; },
[](remorse::u16, void*) -> remorse::u16 { return 0; },
[](remorse::u16, remorse::u16, void*) { return false; },
[](remorse::u16, void*) { return false; },
[](remorse::u16, remorse::u16, void*) {},
nullptr
};
struct ScanContext {
remorse::StandProcessEntry* standing;
remorse::NpcBehaviorServices* npcServices;
remorse::u32 timerTick;
int hostCallbacks = 0;
} scanContext{reused, &npcServices, 0};
for (int tick = 0; tick < 100; ++tick) {
kernel.deliverSystemTimerEvent();
}
scanContext.timerTick = kernel.systemTimerTick();
kernel.scanRunnableProcesses(1, [](remorse::EntityDispatchEntryBase& process, void* context) {
auto& scan = *static_cast<ScanContext*>(context);
if (process.bytes[0] == 0x0f && process.bytes[1] == 0x1f) {
remorse::StandProcess::run(*scan.standing, *scan.npcServices, scan.timerTick);
} else {
++scan.hostCallbacks;
}
}, &scanContext, scanContext.timerTick);
std::cout << "Scheduler scan host callbacks: " << scanContext.hostCallbacks << '\n';
std::cout << "StandProcess Run sleep ticks: " << static_cast<int>(reused->base.bytes[0x0e]) << '\n';
const auto gameDataRoot = remorse::findGameDataRoot(std::filesystem::current_path());
std::cout << "Game data root: " << (gameDataRoot ? gameDataRoot->path.string() : "not found") << '\n';