@Test public void testWriteByte() { byte[] ramData = new byte[] {0, 0}; RandomAccessMemory ram = new RandomAccessMemory("TestRam", 01000, ramData); ram.write(true, 01000, 1); assertEquals(1, ram.read(false, 01000)); ram.write(true, 01001, 0377); assertEquals((0377 << 8) + 1, ram.read(false, 01000)); ram.write(true, 01001, 0177777); assertEquals((0377 << 8) + 1, ram.read(false, 01000)); }
@Test public void testWriteWord() { short[] ramData = new short[] {0, 0}; RandomAccessMemory ram = new RandomAccessMemory("TestRam", 01000, ramData); ram.write(false, 01000, 0377); assertEquals(0377, ram.read(false, 01000)); ram.write(false, 01001, 0377); assertEquals(0377, ram.read(false, 01000)); ram.write(false, 01002, 0177777); assertEquals(0177777, ram.read(false, 01002)); ram.write(false, 01003, 0177777); assertEquals(0177777, ram.read(false, 01002)); ram.write(false, 01002, 01777777); assertEquals(0177777, ram.read(false, 01002)); }