diff --git a/BoundaryTests.java b/BoundaryTests.java deleted file mode 100644 index a1aef89adfc7d43e26f1f0ea4948fe4802991153..0000000000000000000000000000000000000000 --- a/BoundaryTests.java +++ /dev/null @@ -1,117 +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 BoundaryTests -{ - //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() - { - } - - //Any method annotation with "@Test" is executed as a test. - @Test public void aTest() - { - //the assertEquals method used to check whether two values are - //equal, using the equals method - final int expected = 2; - final int actual = 1 + 1; - assertEquals(expected, actual); - } - - //To test B1 in Machine. - @Test public void b1Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute("R0"); - assertEquals(expected, actual); - } - - //To test B5 in Machine. - @Test public void b5Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute("R0"); - assertEquals(expected, actual); - } - - //To test B6 in Machine. - @Test public void b6Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“LDR R2 R0 -1”, “RET R2”}); - assertEquals(expected, actual); - } - - //To test B7 in Machine. - @Test public void b7Test() - { - final int expected = 0; - final int actual = Machine.execute({“LDR R2 R0 1”, “RET R2”}); - assertEquals(expected, actual); - } - - //To test B8 in Machine. - @Test public void b8Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“LDR R2 R0 32”, “RET R2”}); - assertEquals(expected, actual); - } - - //To test B9 in Machine. - @Test public void b9Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“MOV R2 -65536”, “RET R2”}); - assertEquals(expected, actual); - } - - //To test B10 in Machine. - @Test public void b10Test() - { - final int expected = 1; - final int actual = Machine.execute({“MOV R2 1”, “RET R2”}); - assertEquals(expected, actual); - } - - //To test B11 in Machine. - @Test public void b11Test() - { - final int expected = InvalidInstructionException; - final int actual = Machine.execute({“MOV R2 65536”, “RET R2”}); - 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; - } -}