Added Klaus Dormann's tests

This commit is contained in:
Seth Morabito committed 2014-08-10 16:52:20 -07:00
1 parent 36615fc70b
commit 59c6d8e23b
7 files changed
+25333 -19

No files matched your search

+9 -13
View File
@@ -58,8 +58,8 @@ public class Main {
}
}
while(true) {
if(machineClass == null) {
while (true) {
if (machineClass == null) {
Object[] possibilities = {"Symon", "Multicomp", "Simple"};
String s = (String)JOptionPane.showInputDialog(
null,
@@ -71,14 +71,12 @@ public class Main {
"Symon");
if (s != null) {
if (s.equals("Multicomp")) {
machineClass = MulticompMachine.class;
} else if (s.equals("Simple")) {
machineClass = SimpleMachine.class;
} else {
machineClass = SymonMachine.class;
}
if (s != null && s.equals("Multicomp")) {
machineClass = MulticompMachine.class;
} else if (s != null && s.equals("Simple")) {
machineClass = SimpleMachine.class;
} else {
machineClass = SymonMachine.class;
}
}
@@ -98,13 +96,11 @@ public class Main {
Simulator.MAIN_CMD cmd = simulator.waitForCommand();
if(cmd.equals(Simulator.MAIN_CMD.SELECTMACHINE)) {
if (cmd.equals(Simulator.MAIN_CMD.SELECTMACHINE)) {
machineClass = null;
} else {
break;
}
}
}
}
@@ -487,7 +487,11 @@ public class Simulator {
long fileSize = f.length();
if (fileSize > machine.getMemorySize()) {
throw new IOException("Program will not fit in available memory.");
throw new IOException("Program of size $" +
Integer.toString((int)fileSize, 16) +
" will not fit in available memory of size $" +
Integer.toString(machine.getMemorySize(), 16) +
".");
} else {
byte[] program = new byte[(int) fileSize];
int i = 0;
@@ -572,8 +576,6 @@ public class Simulator {
}
class SelectMachineAction extends AbstractAction {
Simulator simulator;
public SelectMachineAction() {
super("Switch emulated machine...", null);
putValue(SHORT_DESCRIPTION, "Select the type of the machine to be emulated");