1
0
mirror of https://github.com/ariejan/i6502.git synced 2024-05-28 22:41:34 +00:00
i6502/ram_test.go

24 lines
427 B
Go
Raw Normal View History

2014-08-13 07:26:33 +00:00
package i6502
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestRamSize(t *testing.T) {
ram, _ := NewRam(0x8000) // 32 kB
2014-08-17 14:20:30 +00:00
assert.Equal(t, 0x8000, ram.Size())
2014-08-13 07:26:33 +00:00
}
func TestRamReadWrite(t *testing.T) {
ram, _ := NewRam(0x8000) // 32 kB
// Ram zeroed out initially
for i := 0; i < 0x8000; i++ {
2014-08-17 14:20:30 +00:00
assert.Equal(t, 0x00, ram.data[i])
2014-08-13 07:26:33 +00:00
}
ram.Write(0x1000, 0x42)
2014-08-17 14:20:30 +00:00
assert.Equal(t, 0x42, ram.Read(0x1000))
2014-08-13 07:26:33 +00:00
}