yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
ppu_test.cc
Go to the documentation of this file.
1#include "app/emu/video/ppu.h"
2
3#include <gmock/gmock.h>
4
5#include "app/emu/cpu/clock.h"
8
9namespace yaze {
10namespace test {
11namespace emu {
12
21
25class MockPpu : public PpuInterface {
26 public:
27 MOCK_METHOD(void, Write, (uint16_t address, uint8_t data), (override));
28 MOCK_METHOD(uint8_t, Read, (uint16_t address), (const, override));
29
30 std::vector<uint8_t> internalFrameBuffer;
31 std::vector<uint8_t> vram;
32 std::vector<SpriteAttributes> sprites;
33 std::vector<Tilemap> tilemaps;
35};
36
40class PpuTest : public ::testing::Test {
41 protected:
45
47
48 void SetUp() override {
49 ON_CALL(mock_ppu, Write(::testing::_, ::testing::_))
50 .WillByDefault([this](uint16_t address, uint8_t data) {
51 mock_ppu.vram[address] = data;
52 });
53
54 ON_CALL(mock_ppu, Read(::testing::_))
55 .WillByDefault(
56 [this](uint16_t address) { return mock_ppu.vram[address]; });
57 }
58};
59
60} // namespace emu
61} // namespace test
62} // namespace yaze
Mock CPU class for testing.
Definition mock_memory.h:19
A mock implementation of the Memory class.
Definition mock_memory.h:45
virtual void Write(uint16_t address, uint8_t data)=0
virtual uint8_t Read(uint16_t address) const =0
Represents a bitmap image.
Definition bitmap.h:67
Mock Ppu class for testing.
Definition ppu_test.cc:25
MOCK_METHOD(void, Write,(uint16_t address, uint8_t data),(override))
std::vector< Tilemap > tilemaps
Definition ppu_test.cc:33
std::vector< uint8_t > vram
Definition ppu_test.cc:31
BackgroundMode bgMode
Definition ppu_test.cc:34
std::vector< SpriteAttributes > sprites
Definition ppu_test.cc:32
std::vector< uint8_t > internalFrameBuffer
Definition ppu_test.cc:30
MOCK_METHOD(uint8_t, Read,(uint16_t address),(const, override))
void SetUp() override
Definition ppu_test.cc:48
Definition common.cc:22