mirror of
https://github.com/macocianradu/goboy.git
synced 2026-03-18 21:10:07 +00:00
started op table
This commit is contained in:
33
cpu/operations/add_test.go
Normal file
33
cpu/operations/add_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"radu.macocian.me/goboy/memory"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestADD(t *testing.T) {
|
||||
r1 := byte(3)
|
||||
r2 := byte(4)
|
||||
ADD(&r1, &r2)
|
||||
|
||||
expected := byte(7)
|
||||
actual := r1
|
||||
|
||||
if actual != expected {
|
||||
t.Errorf("actual %x != expected %x", actual, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestADDFromMem(t *testing.T) {
|
||||
r1 := byte(3)
|
||||
addr := uint(1000)
|
||||
memory.Write8(addr, byte(6))
|
||||
ADDFromMem(&r1, addr)
|
||||
|
||||
expected := byte(9)
|
||||
actual := r1
|
||||
|
||||
if actual != expected {
|
||||
t.Errorf("actual %x != expected %x", actual, expected)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user