From 7500d0b170bade07094fc6640afde8ea65d81cdd Mon Sep 17 00:00:00 2001 From: Jiaming Zhang <jiamingz3@student.unimelb.edu.au> Date: Sun, 2 Sep 2018 17:46:56 +1000 Subject: [PATCH] Delete PartitioningTests.java --- test/swen90006/machine/PartitioningTests.java | 139 ------------------ 1 file changed, 139 deletions(-) delete mode 100644 test/swen90006/machine/PartitioningTests.java diff --git a/test/swen90006/machine/PartitioningTests.java b/test/swen90006/machine/PartitioningTests.java deleted file mode 100644 index dc7d9a7..0000000 --- a/test/swen90006/machine/PartitioningTests.java +++ /dev/null @@ -1,139 +0,0 @@ -package swen90006.machine; - -import java.util.List; -import java.util.ArrayList; -import java.nio.charset.Charset; -import java.nio.file.Path; -import java.nio.file.Files; -import java.nio.file.FileSystems; - -import org.junit.*; -import static org.junit.Assert.*; - -public class PartitioningTests -{ - //Any method annotated with "@Before" will be executed before each test, - //allowing the tester to set up some shared resources. - @Before public void setUp() - { - } - - //Any method annotated with "@After" will be executed after each test, - //allowing the tester to release any shared resources used in the setup. - @After public void tearDown() - { - } - - //To test EC5 in Machine. - @Test public void ec5Test() - { - final int expected = 0; - final int actual = Machine.execute("RET R0 R1"); - assertEquals(expected, actual); - } - - //To test EC6 in Machine. - @Test public void ec6Test() - { - final int expected = NoReturnValueException; - final int actual = Machine.execute({“MOV R0 1”, “MOV R1 1”, “ADD R2 R0 R1”}); - assertEquals(expected, actual); - } - - //To test EC7 in Machine. - @Test public void ec7Test() - { - final int expected = 0; - final int actual = Machine.execute({“ADD R2 R0 R1”, “RET R2”}); - assertEquals(expected, actual); - } - - //To test EC8 in Machine. - @Test public void ec8Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“ADD R2 R0 R32”, “RET R2”}); - assertEquals(expected, actual); - } - - //To test EC9 in Machine. - @Test public void ec9Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“ADD R2 R0”, “RET R2”}); - assertEquals(expected, actual); - } - - //To test EC11 in Machine. - @Test public void ec11Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“LDR R2 R0 -1”, “RET R2”}); - assertEquals(expected, actual); - } - - //To test EC13 in Machine. - @Test public void ec13Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“LDR R2 R0 32”, “RET R2”}); - assertEquals(expected, actual); - } - - //To test EC18 in Machine. - @Test public void ec18Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“JMP -65536”, “RET R0”}); - assertEquals(expected, actual); - } - - //To test EC20 in Machine. - @Test public void ec20Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“JMP 65536”, “RET R0”}); - assertEquals(expected, actual); - } - - //To test EC21 in Machine. - @Test public void ec21Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“JMP abc”, “RET R0”}); - assertEquals(expected, actual); - } - - //To test EC22 in Machine. - @Test public void ec22Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“RET R0”, “RET R1”}); - assertEquals(expected, actual); - } - - //To test EC23 in Machine. - @Test public void ec23Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“R0”}); - assertEquals(expected, actual); - } - - //Read in a file containing a program and convert into a list of - //string instructions - private List<String> readInstructions(String file) - { - Charset charset = Charset.forName("UTF-8"); - List<String> lines = null; - try { - lines = Files.readAllLines(FileSystems.getDefault().getPath(file), charset); - } - catch (Exception e){ - System.err.println("Invalid input file! (stacktrace follows)"); - e.printStackTrace(System.err); - System.exit(1); - } - return lines; - } -} -- GitLab