Skip to content

Commit

Permalink
test(ppu): Add additional sprite tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Oct 3, 2024
1 parent f075eae commit 6bd07fd
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions test/blargg_ppu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,30 @@ func Test_blarggPPU(t *testing.T) {
sramTests := []struct {
name string
rom string
msgType msgType
wantStatus status
want string
}{
{"open bus", "roms/ppu_open_bus/ppu_open_bus.nes", 0, "ppu_open_bus\n\nPassed"},
{"vbl nmi", "roms/ppu_vbl_nmi/ppu_vbl_nmi.nes", 1, blarggPPUVblNMIWant},
{"open bus", "roms/ppu_open_bus/ppu_open_bus.nes", msgTypeSRAM, 0, "ppu_open_bus\n\nPassed"},
{"vbl nmi", "roms/ppu_vbl_nmi/ppu_vbl_nmi.nes", msgTypeSRAM, 1, blarggPPUVblNMIWant},

{"sprite overflow basics", "roms/sprite_overflow_tests/1.Basics.nes", msgTypePPUVRAM, -1, "SPRITE OVERFLOW BASICS\nPASSED"},
{"sprite overflow details", "roms/sprite_overflow_tests/2.Details.nes", msgTypePPUVRAM, -1, "SPRITE OVERFLOW DETAILS\nPASSED"},
{"sprite overflow timing", "roms/sprite_overflow_tests/3.Timing.nes", msgTypePPUVRAM, -1, "SPRITE OVERFLOW TIMING\nFAILED: #5"},
{"sprite overflow obscure", "roms/sprite_overflow_tests/4.Obscure.nes", msgTypePPUVRAM, -1, "SPRITE OVERFLOW OBSCURE\nFAILED: #2"},
{"sprite overflow emulator", "roms/sprite_overflow_tests/5.Emulator.nes", msgTypePPUVRAM, -1, "SPRITE OVERFLOW EMULATION\nPASSED"},

{"sprite hit basics", "roms/sprite_hit_tests_2005.10.05/01.basics.nes", msgTypePPUVRAM, -1, "SPRITE HIT BASICS\nPASSED"},
{"sprite hit alignment", "roms/sprite_hit_tests_2005.10.05/02.alignment.nes", msgTypePPUVRAM, -1, "SPRITE HIT ALIGNMENT\nPASSED"},
{"sprite hit corners", "roms/sprite_hit_tests_2005.10.05/03.corners.nes", msgTypePPUVRAM, -1, "SPRITE HIT CORNERS\nPASSED"},
{"sprite hit flip", "roms/sprite_hit_tests_2005.10.05/04.flip.nes", msgTypePPUVRAM, -1, "SPRITE HIT FLIPPING\nPASSED"},
{"sprite hit left clip", "roms/sprite_hit_tests_2005.10.05/05.left_clip.nes", msgTypePPUVRAM, -1, "SPRITE HIT LEFT CLIPPING\nPASSED"},
{"sprite hit right edge", "roms/sprite_hit_tests_2005.10.05/06.right_edge.nes", msgTypePPUVRAM, -1, "SPRITE HIT RIGHT EDGE\nPASSED"},
{"sprite hit screen bottom", "roms/sprite_hit_tests_2005.10.05/07.screen_bottom.nes", msgTypePPUVRAM, -1, "SPRITE HIT SCREEN BOTTOM\nPASSED"},
{"sprite hit double height", "roms/sprite_hit_tests_2005.10.05/08.double_height.nes", msgTypePPUVRAM, -1, "SPRITE HIT DOUBLE HEIGHT\nPASSED"},
{"sprite hit timing basics", "roms/sprite_hit_tests_2005.10.05/09.timing_basics.nes", msgTypePPUVRAM, -1, "SPRITE HIT TIMING\nPASSED"},
{"sprite hit timing order", "roms/sprite_hit_tests_2005.10.05/10.timing_order.nes", msgTypePPUVRAM, -1, "SPRITE HIT ORDER\nPASSED"},
{"sprite hit edge timing", "roms/sprite_hit_tests_2005.10.05/11.edge_timing.nes", msgTypePPUVRAM, -1, "SPRITE HIT EDGE TIMING\nPASSED"},
}
for _, tt := range sramTests {
t.Run(tt.name, func(t *testing.T) {
Expand All @@ -35,12 +54,12 @@ func Test_blarggPPU(t *testing.T) {
rom, err := roms.Open(tt.rom)
require.NoError(t, err)

test, err := newBlarggTest(rom, msgTypeSRAM)
test, err := newBlarggTest(rom, tt.msgType)
require.NoError(t, err)

require.NoError(t, test.run())
assert.EqualValues(t, tt.wantStatus, getBlarggStatus(test))
assert.EqualValues(t, tt.want, getBlarggMessage(test, msgTypeSRAM))
assert.EqualValues(t, tt.want, getBlarggMessage(test, tt.msgType))
})
}

Expand All @@ -52,6 +71,7 @@ func Test_blarggPPU(t *testing.T) {
}{
{"palette RAM", "roms/blargg_ppu_tests_2005.09.15b/palette_ram.nes", 17, "$01"},
{"sprite RAM", "roms/blargg_ppu_tests_2005.09.15b/sprite_ram.nes", 17, "$01"},
{"vblank clear time", "roms/blargg_ppu_tests_2005.09.15b/vbl_clear_time.nes", 22, "$01"},
{"vram access", "roms/blargg_ppu_tests_2005.09.15b/vram_access.nes", 17, "$01"},
}
for _, tt := range frameCountTests {
Expand Down

0 comments on commit 6bd07fd

Please sign in to comment.