Cleanup tests
This commit is contained in:
parent
0fea092675
commit
eeac3a69f8
|
@ -70,7 +70,6 @@ class CPU(val memory: Memory) : Display.Callbacks {
|
|||
while (true) {
|
||||
setRandomByte()
|
||||
executeNextInstruction()
|
||||
|
||||
if (PC == 0 || !isRunning) {
|
||||
break
|
||||
}
|
||||
|
@ -111,7 +110,6 @@ class CPU(val memory: Memory) : Display.Callbacks {
|
|||
} else {
|
||||
val candidate = Opcodes.MAP.entries
|
||||
.first { it.value.any { opcode -> opcode == instruction } }
|
||||
|
||||
throw Exception(
|
||||
"Address $${PC.toHexString()} - unknown opcode 0x${instruction.toHexString()} " +
|
||||
"(instruction ${candidate.key.name})")
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package android.emu6502;
|
||||
|
||||
import android.emu6502.instructions.Symbols;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.junit.Before;
|
||||
import android.emu6502.instructions.Symbols;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -15,12 +14,7 @@ import static org.junit.Assert.assertThat;
|
|||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class AssemblerTest {
|
||||
|
||||
private Assembler assembler;
|
||||
|
||||
@Before public void setUp() {
|
||||
assembler = new Assembler(new Memory(mock(Display.class)), new Symbols());
|
||||
}
|
||||
private final Assembler assembler = new Assembler(new Memory(mock(Display.class)), new Symbols());
|
||||
|
||||
@Test public void testSimple() {
|
||||
List<String> lines = ImmutableList.of(
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package android.emu6502;
|
||||
|
||||
import android.emu6502.instructions.Symbols;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.junit.Before;
|
||||
import android.emu6502.instructions.Symbols;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -14,16 +13,9 @@ import static org.junit.Assert.assertThat;
|
|||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class CPUTest {
|
||||
|
||||
private CPU cpu;
|
||||
private Assembler assembler;
|
||||
|
||||
@Before public void setUp() {
|
||||
|
||||
Memory memory = new Memory(mock(Display.class));
|
||||
assembler = new Assembler(memory, new Symbols());
|
||||
cpu = new CPU(memory);
|
||||
}
|
||||
private final Memory memory = new Memory(mock(Display.class));
|
||||
private final Assembler assembler = new Assembler(memory, new Symbols());
|
||||
private final CPU cpu = new CPU(memory);
|
||||
|
||||
@Test public void testSimple() {
|
||||
List<String> lines = ImmutableList.of(
|
||||
|
|
|
@ -2,7 +2,6 @@ package android.emu6502;
|
|||
|
||||
import android.emu6502.instructions.Symbols;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
|
@ -12,15 +11,9 @@ import static org.junit.Assert.assertThat;
|
|||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class LabelsTest {
|
||||
|
||||
private Labels labels;
|
||||
private Assembler assembler;
|
||||
|
||||
@Before public void setUp() {
|
||||
Symbols symbols = new Symbols();
|
||||
assembler = new Assembler(new Memory(mock(Display.class)), symbols);
|
||||
labels = new Labels(assembler, symbols);
|
||||
}
|
||||
private final Symbols symbols = new Symbols();
|
||||
private final Assembler assembler = new Assembler(new Memory(mock(Display.class)), symbols);
|
||||
private final Labels labels = new Labels(assembler, symbols);
|
||||
|
||||
@Test public void testAddLabel() {
|
||||
labels.indexLines(Collections.singletonList("test:"));
|
||||
|
|
Loading…
Reference in New Issue