Crusader_Decomp/rebuild/remorse/tests/entity_dispatch_entry_tests.cpp
Maddo 202679f857 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.
2026-09-25 21:41:20 +02:00

479 lines
23 KiB
C++

#include "remorse/entity_dispatch_entry.h"
#include <cassert>
#include <cstring>
#include <stdexcept>
#include <vector>
int main()
{
remorse::EntityDispatchEntryBase entry{};
remorse::u16 groupCounts[32]{};
for (remorse::u8& byte : entry.bytes) {
byte = 0xa5;
}
assert(remorse::EntityDispatchEntry::initBase(&entry, 1, groupCounts) == &entry);
assert(entry.bytes[0x00] == 0x06 && entry.bytes[0x01] == 0x3b);
assert(entry.bytes[0x09] == 0xa5);
assert(entry.bytes[0x1e] == 0x10 && entry.bytes[0x1f] == 0x2d);
assert(entry.bytes[0x28] == 0xfe && entry.bytes[0x29] == 0x3a);
for (remorse::u16 offset : {remorse::u16{0x02}, remorse::u16{0x04}, remorse::u16{0x0a}, remorse::u16{0x12}, remorse::u16{0x16}, remorse::u16{0x1a}, remorse::u16{0x20}, remorse::u16{0x26}, remorse::u16{0x2a}, remorse::u16{0x30}}) {
assert(entry.bytes[offset] == 0 && entry.bytes[offset + 1] == 0);
}
assert(entry.bytes[0x06] == 1 && entry.bytes[0x07] == 0);
assert(entry.bytes[0x08] == 1 && groupCounts[1] == 1);
assert(entry.bytes[0x18] == 1 && entry.bytes[0x19] == 0);
assert(remorse::EntityDispatchEntry::initBase(nullptr, 1, groupCounts) == nullptr);
assert(groupCounts[1] == 1);
remorse::EntityDispatchEntry::setSourceType(entry, 0x1234);
assert(entry.bytes[0x04] == 0x34);
assert(entry.bytes[0x05] == 0x12);
remorse::EntityDispatchEntry::setEventTypeChecked(entry, 0x00f2);
assert(entry.bytes[0x06] == 0xf2);
assert(entry.bytes[0x07] == 0x00);
remorse::EntityDispatchEntry::sleep(entry, 0x12345678, 0x0001003c);
assert(entry.bytes[0x18] == 0x01 && entry.bytes[0x19] == 0x10);
assert(entry.bytes[0x0a] == 0x78 && entry.bytes[0x0b] == 0x56);
assert(entry.bytes[0x0c] == 0x34 && entry.bytes[0x0d] == 0x12);
assert(entry.bytes[0x0e] == 0x3c && entry.bytes[0x0f] == 0x00);
assert(entry.bytes[0x10] == 0x01 && entry.bytes[0x11] == 0x00);
remorse::EntityDispatchEntry::setGroupId(entry, 3, groupCounts);
assert(groupCounts[1] == 0 && groupCounts[3] == 1);
entry.bytes[0x08] = 0xe3;
remorse::EntityDispatchEntry::setGroupId(entry, 3, groupCounts);
assert(entry.bytes[0x08] == 0xe3 && groupCounts[3] == 1);
remorse::EntityDispatchEntry::setGroupId(entry, 3, groupCounts);
assert(groupCounts[3] == 1);
remorse::EntityDispatchEntry::setGroupId(entry, 4, groupCounts);
assert(entry.bytes[0x08] == 4 && groupCounts[3] == 0 && groupCounts[4] == 1);
for (remorse::u8 invalidId : {remorse::u8{0}, remorse::u8{32}}) {
bool rejected = false;
try {
remorse::EntityDispatchEntry::setGroupId(entry, invalidId, groupCounts);
} catch (const std::invalid_argument&) {
rejected = true;
}
assert(rejected && entry.bytes[0x08] == 4 && groupCounts[4] == 1);
}
remorse::EntityDispatchEntry::incrementGroupId(entry);
assert(entry.bytes[0x08] == 5);
remorse::ProcessKernel kernel;
kernel.setLastAllocationSize(sizeof(entry));
assert(kernel.addProcess(entry) == 0);
assert(entry.bytes[0x02] == 0 && entry.bytes[0x03] == 0);
assert(kernel.processAt(0) == &entry);
assert(kernel.allocationSizeAt(0) == 0x32);
assert(kernel.processCount() == 1 && kernel.capacity() == 30);
assert(std::strcmp(kernel.processNameAt(0), "Default") == 0);
remorse::EntityDispatchEntryBase second{};
kernel.setMarkNewProcesses(true);
assert(kernel.addProcess(second) == 1);
assert(second.bytes[0x02] == 1 && second.bytes[0x03] == 0);
assert(kernel.allocationSizeAt(1) == 0);
assert(second.bytes[0x19] == 0x02 && kernel.newlyCreatedCount() == 1);
kernel.setMarkNewProcesses(false);
kernel.clearProcessSlot(1);
assert(kernel.processAt(1) == nullptr && kernel.allocationSizeAt(1) == 0);
assert(kernel.processNameAt(1) == nullptr && kernel.processCount() == 2);
remorse::EntityDispatchEntryBase reused{};
assert(kernel.addProcess(reused) == 1 && kernel.processAt(1) == &reused);
std::vector<remorse::EntityDispatchEntryBase> additional(29);
for (auto& process : additional) {
kernel.addProcess(process);
}
assert(kernel.processAt(30) == &additional.back());
assert(kernel.capacity() == 60 && kernel.processCount() == 32);
remorse::ProcessKernel createdKernel;
remorse::u16 createdGroups[32]{};
auto* created = createdKernel.createProcess(2, createdGroups);
assert(created != nullptr && createdKernel.processAt(0) == created);
assert(createdKernel.processCount() == 1 && createdKernel.allocationSizeAt(0) == 0x32);
assert(created->bytes[0x02] == 0 && created->bytes[0x03] == 0);
assert(created->bytes[0x08] == 2 && createdGroups[2] == 1);
createdKernel.setSyncContext(true, 1);
auto* next = createdKernel.createProcess(2, createdGroups);
assert(createdKernel.processAt(1) == next && createdGroups[2] == 2);
assert(next->bytes[0x02] == 1 && next->bytes[0x03] == 0);
assert(next->bytes[0x16] == 0);
createdKernel.setSyncContext(true, 0);
auto* syncing = createdKernel.createProcess(2, createdGroups);
assert(createdKernel.processAt(2) == syncing && createdGroups[2] == 3);
assert(syncing->bytes[0x16] == 0x40 && syncing->bytes[0x17] == 0);
createdKernel.setSyncContext(true, 1);
next->bytes[0x18] |= 0x02;
auto* retiring = createdKernel.createProcess(2, createdGroups);
assert(createdKernel.processAt(3) == retiring && createdKernel.processCount() == 4);
assert(next->bytes[0x18] == 0x07 && retiring->bytes[0x16] == 0x40);
createdKernel.terminateProcess(3, createdGroups);
assert(createdKernel.processAt(3) == retiring && (retiring->bytes[0x16] & 0x08) != 0);
assert(createdKernel.processCount() == 3 && createdKernel.terminatedProcessCount() == 1);
assert(createdGroups[2] == 3);
bool alreadyTerminated = false;
try {
createdKernel.terminateProcess(3, createdGroups);
} catch (const std::logic_error&) {
alreadyTerminated = true;
}
assert(alreadyTerminated && createdGroups[2] == 3 && createdKernel.terminatedProcessCount() == 1);
createdKernel.setSyncContext(true, 3);
auto* afterTerminated = createdKernel.createProcess(2, createdGroups);
assert((retiring->bytes[0x18] & 0x04) == 0 && (afterTerminated->bytes[0x16] & 0x40) != 0);
createdKernel.terminateProcess(4, createdGroups);
createdKernel.clearTerminatedProcesses();
assert(createdKernel.processAt(3) == nullptr && createdKernel.allocationSizeAt(3) == 0);
assert(createdKernel.processNameAt(3) == nullptr && createdKernel.terminatedProcessCount() == 0);
auto* recycled = createdKernel.createProcess(2, createdGroups);
assert(createdKernel.processAt(3) == recycled && recycled->bytes[0x02] == 3);
assert(createdKernel.processCount() == 4 && createdGroups[2] == 4);
auto* immediate = createdKernel.createProcess(2, createdGroups);
immediate->bytes[0x18] |= 0x04;
createdKernel.terminateProcess(4, createdGroups);
assert(createdKernel.processAt(4) == nullptr && createdKernel.processCount() == 4);
assert(createdKernel.terminatedProcessCount() == 0 && createdGroups[2] == 4);
remorse::ProcessKernel fullKernel;
std::vector<remorse::EntityDispatchEntryBase> fullTable(1020);
for (auto& process : fullTable) {
fullKernel.addProcess(process);
}
remorse::u16 fullGroups[32]{};
bool exhausted = false;
try {
fullKernel.createProcess(2, fullGroups);
} catch (const std::overflow_error&) {
exhausted = true;
}
assert(exhausted && fullKernel.processCount() == 1020 && fullGroups[2] == 0);
exhausted = false;
try {
fullKernel.createKeyboardProcess(2, fullGroups);
} catch (const std::overflow_error&) {
exhausted = true;
}
assert(exhausted && fullKernel.processCount() == 1020 && fullGroups[2] == 0);
exhausted = false;
try {
fullKernel.createSystemTimerProcess(2, fullGroups);
} catch (const std::overflow_error&) {
exhausted = true;
}
assert(exhausted && fullKernel.processCount() == 1020 && fullGroups[2] == 0);
remorse::ProcessKernel scheduler;
remorse::u16 scheduledGroups[32]{};
auto* otherGroup = scheduler.createProcess(1, scheduledGroups);
auto* matching = scheduler.createProcess(2, scheduledGroups);
auto* syncingProcess = scheduler.createProcess(2, scheduledGroups);
auto* specialGroup = scheduler.createProcess(30, scheduledGroups);
syncingProcess->bytes[0x16] = 0x40;
std::vector<remorse::u16> ran;
auto recordRun = [](remorse::EntityDispatchEntryBase& process, void* context) {
auto& ids = *static_cast<std::vector<remorse::u16>*>(context);
ids.push_back(static_cast<remorse::u16>(process.bytes[0x02] | process.bytes[0x03] << 8));
};
scheduler.scanRunnableProcesses(2, recordRun, &ran);
assert((ran == std::vector<remorse::u16>{1, 3}));
assert(syncingProcess->bytes[0x16] == 0 && otherGroup->bytes[0x16] == 0);
ran.clear();
matching->bytes[0x16] = 1;
scheduler.scanRunnableProcesses(2, recordRun, &ran);
assert((ran == std::vector<remorse::u16>{2, 3}));
assert(specialGroup->bytes[0x08] == 30);
remorse::ProcessKernel spawningKernel;
remorse::u16 spawningGroups[32]{};
spawningKernel.createProcess(1, spawningGroups);
auto* spawningProcess = spawningKernel.createProcess(2, spawningGroups);
spawningProcess->bytes[0x18] |= 0x02;
struct SpawnContext {
remorse::ProcessKernel* kernel;
remorse::u16 (*groups)[32];
remorse::EntityDispatchEntryBase* spawned = nullptr;
int runs = 0;
} spawnContext{&spawningKernel, &spawningGroups};
auto spawnRun = [](remorse::EntityDispatchEntryBase&, void* context) {
auto& state = *static_cast<SpawnContext*>(context);
++state.runs;
if (state.spawned == nullptr) {
state.spawned = state.kernel->createProcess(2, *state.groups);
}
};
spawningKernel.scanRunnableProcesses(2, spawnRun, &spawnContext);
assert(spawnContext.runs == 1 && spawnContext.spawned == spawningKernel.processAt(2));
assert(spawningProcess->bytes[0x18] == 0x07 && spawnContext.spawned->bytes[0x16] == 0);
remorse::ProcessKernel retiringKernel;
remorse::u16 retiringGroups[32]{};
for (int index = 0; index < 3; ++index) {
retiringKernel.createProcess(1, retiringGroups);
}
retiringKernel.createProcess(2, retiringGroups);
struct RetireContext {
remorse::ProcessKernel* kernel;
remorse::u16 (*groups)[32];
} retireContext{&retiringKernel, &retiringGroups};
auto retireRun = [](remorse::EntityDispatchEntryBase& process, void* context) {
auto& state = *static_cast<RetireContext*>(context);
state.kernel->terminateProcess(static_cast<remorse::u16>(process.bytes[0x02]), *state.groups);
};
retiringKernel.scanRunnableProcesses(2, retireRun, &retireContext);
assert(retiringKernel.processAt(3) == nullptr && retiringKernel.terminatedProcessCount() == 0);
assert(retiringKernel.processCount() == 3 && retiringGroups[2] == 0);
remorse::ProcessKernel sleepingKernel;
remorse::u16 sleepingGroups[32]{};
auto* sleeper = sleepingKernel.createProcess(2, sleepingGroups);
remorse::EntityDispatchEntry::sleep(*sleeper, 100, 60);
ran.clear();
sleepingKernel.scanRunnableProcesses(2, recordRun, &ran, 160);
assert(ran.empty() && sleeper->bytes[0x19] == 0x10);
sleepingKernel.scanRunnableProcesses(2, recordRun, &ran, 161);
assert((ran == std::vector<remorse::u16>{0}));
assert(sleeper->bytes[0x19] == 0);
for (remorse::u16 offset = 0x0a; offset < 0x12; ++offset) {
assert(sleeper->bytes[offset] == 0);
}
remorse::ProcessKernel standKernel;
remorse::u16 standGroups[32]{};
standKernel.createProcess(2, standGroups);
assert(!standKernel.itemHasProcess(0x1234) && !standKernel.itemHasProcess(0x1235));
auto* standEntry = standKernel.createStandProcess(2, 0x1234, standGroups);
auto* standing = &standEntry->base;
assert(standKernel.processAt(1) == standing && standKernel.allocationSizeAt(1) == 0x42);
assert(std::strcmp(standKernel.processNameAt(1), "Stand") == 0 && standGroups[2] == 2);
assert(standing->bytes[0] == 0x0f && standing->bytes[1] == 0x1f);
assert(standing->bytes[0x04] == 0x34 && standing->bytes[0x05] == 0x12);
assert(standing->bytes[0x06] == 0x58 && standing->bytes[0x07] == 0x02);
assert(standing->bytes[0x17] == 0x03 && standEntry->extra[0] == 0x01 && standEntry->extra[1] == 0x01);
assert(standEntry->extra[0x0e] == 0x34 && standEntry->extra[0x0f] == 0x12);
assert(standKernel.itemHasProcess(0x1234) && !standKernel.itemHasProcess(0x1235));
bool itemTeardownRejected = false;
try {
standKernel.terminateProcess(1, standGroups);
} catch (const std::logic_error&) {
itemTeardownRejected = true;
}
assert(itemTeardownRejected && standGroups[2] == 2 && standKernel.processAt(1) == standing);
struct StandContext {
remorse::u32 tick;
bool visible;
remorse::u16 activity = 0;
bool currentActivity = false;
bool canSee = false;
remorse::u16 startedNpc = 0;
remorse::u16 startedActivity = 0;
int starts = 0;
int runs = 0;
remorse::StandProcessEntry* entry = nullptr;
remorse::NpcBehaviorServices* services = nullptr;
} standContext{99, false};
remorse::NpcBehaviorServices standServices{
[](remorse::u16 npcNumber, void* context) {
assert(npcNumber == 0x1234);
return static_cast<StandContext*>(context)->visible;
},
[](remorse::u16 npcNumber, void* context) {
assert(npcNumber == 0x1234);
return static_cast<StandContext*>(context)->activity;
},
[](remorse::u16 npcNumber, remorse::u16 activity, void* context) {
assert(npcNumber == 0x1234 && activity == 0x71);
return static_cast<StandContext*>(context)->currentActivity;
},
[](remorse::u16 npcNumber, void* context) {
assert(npcNumber == 0x1234);
return static_cast<StandContext*>(context)->canSee;
},
[](remorse::u16 npcNumber, remorse::u16 activity, void* context) {
auto& state = *static_cast<StandContext*>(context);
state.startedNpc = npcNumber;
state.startedActivity = activity;
++state.starts;
},
&standContext
};
standContext.entry = standEntry;
standContext.services = &standServices;
auto standRun = [](remorse::EntityDispatchEntryBase& process, void* context) {
auto& state = *static_cast<StandContext*>(context);
if (process.bytes[0] != 0x0f || process.bytes[1] != 0x1f) {
return;
}
++state.runs;
remorse::StandProcess::run(*state.entry, *state.services, state.tick);
};
standKernel.scanRunnableProcesses(2, standRun, &standContext, standContext.tick);
assert(standContext.runs == 1 && standing->bytes[0x19] == 0x10);
assert(standing->bytes[0x0a] == 99 && standing->bytes[0x0e] == 60);
assert(standContext.starts == 0);
standContext.tick = 159;
standKernel.scanRunnableProcesses(2, standRun, &standContext, standContext.tick);
assert(standContext.runs == 1 && standing->bytes[0x19] == 0x10);
standContext.tick = 160;
standContext.visible = true;
standContext.activity = 0x71;
standContext.canSee = true;
standKernel.scanRunnableProcesses(2, standRun, &standContext, standContext.tick);
assert(standContext.runs == 2 && standing->bytes[0x19] == 0 && standing->bytes[0x0e] == 0);
assert(standContext.starts == 1 && standContext.startedNpc == 0x1234 && standContext.startedActivity == 0x71);
standContext.tick = 161;
standContext.currentActivity = true;
standKernel.scanRunnableProcesses(2, standRun, &standContext, standContext.tick);
assert(standContext.runs == 3 && standContext.starts == 1 && standing->bytes[0x0e] == 60);
remorse::ProcessKernel itemKernel;
remorse::u16 itemGroups[32]{};
for (int index = 0; index < 3; ++index) {
itemKernel.createProcess(1, itemGroups);
}
auto* firstStand = itemKernel.createStandProcess(2, 0x1234, itemGroups);
auto* secondStand = itemKernel.createStandProcess(2, 0x1234, itemGroups);
auto* otherStand = itemKernel.createStandProcess(2, 0x1235, itemGroups);
assert(itemKernel.itemHasProcess(0x1234) && itemKernel.itemHasProcess(0x1235));
itemKernel.terminateProcess(3, itemGroups);
assert(itemKernel.itemHasProcess(0x1234) && itemKernel.processAt(3) == &firstStand->base);
itemKernel.clearTerminatedProcesses();
assert(itemKernel.processAt(3) == nullptr && itemKernel.itemHasProcess(0x1234));
secondStand->base.bytes[0x18] |= 0x04;
itemKernel.terminateProcess(4, itemGroups);
assert(itemKernel.processAt(4) == nullptr && !itemKernel.itemHasProcess(0x1234));
assert(itemKernel.itemHasProcess(0x1235) && itemKernel.processAt(5) == &otherStand->base);
assert(itemGroups[2] == 1 && itemKernel.processCount() == 4);
remorse::SystemTimerProcessEntry systemTimer{};
systemTimer.extra[0x0e] = 0xff;
systemTimer.extra[0x0f] = 0xff;
assert(remorse::SystemTimerProcess::tick(systemTimer) == 0xffff);
remorse::SystemTimerProcess::increment(systemTimer);
assert(remorse::SystemTimerProcess::tick(systemTimer) == 0x10000);
assert(systemTimer.extra[0x0e] == 0 && systemTimer.extra[0x0f] == 0);
assert(systemTimer.extra[0x10] == 1 && systemTimer.extra[0x11] == 0);
remorse::ProcessKernel timerKernel;
remorse::u16 timerGroups[32]{};
bool missingTimerRejected = false;
try {
timerKernel.deliverSystemTimerEvent();
} catch (const std::logic_error&) {
missingTimerRejected = true;
}
assert(missingTimerRejected);
for (int index = 0; index < 3; ++index) {
timerKernel.createProcess(1, timerGroups);
}
auto* registeredTimer = timerKernel.createSystemTimerProcess(1, timerGroups);
assert(timerKernel.processAt(3) == &registeredTimer->base);
assert(timerKernel.allocationSizeAt(3) == 0x4a && timerGroups[1] == 4);
assert(std::strcmp(timerKernel.processNameAt(3), "SystemTimer") == 0);
assert(registeredTimer->base.bytes[0x16] == 3 && registeredTimer->base.bytes[0x17] == 0x27);
assert(registeredTimer->base.bytes[0x18] == 1 && registeredTimer->extra[0] == 2);
assert(registeredTimer->extra[4] == 0x3c && timerKernel.systemTimerTick() == 0);
registeredTimer->base.bytes[0x17] &= static_cast<remorse::u8>(~0x04);
bool registrationRejected = false;
try {
timerKernel.deliverSystemTimerEvent();
} catch (const std::logic_error&) {
registrationRejected = true;
}
assert(registrationRejected && timerKernel.systemTimerTick() == 0);
registeredTimer->base.bytes[0x17] |= 0x04;
bool duplicateTimerRejected = false;
try {
timerKernel.createSystemTimerProcess(1, timerGroups);
} catch (const std::logic_error&) {
duplicateTimerRejected = true;
}
assert(duplicateTimerRejected && timerGroups[1] == 4);
bool timerTeardownRejected = false;
try {
timerKernel.terminateProcess(3, timerGroups);
} catch (const std::logic_error&) {
timerTeardownRejected = true;
}
assert(timerTeardownRejected && timerGroups[1] == 4);
auto* timedStand = timerKernel.createStandProcess(1, 7, timerGroups);
remorse::EntityDispatchEntry::sleep(timedStand->base, timerKernel.systemTimerTick(), 60);
for (int tick = 0; tick < 60; ++tick) {
timerKernel.deliverSystemTimerEvent();
}
ran.clear();
timerKernel.scanRunnableProcesses(1, recordRun, &ran, timerKernel.systemTimerTick());
assert(ran.size() == 3 && timedStand->base.bytes[0x19] == 0x10);
timerKernel.deliverSystemTimerEvent();
ran.clear();
timerKernel.scanRunnableProcesses(1, recordRun, &ran, timerKernel.systemTimerTick());
assert((ran == std::vector<remorse::u16>{0, 1, 2, 4}));
assert(timedStand->base.bytes[0x19] == 0 && timerKernel.systemTimerTick() == 61);
auto* keyboard = timerKernel.createKeyboardProcess(1, timerGroups);
assert(timerKernel.processAt(5) == &keyboard->base && timerKernel.allocationSizeAt(5) == 0x36);
assert(std::strcmp(timerKernel.processNameAt(5), "KeyboardProcess") == 0);
assert(keyboard->base.bytes[0x16] == 3 && keyboard->base.bytes[0x17] == 1);
assert(keyboard->base.bytes[0x18] == 0x81 && keyboard->base.bytes[0x19] == 1);
assert(keyboard->extra[0] == 0 && keyboard->extra[3] == 0 && timerGroups[1] == 6);
bool duplicateKeyboardRejected = false;
try {
timerKernel.createKeyboardProcess(1, timerGroups);
} catch (const std::logic_error&) {
duplicateKeyboardRejected = true;
}
assert(duplicateKeyboardRejected && timerGroups[1] == 6);
bool keyboardTeardownRejected = false;
try {
timerKernel.terminateProcess(5, timerGroups);
} catch (const std::logic_error&) {
keyboardTeardownRejected = true;
}
assert(keyboardTeardownRejected && timerGroups[1] == 6);
auto* keyDaemon = timerKernel.createKeyDaemonProcess(1, timerGroups);
assert(timerKernel.processAt(6) == &keyDaemon->base && timerKernel.allocationSizeAt(6) == 0x40);
assert(std::strcmp(timerKernel.processNameAt(6), "KeyDaemon") == 0);
assert(keyDaemon->base.bytes[0x16] == 3 && keyDaemon->base.bytes[0x17] == 0x27);
assert(keyDaemon->extra[0] == 2 && keyDaemon->extra[4] == 0x2d && timerGroups[1] == 7);
bool duplicateDaemonRejected = false;
try {
timerKernel.createKeyDaemonProcess(1, timerGroups);
} catch (const std::logic_error&) {
duplicateDaemonRejected = true;
}
assert(duplicateDaemonRejected && timerGroups[1] == 7);
bool daemonTeardownRejected = false;
try {
timerKernel.terminateProcess(6, timerGroups);
} catch (const std::logic_error&) {
daemonTeardownRejected = true;
}
assert(daemonTeardownRejected && timerGroups[1] == 7);
remorse::KeyEvent keyboardEvent{0x41, 0x1e, 1, 2, 3, 1, 4, 5};
const remorse::KeyEvent lastEvent{0x42, 0x30, 6, 7, 8, 9, 10, 11};
keyboard->extra[0] = 0x31;
assert(!remorse::KeyboardProcess::handleKeyEvent(*keyboard, 0x11, 0, keyboardEvent, lastEvent));
assert(!remorse::KeyboardProcess::handleKeyEvent(*keyboard, 0x10, 1, keyboardEvent, lastEvent));
assert(keyboardEvent.character == 0x41 && keyboard->extra[0] == 0x31);
keyboardEvent.field8 = 0;
assert(!remorse::KeyboardProcess::handleKeyEvent(*keyboard, 0x10, 0, keyboardEvent, lastEvent));
keyboardEvent.field8 = 1;
keyboardEvent.character = 0;
assert(!remorse::KeyboardProcess::handleKeyEvent(*keyboard, 0x10, 0, keyboardEvent, lastEvent));
keyboardEvent.character = 0x41;
assert(remorse::KeyboardProcess::handleKeyEvent(*keyboard, 0x10, 0, keyboardEvent, lastEvent));
assert(std::memcmp(&keyboardEvent, &lastEvent, sizeof(keyboardEvent)) == 0);
assert(keyboard->extra[0] == 0x21);
return 0;
}