-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
plugins/cpu/ssem-cpu/src/test/java/net/emustudio/plugins/cpu/ssem/DecoderTest.java
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
plugins/cpu/ssem-cpu/src/test/java/net/emustudio/plugins/cpu/ssem/DisassemblerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package net.emustudio.plugins.cpu.ssem; | ||
|
||
import net.emustudio.cpu.testsuite.memory.ByteMemoryStub; | ||
import net.emustudio.emulib.plugins.cpu.DecodedInstruction; | ||
import net.emustudio.emulib.plugins.cpu.DisassembledInstruction; | ||
import net.emustudio.emulib.plugins.cpu.InvalidInstructionException; | ||
import net.emustudio.emulib.runtime.ApplicationApi; | ||
import net.emustudio.emulib.runtime.ContextPool; | ||
import net.emustudio.emulib.runtime.PluginSettings; | ||
import net.emustudio.emulib.runtime.helpers.Bits; | ||
import net.emustudio.emulib.runtime.helpers.NumberUtils; | ||
import org.junit.Test; | ||
|
||
import static net.emustudio.plugins.cpu.ssem.DecoderImpl.LINE; | ||
import static org.easymock.EasyMock.*; | ||
import static org.easymock.EasyMock.replay; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
public class DisassemblerTest { | ||
private final ByteMemoryStub memory = new ByteMemoryStub(NumberUtils.Strategy.LITTLE_ENDIAN); | ||
private final DecoderImpl decoder = new DecoderImpl(memory); | ||
private final DisassemblerImpl disassembler = new DisassemblerImpl(memory, decoder); | ||
|
||
@Test | ||
public void testLDN() { | ||
memory.setMemory(new short[]{ | ||
0x9B, 0xE2, 0xFC, 0x3F | ||
}); | ||
|
||
DisassembledInstruction instr = disassembler.disassemble(0); | ||
assertEquals("LDN 25", instr.getMnemo()); | ||
assertEquals("9B E2 FC 3F", instr.getOpCode()); | ||
} | ||
|
||
@Test | ||
public void testSTO() { | ||
memory.setMemory(new short[]{ | ||
0,0,0,0, | ||
0x68, 0x06, 0x00, 0x00 | ||
}); | ||
|
||
DisassembledInstruction instr = disassembler.disassemble(4); | ||
assertEquals("STO 22", instr.getMnemo()); | ||
assertEquals("68 06 00 00", instr.getOpCode()); | ||
} | ||
} |