Test suite for core emulator components. More...
#include <emulator_test_suite.h>
Public Member Functions | |
EmulatorTestSuite ()=default | |
~EmulatorTestSuite () override=default | |
std::string | GetName () const override |
TestCategory | GetCategory () const override |
absl::Status | RunTests (TestResults &results) override |
void | DrawConfiguration () override |
![]() | |
virtual | ~TestSuite ()=default |
virtual bool | IsEnabled () const |
virtual void | SetEnabled (bool enabled) |
Private Member Functions | |
void | RunApuHandshakeTest (TestResults &results) |
Verifies the CPU-APU handshake protocol. | |
void | RunSpc700CycleAccuracyTest (TestResults &results) |
Validates the cycle counting for SPC700 opcodes. | |
void | RunBreakpointManagerTest (TestResults &results) |
Tests the core functionality of the BreakpointManager. | |
void | RunWatchpointManagerTest (TestResults &results) |
Tests the memory WatchpointManager. | |
void | RunAudioBackendTest (TestResults &results) |
Tests the audio backend abstraction layer. | |
Private Attributes | |
bool | test_apu_handshake_ = true |
bool | test_spc700_cycles_ = true |
bool | test_breakpoint_manager_ = true |
bool | test_watchpoint_manager_ = true |
bool | test_audio_backend_ = true |
Additional Inherited Members | |
![]() | |
bool | enabled_ = true |
Test suite for core emulator components.
This suite validates the contracts outlined in the emulator enhancement and APU timing fix roadmaps. It tests the functionality of the CPU, APU, SPC700, and debugging components to ensure they meet the requirements for cycle-accurate emulation and advanced debugging.
Definition at line 30 of file emulator_test_suite.h.
|
default |
|
overridedefault |
|
inlineoverridevirtual |
Implements yaze::test::TestSuite.
Definition at line 35 of file emulator_test_suite.h.
Referenced by RunApuHandshakeTest(), RunAudioBackendTest(), RunBreakpointManagerTest(), RunSpc700CycleAccuracyTest(), and RunWatchpointManagerTest().
|
inlineoverridevirtual |
Implements yaze::test::TestSuite.
Definition at line 36 of file emulator_test_suite.h.
References yaze::test::kUnit.
Referenced by RunApuHandshakeTest(), RunAudioBackendTest(), RunBreakpointManagerTest(), RunSpc700CycleAccuracyTest(), and RunWatchpointManagerTest().
|
inlineoverridevirtual |
Implements yaze::test::TestSuite.
Definition at line 38 of file emulator_test_suite.h.
References RunApuHandshakeTest(), RunAudioBackendTest(), RunBreakpointManagerTest(), RunSpc700CycleAccuracyTest(), RunWatchpointManagerTest(), test_apu_handshake_, test_audio_backend_, test_breakpoint_manager_, test_spc700_cycles_, and test_watchpoint_manager_.
|
inlineoverridevirtual |
Reimplemented from yaze::test::TestSuite.
Definition at line 48 of file emulator_test_suite.h.
References ICON_MD_GAMEPAD, test_apu_handshake_, test_audio_backend_, test_breakpoint_manager_, test_spc700_cycles_, and test_watchpoint_manager_.
|
inlineprivate |
Verifies the CPU-APU handshake protocol.
Contract: Ensures the APU correctly signals its ready state and the CPU can initiate the audio driver transfer. This is based on the protocol described in APU_Timing_Fix_Plan.md
. A failure here indicates a fundamental timing or communication issue preventing audio from initializing.
Definition at line 74 of file emulator_test_suite.h.
References yaze::test::TestResults::AddResult(), yaze::emu::Snes::apu(), yaze::emu::Snes::apu_handshake_tracker(), yaze::test::TestResult::category, yaze::test::TestResult::duration, yaze::test::TestResult::error_message, GetCategory(), GetName(), yaze::emu::Snes::Init(), yaze::test::kFailed, yaze::test::kPassed, yaze::emu::Snes::mutable_cycles(), yaze::test::TestResult::name, yaze::test::TestResult::status, yaze::test::TestResult::suite_name, yaze::test::TestResult::timestamp, yaze::emu::debug::ApuHandshakeTracker::WAITING_BBAA, and yaze::emu::Snes::Write().
Referenced by RunTests().
|
inlineprivate |
Validates the cycle counting for SPC700 opcodes.
Contract: Each SPC700 instruction must consume a precise number of cycles. This test verifies that the Spc700::GetLastOpcodeCycles()
method returns the correct base cycle count from spc700_cycles.h
. This is a prerequisite for the cycle-accurate refactoring proposed in APU_Timing_Fix_Plan.md
. Note: This test does not yet account for variable cycle costs (page crossing, etc.).
Definition at line 142 of file emulator_test_suite.h.
References yaze::test::TestResults::AddResult(), yaze::test::TestResult::category, yaze::test::TestResult::duration, yaze::test::TestResult::error_message, GetCategory(), yaze::emu::Spc700::GetLastOpcodeCycles(), GetName(), yaze::emu::ApuCallbacks::idle, yaze::test::kFailed, yaze::test::kPassed, yaze::test::TestResult::name, yaze::emu::Spc700::PC, yaze::emu::ApuCallbacks::read, yaze::emu::Spc700::Reset(), yaze::emu::Spc700::RunOpcode(), yaze::test::TestResult::status, yaze::test::TestResult::suite_name, yaze::test::TestResult::timestamp, and yaze::emu::ApuCallbacks::write.
Referenced by RunTests().
|
inlineprivate |
Tests the core functionality of the BreakpointManager.
Contract: The BreakpointManager
must be able to add, remove, and correctly identify hit breakpoints of various types (Execute, Read, Write). This is a core feature of the "Advanced Debugger" goal in E1-emulator-enhancement-roadmap.md
.
Definition at line 198 of file emulator_test_suite.h.
References yaze::emu::BreakpointManager::AddBreakpoint(), yaze::test::TestResults::AddResult(), yaze::test::TestResult::category, yaze::emu::BreakpointManager::CPU_65816, yaze::test::TestResult::duration, yaze::test::TestResult::error_message, yaze::emu::BreakpointManager::EXECUTE, yaze::emu::BreakpointManager::GetAllBreakpoints(), GetCategory(), GetName(), yaze::test::kFailed, yaze::test::kPassed, yaze::test::TestResult::name, yaze::emu::BreakpointManager::RemoveBreakpoint(), yaze::emu::BreakpointManager::ShouldBreakOnExecute(), yaze::test::TestResult::status, yaze::test::TestResult::suite_name, and yaze::test::TestResult::timestamp.
Referenced by RunTests().
|
inlineprivate |
Tests the memory WatchpointManager.
Contract: The WatchpointManager
must correctly log memory accesses and trigger breaks when configured to do so. This is a key feature for debugging data corruption issues, as outlined in the emulator roadmap.
Definition at line 252 of file emulator_test_suite.h.
References yaze::test::TestResults::AddResult(), yaze::emu::WatchpointManager::AddWatchpoint(), yaze::test::TestResult::category, yaze::test::TestResult::duration, yaze::test::TestResult::error_message, GetCategory(), yaze::emu::WatchpointManager::GetHistory(), GetName(), yaze::test::kFailed, yaze::test::kPassed, yaze::test::TestResult::name, yaze::emu::WatchpointManager::OnMemoryAccess(), yaze::test::TestResult::status, yaze::test::TestResult::suite_name, and yaze::test::TestResult::timestamp.
Referenced by RunTests().
|
inlineprivate |
Tests the audio backend abstraction layer.
Contract: The audio backend must initialize correctly, manage its state (playing/paused), and accept audio samples. This is critical for fixing the audio output as described in E1-emulator-enhancement-roadmap.md
.
Definition at line 307 of file emulator_test_suite.h.
References yaze::test::TestResults::AddResult(), yaze::test::TestResult::category, yaze::emu::audio::AudioBackendFactory::Create(), yaze::test::TestResult::duration, yaze::test::TestResult::error_message, GetCategory(), GetName(), yaze::test::kFailed, yaze::test::kPassed, yaze::test::TestResult::name, yaze::emu::audio::AudioBackendFactory::SDL2, yaze::test::TestResult::status, yaze::test::TestResult::suite_name, and yaze::test::TestResult::timestamp.
Referenced by RunTests().
|
private |
Definition at line 60 of file emulator_test_suite.h.
Referenced by DrawConfiguration(), and RunTests().
|
private |
Definition at line 61 of file emulator_test_suite.h.
Referenced by DrawConfiguration(), and RunTests().
|
private |
Definition at line 62 of file emulator_test_suite.h.
Referenced by DrawConfiguration(), and RunTests().
|
private |
Definition at line 63 of file emulator_test_suite.h.
Referenced by DrawConfiguration(), and RunTests().
|
private |
Definition at line 64 of file emulator_test_suite.h.
Referenced by DrawConfiguration(), and RunTests().