go_chip8/emulator/chip8_test.go

22 lines
411 B
Go

package emulator
import (
"testing"
)
func TestLoadRomIntoMemory(t *testing.T) {
chip8 := NewChip8()
romBytes := []byte{0xDE, 0xAD, 0xBE, 0xEF}
_ = chip8.LoadROMIntoMemory(romBytes)
// We always expect roms to be loaded starting from 0x200
ans := chip8.memory[0x200:0x204]
for i, ansByte := range ans {
if romBytes[i] != ansByte {
t.Errorf("Expected %x, got %x", romBytes[i], ansByte)
}
}
}