Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cclp94 committed Feb 27, 2024
1 parent 64a1bd0 commit c4cedd7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions chip8/chip8_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,26 @@ import (
"github.com/cclp94/chip-go/io/keyboard"
)

func testOp(opcode uint16, r1 uint8, r2 uint8) (chip8, [16]uint8) {
func testOp(opcode uint16, r1 uint8, r2 uint8) (chip8, []uint8) {
var mockTimer atomic.Int64
mockDisplayChan := make(chan [][]byte)
mockKeyboard := keyboard.Create()

c := chip8{
memory: make([]byte, 4096),
isLegacy: true,
}
var memory []byte = make([]byte, 4096)
c := chip8{
memory: memory,
pc: 0x200,
registers: make([]uint8, 16),
displayChan: mockDisplayChan,
kb: mockKeyboard,
delayTimer: &mockTimer,
soundTimer: &mockTimer,
isLegacy: true,
}
c.registers[0] = r1
c.registers[1] = r2

c.decodeOpcode(opcode, &mockTimer, &mockTimer, &mockDisplayChan, mockKeyboard)
c.decodeOpcode(opcode)

return c, c.registers
}
Expand Down

0 comments on commit c4cedd7

Please sign in to comment.