yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::test::EmulatorTestSuite Class Reference

Test suite for core emulator components. More...

#include <emulator_test_suite.h>

Inheritance diagram for yaze::test::EmulatorTestSuite:
Collaboration diagram for yaze::test::EmulatorTestSuite:

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
 
- Public Member Functions inherited from yaze::test::TestSuite
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

- Protected Attributes inherited from yaze::test::TestSuite
bool enabled_ = true
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ EmulatorTestSuite()

yaze::test::EmulatorTestSuite::EmulatorTestSuite ( )
default

◆ ~EmulatorTestSuite()

yaze::test::EmulatorTestSuite::~EmulatorTestSuite ( )
overridedefault

Member Function Documentation

◆ GetName()

std::string yaze::test::EmulatorTestSuite::GetName ( ) const
inlineoverridevirtual

◆ GetCategory()

TestCategory yaze::test::EmulatorTestSuite::GetCategory ( ) const
inlineoverridevirtual

◆ RunTests()

◆ DrawConfiguration()

void yaze::test::EmulatorTestSuite::DrawConfiguration ( )
inlineoverridevirtual

◆ RunApuHandshakeTest()

void yaze::test::EmulatorTestSuite::RunApuHandshakeTest ( TestResults results)
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().

◆ RunSpc700CycleAccuracyTest()

void yaze::test::EmulatorTestSuite::RunSpc700CycleAccuracyTest ( TestResults results)
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().

◆ RunBreakpointManagerTest()

void yaze::test::EmulatorTestSuite::RunBreakpointManagerTest ( TestResults results)
inlineprivate

◆ RunWatchpointManagerTest()

void yaze::test::EmulatorTestSuite::RunWatchpointManagerTest ( TestResults results)
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().

◆ RunAudioBackendTest()

void yaze::test::EmulatorTestSuite::RunAudioBackendTest ( TestResults results)
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().

Here is the call graph for this function:

Member Data Documentation

◆ test_apu_handshake_

bool yaze::test::EmulatorTestSuite::test_apu_handshake_ = true
private

Definition at line 60 of file emulator_test_suite.h.

Referenced by DrawConfiguration(), and RunTests().

◆ test_spc700_cycles_

bool yaze::test::EmulatorTestSuite::test_spc700_cycles_ = true
private

Definition at line 61 of file emulator_test_suite.h.

Referenced by DrawConfiguration(), and RunTests().

◆ test_breakpoint_manager_

bool yaze::test::EmulatorTestSuite::test_breakpoint_manager_ = true
private

Definition at line 62 of file emulator_test_suite.h.

Referenced by DrawConfiguration(), and RunTests().

◆ test_watchpoint_manager_

bool yaze::test::EmulatorTestSuite::test_watchpoint_manager_ = true
private

Definition at line 63 of file emulator_test_suite.h.

Referenced by DrawConfiguration(), and RunTests().

◆ test_audio_backend_

bool yaze::test::EmulatorTestSuite::test_audio_backend_ = true
private

Definition at line 64 of file emulator_test_suite.h.

Referenced by DrawConfiguration(), and RunTests().


The documentation for this class was generated from the following file: