Cleanup tests

This commit is contained in:
Felipe Lima 2017-03-07 22:25:59 -08:00
parent 0fea092675
commit eeac3a69f8
4 changed files with 11 additions and 34 deletions

View File

@ -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})")

View File

@ -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(

View File

@ -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(

View File

@ -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:"));