@@ -25,7 +25,7 @@ public:
void step_execution(uint32_t cycles) {
for (uint32_t i = 0; i < cycles; ++i) {
ppu->execute();
EXPECT_FALSE(ppu->execute().has_value());
}
}
@@ -456,7 +456,8 @@ TEST_F(PpuTest, visible_two_sub_cycles) {
}
for (int i = 0; i < 17; ++i) {
ppu->execute();
const auto pixel = ppu->execute();
EXPECT_FALSE(pixel.has_value());
}
EXPECT_EQ(expected, registers);
@@ -497,7 +498,8 @@ TEST_F(PpuTest, visible_scanline) {
}
for (int i = 0; i <= 256; ++i) {
ppu->execute();
const auto pixel = ppu->execute();
EXPECT_FALSE(pixel.has_value());
}
EXPECT_EQ(expected, registers);
@@ -505,14 +507,15 @@ TEST_F(PpuTest, visible_scanline) {
expected.vram_addr = PpuVram(0b001'00'00000'00000);
expected.cycle = 258;
ppu->execute(); // Cycle 257
EXPECT_FALSE(ppu->execute().has_value()); // Cycle 257
EXPECT_EQ(expected, registers);
// Cycle 258-320
// During cycle 280-304 the ppu is idle
expected.cycle = 321;
for (int i = 258; i <= 320; ++i) {
ppu->execute();
const auto pixel = ppu->execute();
EXPECT_FALSE(pixel.has_value());
}
EXPECT_EQ(expected, registers);
@@ -534,7 +537,8 @@ TEST_F(PpuTest, visible_scanline) {
EXPECT_CALL(mmu, read_byte(0x03 * 16u + 8u + 1u)).WillOnce(Return(0x99));
for (int i = 321; i <= 336; ++i) {
ppu->execute();
const auto pixel = ppu->execute();
EXPECT_FALSE(pixel.has_value());
}
EXPECT_EQ(expected, registers);
@@ -544,7 +548,8 @@ TEST_F(PpuTest, visible_scanline) {
expected.cycle = 0;
EXPECT_CALL(mmu, read_byte(0x2000 + 2)).Times(2).WillRepeatedly(Return(2));
for (int i = 337; i <= 340; ++i) {
ppu->execute();
const auto pixel = ppu->execute();
EXPECT_FALSE(pixel.has_value());
}
EXPECT_EQ(expected, registers);
}
@@ -593,7 +598,8 @@ TEST_F(PpuTest, pre_render_two_sub_cycles) {
}
for (int i = 0; i < 17; ++i) {
ppu->execute();
const auto pixel = ppu->execute();
EXPECT_FALSE(pixel.has_value());
}
EXPECT_EQ(expected, registers);
@@ -634,7 +640,8 @@ TEST_F(PpuTest, pre_render_scanline) {
}
for (int i = 0; i <= 256; ++i) {
ppu->execute();
const auto pixel = ppu->execute();
EXPECT_FALSE(pixel.has_value());
}
EXPECT_EQ(expected, registers);
@@ -642,7 +649,7 @@ TEST_F(PpuTest, pre_render_scanline) {
expected.vram_addr = PpuVram(0b001'00'00000'00000);
expected.cycle = 258;
ppu->execute(); // Cycle 257
EXPECT_FALSE(ppu->execute().has_value()); // Cycle 257
EXPECT_EQ(expected, registers);
// Cycle 258-320
@@ -650,7 +657,8 @@ TEST_F(PpuTest, pre_render_scanline) {
expected.vram_addr = PpuVram(0b000'00'00000'00000);
expected.cycle = 321;
for (int i = 258; i <= 320; ++i) {
ppu->execute();
const auto pixel = ppu->execute();
EXPECT_FALSE(pixel.has_value());
}
EXPECT_EQ(expected, registers);
@@ -672,7 +680,8 @@ TEST_F(PpuTest, pre_render_scanline) {
EXPECT_CALL(mmu, read_byte(0x03 * 16u + 8u)).WillOnce(Return(0x99));
for (int i = 321; i <= 336; ++i) {
ppu->execute();
const auto pixel = ppu->execute();
EXPECT_FALSE(pixel.has_value());
}
EXPECT_EQ(expected, registers);
@@ -682,7 +691,8 @@ TEST_F(PpuTest, pre_render_scanline) {
expected.cycle = 0;
EXPECT_CALL(mmu, read_byte(0x2000 + 2)).Times(2).WillRepeatedly(Return(2));
for (int i = 337; i <= 340; ++i) {
ppu->execute();
const auto pixel = ppu->execute();
EXPECT_FALSE(pixel.has_value());
}
EXPECT_EQ(expected, registers);
}