mirror of
https://github.com/ariejan/i6502.git
synced 2024-05-28 22:41:34 +00:00
da43c2bca1
Because io.Reader and io.Writer already claim the functions Read and Write it was necessary to rename the Memory interface methods Read and Write to ReadByte and WriteByte.
25 lines
436 B
Go
25 lines
436 B
Go
package i6502
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRamSize(t *testing.T) {
|
|
ram, _ := NewRam(0x8000) // 32 kB
|
|
assert.Equal(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.Equal(t, 0x00, ram.data[i])
|
|
}
|
|
|
|
ram.WriteByte(0x1000, 0x42)
|
|
assert.Equal(t, 0x42, ram.ReadByte(0x1000))
|
|
}
|