Enhanced ROM for testing that behaves like a real ROM but with test data. More...
#include <mock_rom.h>
Public Member Functions | |
MockRom ()=default | |
MOCK_METHOD (absl::Status, WriteHelper,(const WriteAction &),(override)) | |
absl::Status | SetTestData (const std::vector< uint8_t > &data) |
Load test data into the ROM. | |
void | SetObjectData (int object_id, const std::vector< uint8_t > &data) |
Store object-specific test data for validation. | |
void | SetRoomData (int room_id, const std::vector< uint8_t > &data) |
Store room-specific test data for validation. | |
bool | HasObjectData (int object_id) const |
Check if object data has been set for testing. | |
bool | HasRoomData (int room_id) const |
Check if room data has been set for testing. | |
bool | IsValid () const |
Check if the mock ROM is valid for testing. | |
const std::vector< uint8_t > & | GetObjectData (int object_id) const |
Get the stored object data for validation. | |
const std::vector< uint8_t > & | GetRoomData (int room_id) const |
Get the stored room data for validation. | |
![]() | |
absl::Status | LoadFromFile (const std::string &filename, bool z3_load=true) |
absl::Status | LoadFromFile (const std::string &filename, const RomLoadOptions &options) |
absl::Status | LoadFromData (const std::vector< uint8_t > &data, bool z3_load=true) |
absl::Status | LoadFromData (const std::vector< uint8_t > &data, const RomLoadOptions &options) |
absl::Status | LoadZelda3 () |
absl::Status | LoadZelda3 (const RomLoadOptions &options) |
absl::Status | LoadGfxGroups () |
absl::Status | InitializeForTesting () |
absl::Status | SaveGfxGroups () |
absl::Status | SaveToFile (const SaveSettings &settings) |
absl::Status | SavePalette (int index, const std::string &group_name, gfx::SnesPalette &palette) |
absl::Status | SaveAllPalettes () |
void | Expand (int size) |
void | Close () |
absl::StatusOr< uint8_t > | ReadByte (int offset) |
absl::StatusOr< uint16_t > | ReadWord (int offset) |
absl::StatusOr< uint32_t > | ReadLong (int offset) |
absl::StatusOr< std::vector< uint8_t > > | ReadByteVector (uint32_t offset, uint32_t length) const |
absl::StatusOr< gfx::Tile16 > | ReadTile16 (uint32_t tile16_id) |
absl::Status | WriteTile16 (int tile16_id, const gfx::Tile16 &tile) |
absl::Status | WriteByte (int addr, uint8_t value) |
absl::Status | WriteWord (int addr, uint16_t value) |
absl::Status | WriteShort (int addr, uint16_t value) |
absl::Status | WriteLong (uint32_t addr, uint32_t value) |
absl::Status | WriteVector (int addr, std::vector< uint8_t > data) |
absl::Status | WriteColor (uint32_t address, const gfx::SnesColor &color) |
template<typename... Args> | |
absl::Status | WriteTransaction (Args... args) |
template<typename T , typename... Args> | |
absl::Status | ReadTransaction (T &var, int address, Args &&... args) |
virtual absl::Status | WriteHelper (const WriteAction &action) |
template<typename T > | |
absl::Status | ReadHelper (T &var, int address) |
uint8_t & | operator[] (unsigned long i) |
bool | is_loaded () const |
bool | dirty () const |
void | set_dirty (bool dirty) |
void | ClearDirty () |
auto | title () const |
auto | size () const |
auto | data () const |
auto | mutable_data () |
auto | begin () |
auto | end () |
auto | vector () const |
auto | filename () const |
auto | set_filename (std::string_view name) |
auto | short_name () const |
auto | graphics_buffer () const |
auto | mutable_graphics_buffer () |
auto | palette_group () const |
auto | mutable_palette_group () |
auto | dungeon_palette (int i) |
auto | mutable_dungeon_palette (int i) |
core::ResourceLabelManager * | resource_label () |
zelda3_version_pointers | version_constants () const |
Private Attributes | |
bool | test_data_loaded_ = false |
std::map< int, std::vector< uint8_t > > | object_data_ |
std::map< int, std::vector< uint8_t > > | room_data_ |
Additional Inherited Members | |
![]() | |
std::array< std::array< uint8_t, 8 >, kNumMainBlocksets > | main_blockset_ids |
std::array< std::array< uint8_t, 4 >, kNumRoomBlocksets > | room_blockset_ids |
std::array< std::array< uint8_t, 4 >, kNumSpritesets > | spriteset_ids |
std::array< std::array< uint8_t, 4 >, kNumPalettesets > | paletteset_ids |
Enhanced ROM for testing that behaves like a real ROM but with test data.
This class extends Rom to provide testing utilities while maintaining all the real ROM functionality. Instead of mocking methods, it loads real test data into the ROM.
Definition at line 21 of file mock_rom.h.
|
default |
yaze::test::MockRom::MOCK_METHOD | ( | absl::Status | , |
WriteHelper | , | ||
(const WriteAction &) | , | ||
(override) | |||
) |
Load test data into the ROM.
data | The test ROM data to load |
Definition at line 33 of file mock_rom.h.
References yaze::Rom::data(), yaze::Rom::LoadFromData(), and test_data_loaded_.
Referenced by yaze::cli::resources::CommandContextTest::SetUp().
|
inline |
Store object-specific test data for validation.
Definition at line 44 of file mock_rom.h.
References yaze::Rom::data(), and object_data_.
Store room-specific test data for validation.
Definition at line 51 of file mock_rom.h.
References yaze::Rom::data(), and room_data_.
Check if object data has been set for testing.
Definition at line 58 of file mock_rom.h.
References object_data_.
Check if room data has been set for testing.
Definition at line 65 of file mock_rom.h.
References room_data_.
|
inline |
Check if the mock ROM is valid for testing.
Definition at line 72 of file mock_rom.h.
References yaze::Rom::is_loaded(), yaze::Rom::size(), and test_data_loaded_.
Get the stored object data for validation.
Definition at line 79 of file mock_rom.h.
References object_data_, and yaze::Rom::vector().
Get the stored room data for validation.
Definition at line 88 of file mock_rom.h.
References room_data_, and yaze::Rom::vector().
Definition at line 95 of file mock_rom.h.
Referenced by IsValid(), and SetTestData().
Definition at line 96 of file mock_rom.h.
Referenced by GetObjectData(), HasObjectData(), and SetObjectData().
Definition at line 97 of file mock_rom.h.
Referenced by GetRoomData(), HasRoomData(), and SetRoomData().