1
0
mirror of https://github.com/ariejan/i6502.git synced 2024-06-11 08:29:35 +00:00
i6502/ram_test.go
Ariejan de Vroom 8bf1e629e6 Update testify assert methods
`assert.Equal` now tests for type equality as well, which means
256 != 0xff. The alternative is to use `assert.EqualValues`
2015-04-09 09:20:04 +02:00

29 lines
542 B
Go

package i6502
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRamAsMemory(t *testing.T) {
assert.Implements(t, (*Memory)(nil), new(Ram))
}
func TestRamSize(t *testing.T) {
ram, _ := NewRam(0x8000) // 32 kB
assert.EqualValues(t, 0x8000, ram.Size())
}
func TestRamReadWrite(t *testing.T) {
ram, _ := NewRam(0x8000) // 32 kB
// Ram zeroed out initially
for i := 0; i < 0x8000; i++ {
assert.EqualValues(t, 0x00, ram.data[i])
}
ram.WriteByte(0x1000, 0x42)
assert.EqualValues(t, 0x42, ram.ReadByte(0x1000))
}