Removed some unnecessary unit tests

This commit is contained in:
simon987 2018-04-02 10:58:24 -04:00
parent 292adb5483
commit 9349ae108b
3 changed files with 1 additions and 79 deletions

View File

@ -3,17 +3,10 @@ package net.simon987.cubotplugin;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class CubotTest {
@Test
public void test(){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
assertEquals(1, 1);
}
}

View File

@ -1,39 +1,6 @@
package net.simon987.server.assembly;
import net.simon987.server.ServerConfiguration;
import net.simon987.server.assembly.exception.CancelledException;
import net.simon987.server.user.User;
import org.junit.Test;
import java.util.Random;
public class CPUTest {
@Test
public void executeInstruction() throws CancelledException {
ServerConfiguration config = new ServerConfiguration("config.properties");
User user = new User();
CPU cpu = new CPU(config, user);
for(int i = 0 ; i < 3 ; i++){
//Execute every possible instruction with random values in memory
cpu.reset();
cpu.getMemory().clear();
Random random = new Random();
byte[] randomBytes = new byte[cpu.getMemory().getWords().length * 2];
random.nextBytes(randomBytes);
for (int machineCode = Character.MIN_VALUE; machineCode < Character.MAX_VALUE; machineCode++) {
Instruction instruction = cpu.getInstructionSet().get(machineCode & 0x03F); // 0000 0000 00XX XXXX
int source = (machineCode >> 11) & 0x001F; // XXXX X000 0000 0000
int destination = (machineCode >> 6) & 0x001F; // 0000 0XXX XX00 0000
cpu.executeInstruction(instruction, source, destination);
}
}
}
}

View File

@ -1,45 +1,7 @@
package net.simon987.server.assembly.instruction;
import net.simon987.server.ServerConfiguration;
import net.simon987.server.assembly.*;
import net.simon987.server.user.User;
import org.junit.Test;
public class CallInstructionTest {
@Test
public void execute() throws Exception {
ServerConfiguration config = new ServerConfiguration("config.properties");
int memorySize = config.getInt("memory_size");
//Memory
Memory memory = new Memory(memorySize);
memory.clear();
//RegisterSet
RegisterSet registerSet = new RegisterSet();
registerSet.put(1, new Register("T1"));
registerSet.put(2, new Register("T2"));
registerSet.clear();
//Status
Status status = new Status();
status.clear();
CPU cpu = new CPU(config, new User());
CallInstruction callInstruction = new CallInstruction(cpu);
//We have to check if IP is 'pushed' correctly (try to pop it), the
}
@Test
public void execute1() throws Exception {
}
}