diff --git a/build.xml b/build.xml index 658996f9b1fa3d00605af37f0e167f0d8411ef3d..3386c319dad02083216b12f68d6040238a433e7a 100644 --- a/build.xml +++ b/build.xml @@ -16,28 +16,35 @@ </target> <target name="partitioning" depends="classes"> - <junit printsummary="yes" fork="yes" haltonfailure="yes"> - <classpath> - <pathelement path="classes/"/> - <pathelement path="lib/junit-4.11.jar"/> - <pathelement path="lib/hamcrest-core-1.3.jar"/> - </classpath> - <formatter type="plain"/> - <test name="swen90006.machine.PartitioningTests"/> - </junit> + <parallel threadCount="1" timeout="5000"> + <sequential> + <junit printsummary="yes" fork="yes" haltonfailure="yes"> + <classpath> + <pathelement path="classes/"/> + <pathelement path="lib/junit-4.11.jar"/> + <pathelement path="lib/hamcrest-core-1.3.jar"/> + </classpath> + <formatter type="plain"/> + <test name="swen90006.machine.PartitioningTests"/> + </junit> + </sequential> + </parallel> </target> - <target name="boundary" depends="classes"> - <junit printsummary="yes" fork="yes" haltonfailure="yes"> - <classpath> - <pathelement path="classes/"/> - <pathelement path="lib/junit-4.11.jar"/> - <pathelement path="lib/hamcrest-core-1.3.jar"/> - </classpath> - <formatter type="plain"/> - <test name="swen90006.machine.BoundaryTests"/> - </junit> + <target name="boundary" depends="classes"> + <parallel threadCount="1" timeout="5000"> + <sequential> + <junit printsummary="yes" fork="yes" haltonfailure="yes"> + <classpath> + <pathelement path="classes/"/> + <pathelement path="lib/junit-4.11.jar"/> + <pathelement path="lib/hamcrest-core-1.3.jar"/> + </classpath> + <formatter type="plain"/> + <test name="swen90006.machine.BoundaryTests"/> + </junit> + </sequential> + </parallel> </target> - </project> diff --git a/classes/swen90006/machine/BoundaryTests.class b/classes/swen90006/machine/BoundaryTests.class index 75ca15dbf4f906cd2b7beec235fa91a8de079579..5de9d64622916194eb3374e519052f1cbdc4b160 100644 Binary files a/classes/swen90006/machine/BoundaryTests.class and b/classes/swen90006/machine/BoundaryTests.class differ diff --git a/classes/swen90006/machine/BugException.class b/classes/swen90006/machine/BugException.class index f118d84a4f1eb3cda19ec8de216e3dc339d6090c..8ec803fc103ba36c5d6d192e2a60d3cdcc09c5d2 100644 Binary files a/classes/swen90006/machine/BugException.class and b/classes/swen90006/machine/BugException.class differ diff --git a/classes/swen90006/machine/InvalidInstructionException.class b/classes/swen90006/machine/InvalidInstructionException.class index b825f28f0bae9bc7d1352fc96ae041000ea4a729..b3f25d4547b9f1e25ba7bd67083bf90255f76e6c 100644 Binary files a/classes/swen90006/machine/InvalidInstructionException.class and b/classes/swen90006/machine/InvalidInstructionException.class differ diff --git a/classes/swen90006/machine/Machine.class b/classes/swen90006/machine/Machine.class index bc67cdff3d66160515599de443f4aea563326bac..e06c46bfae2c3ecc1f099f913ef298b643eb2afc 100644 Binary files a/classes/swen90006/machine/Machine.class and b/classes/swen90006/machine/Machine.class differ diff --git a/classes/swen90006/machine/NoReturnValueException.class b/classes/swen90006/machine/NoReturnValueException.class index 8e5254e009b57eb2894b9bb735e33962cd163259..dccdbed2d7ed8229a93d01ac2be229f43c10e792 100644 Binary files a/classes/swen90006/machine/NoReturnValueException.class and b/classes/swen90006/machine/NoReturnValueException.class differ diff --git a/classes/swen90006/machine/PartitioningTests.class b/classes/swen90006/machine/PartitioningTests.class index af52566636122d3ab4edeca3dfd4fb3e867aa1db..1956a4b569518fd62c2163fb19c998dccf2e5f65 100644 Binary files a/classes/swen90006/machine/PartitioningTests.class and b/classes/swen90006/machine/PartitioningTests.class differ diff --git a/classes/swen90006/machine/SimpleDriver.class b/classes/swen90006/machine/SimpleDriver.class index e2898a8d0db987dacaa7428260b0686b6d57b7e3..8005196bd7d3f94b52b969d55fc6d13d97071a75 100644 Binary files a/classes/swen90006/machine/SimpleDriver.class and b/classes/swen90006/machine/SimpleDriver.class differ diff --git a/examples/array.s b/examples/array.s index 54b5878259fee8b451aebed898ebd70cda25caa0..976f5379890161e8556b1e41150a6c1e9361b578 100644 --- a/examples/array.s +++ b/examples/array.s @@ -29,7 +29,8 @@ MOV R1 0 ; i = 0; MOV R0 100 MOV R5 0 ; sum = 0; - + ;RET R5 + SUB R4 R3 R1 ; while(i != N) JZ R4 6 ; { LDR R4 R0 0 ; diff --git a/mutants/mutant-1/swen90006/machine/BugException.java b/mutants/mutant-1/swen90006/machine/BugException.java index 41cb9cab9f4bb06efde089f190abc13331b00b21..8c55483ec28ddd9ddf378378760bf6a6baf19be7 100644 --- a/mutants/mutant-1/swen90006/machine/BugException.java +++ b/mutants/mutant-1/swen90006/machine/BugException.java @@ -1,7 +1,7 @@ -package swen90006.machine; - -public class BugException extends Exception { - public BugException(String msg){ - super("You triggered one of the security bugs!\n" + msg); - } -} +package swen90006.machine; + +public class BugException extends Exception { + public BugException(String msg){ + super("You triggered one of the security bugs!\n" + msg); + } +} diff --git a/test/swen90006/machine/BoundaryTests.java b/test/swen90006/machine/BoundaryTests.java index 61ce1ca647f325fbf452047408c1e22d9befcb99..21063993f05be95f4b49a747e36ba2819bc9bad5 100644 --- a/test/swen90006/machine/BoundaryTests.java +++ b/test/swen90006/machine/BoundaryTests.java @@ -47,7 +47,7 @@ public class BoundaryTests //Test test opens a file and executes the machine @Test public void aFileOpenTest() { - final List<String> lines = readInstructions("examples/array.s"); + final List<String> lines = readInstructions("C:\\Users\\ASUS\\git\\SWEN90006-A1-2018\\examples\\array.s"); Machine m = new Machine(); assertEquals(m.execute(lines), 45); } @@ -71,6 +71,29 @@ public class BoundaryTests assertEquals("Some failure message", expected, actual); } + @Test(expected = InvalidInstructionException.class) +public void InvalidInstructions() { + final List<String> lines = readInstructions("C:\\Users\\ASUS\\git\\SWEN90006-A1-2018\\examples\\array_copy.s"); + Machine m = new Machine(); + m.execute(lines); + } + + @Test public void MultipuleRuternTest() { + final List<String> lines = readInstructions("C:\\Users\\ASUS\\git\\SWEN90006-A1-2018\\examples\\multiReturn.s"); + Machine m = new Machine(); + int val = m.execute(lines); + + assertEquals(val, 0); + } + + @Test public void NotExcuteWrongInstructions() { + final List<String> lines = readInstructions("C:\\Users\\ASUS\\git\\SWEN90006-A1-2018\\examples\\div_test.s"); + Machine m = new Machine(); + int val = m.execute(lines); + + assertEquals(val, 100); + } + //Read in a file containing a program and convert into a list of //string instructions private List<String> readInstructions(String file)