The event queue is core emulator machinery - registration, sorted insertion, dispatch, frame reduction and removal - but no unit test exercises it, and event.c documents a past crash from signed-subtraction overflow in its comparator that nothing pins.
unittests/unittests.c gains event_queue_test(): registration and naming via event_register()/event_name(); ordering by unsigned T-state with insertion on both sides of a distant event (Q at 0x100, P at 0xe0000000, R at 0x40000000 must dispatch as Q, R, P - the old signed-subtraction comparator would dispatch Q, P, R); equal-time events fire in registration order; event_frame() reduces every entry and recomputes the next event time; event_remove_type() and event_remove_type_user_data() null matching events, which dispatch silently; a callback may queue another event and the dispatch loop picks it up in the same call; event_force_events() jumps to the next event for the RZX playback path. The test clears the queue at entry and leaves it empty at exit, saving and restoring tstates and tstates_per_frame.
unittests/unittests.cRepo-Assist-Effect: 7b1671ca5854813220ee65e54c3da4d2f5efa9a2e4b0fbec9861ffbbcb91d268
Diff:
Applied in [b731db].
Related
Commit: [b731db]