From 5a880d8ac019c9c18ce1169c5044da4aa0c12820 Mon Sep 17 00:00:00 2001
From: shibaoz <shibaoz@student.unimelb.edu.au>
Date: Mon, 3 Sep 2018 16:53:44 +1000
Subject: [PATCH] update

---
 examples/BoundaryTests/EC-14.s                |   2 +-
 examples/BoundaryTests/EC-7.s                 |   4 +-
 examples/PartitioningTests/EC-14.s            |   4 +-
 examples/PartitioningTests/EC-16.s            |   3 +-
 examples/PartitioningTests/EC-7.s             |   8 +-
 test/swen90006/machine/BoundaryTests.java     | 102 ++++++++---------
 test/swen90006/machine/PartitioningTests.java | 104 +++++++++---------
 7 files changed, 114 insertions(+), 113 deletions(-)

diff --git a/examples/BoundaryTests/EC-14.s b/examples/BoundaryTests/EC-14.s
index 970d4c6..9445367 100644
--- a/examples/BoundaryTests/EC-14.s
+++ b/examples/BoundaryTests/EC-14.s
@@ -1,4 +1,4 @@
-MOV R0 65536
+MOV R0 65535
 MOV R1 3
 MOV R2 8
 STR R0 1 R1
diff --git a/examples/BoundaryTests/EC-7.s b/examples/BoundaryTests/EC-7.s
index 9b93069..7f4bfb8 100644
--- a/examples/BoundaryTests/EC-7.s
+++ b/examples/BoundaryTests/EC-7.s
@@ -1,6 +1,6 @@
 MOV R0 0
 MOV R1 2
-MOV R3 3
-MUL R3 R1 R0
+MOV R3 3 
+DIV R3 R1 R0
 RET R3
 ;; 3
\ No newline at end of file
diff --git a/examples/PartitioningTests/EC-14.s b/examples/PartitioningTests/EC-14.s
index 64fee9a..1772954 100644
--- a/examples/PartitioningTests/EC-14.s
+++ b/examples/PartitioningTests/EC-14.s
@@ -1,7 +1,7 @@
 MOV R0 65535
 MOV R1 3
-MOV R2 0
+MOV R2 88
 STR R0 1 R1
 LDR R2 R0 1
 RET R2
-;; 0
\ No newline at end of file
+;; 88
\ No newline at end of file
diff --git a/examples/PartitioningTests/EC-16.s b/examples/PartitioningTests/EC-16.s
index da8f8d3..fba2d88 100644
--- a/examples/PartitioningTests/EC-16.s
+++ b/examples/PartitioningTests/EC-16.s
@@ -1,4 +1,5 @@
 MOV R0 0
 JZ R0 -2
+MOV R0 1
 RET R0
-;; 0
\ No newline at end of file
+;; 1
\ No newline at end of file
diff --git a/examples/PartitioningTests/EC-7.s b/examples/PartitioningTests/EC-7.s
index 81d646f..7f4bfb8 100644
--- a/examples/PartitioningTests/EC-7.s
+++ b/examples/PartitioningTests/EC-7.s
@@ -1,6 +1,6 @@
 MOV R0 0
-MOV R1 1
-MOV R3 0
-MUL R3 R1 R0
+MOV R1 2
+MOV R3 3 
+DIV R3 R1 R0
 RET R3
-;; 0
\ No newline at end of file
+;; 3
\ No newline at end of file
diff --git a/test/swen90006/machine/BoundaryTests.java b/test/swen90006/machine/BoundaryTests.java
index bed7fb4..b7f3d33 100644
--- a/test/swen90006/machine/BoundaryTests.java
+++ b/test/swen90006/machine/BoundaryTests.java
@@ -25,51 +25,51 @@ public class BoundaryTests
   }
 
   //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);
-  }
-
-  @Test public void anotherTest()
-  {
-    List<String> list = new ArrayList<String>();
-    list.add("a");
-    list.add("b");
-
-    //the assertTrue method is used to check whether something holds.
-    assertTrue(list.contains("a"));
-  }
-
-  //Test test opens a file and executes the machine
-  @Test public void aFileOpenTest()
-  {
-    final List<String> lines = readInstructions("examples/array.s");
-    Machine m = new Machine();
-    assertEquals(m.execute(lines), 45);
-  }
+  // @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);
+  // }
+
+  // @Test public void anotherTest()
+  // {
+  //   List<String> list = new ArrayList<String>();
+  //   list.add("a");
+  //   list.add("b");
+
+  //   //the assertTrue method is used to check whether something holds.
+  //   assertTrue(list.contains("a"));
+  // }
+
+  // //Test test opens a file and executes the machine
+  // @Test public void aFileOpenTest()
+  // {
+  //   final List<String> lines = readInstructions("examples/array.s");
+  //   Machine m = new Machine();
+  //   assertEquals(m.execute(lines), 45);
+  // }
   
-  //To test an exception, specify the expected exception after the @Test
-  @Test(expected = java.io.IOException.class) 
-    public void anExceptionTest()
-    throws Throwable
-  {
-    throw new java.io.IOException();
-  }
+  // //To test an exception, specify the expected exception after the @Test
+  // @Test(expected = java.io.IOException.class) 
+  //   public void anExceptionTest()
+  //   throws Throwable
+  // {
+  //   throw new java.io.IOException();
+  // }
 
   //This test should fail.
   //To provide additional feedback when a test fails, an error message
   //can be included
-  @Test public void aFailedTest()
-  {
-    //include a message for better feedback
-    final int expected = 2;
-    final int actual = 1 + 2;
-    assertEquals("Some failure message", expected, actual);
-  }
+  // @Test public void aFailedTest()
+  // {
+  //   //include a message for better feedback
+  //   final int expected = 2;
+  //   final int actual = 1 + 2;
+  //   assertEquals("Some failure message", expected, actual);
+  // }
 
   @Test(expected = swen90006.machine.NoReturnValueException.class) 
   public void EC_1()
@@ -215,12 +215,12 @@ public class BoundaryTests
     assertEquals(m.execute(lines), 0);
   }
 
-  @Test
+  @Test(expected = swen90006.machine.NoReturnValueException.class)
   public void EC_16()
   {
     final List<String> lines = readInstructions("examples/BoundaryTests/EC-16.s");
     Machine m = new Machine();
-    assertEquals(m.execute(lines), 0);
+    m.execute(lines);
   }
 
   @Test
@@ -239,12 +239,12 @@ public class BoundaryTests
     assertEquals(m.execute(lines), 0);
   }
 
-  @Test
+  @Test(expected = swen90006.machine.NoReturnValueException.class)
   public void EC_18()
   {
     final List<String> lines = readInstructions("examples/BoundaryTests/EC-18.s");
     Machine m = new Machine();
-    assertEquals(m.execute(lines), 1);
+    m.execute(lines);
   }
 
   @Test
@@ -255,13 +255,13 @@ public class BoundaryTests
     assertEquals(m.execute(lines), 0);
   }
 
-  @Test(expected = swen90006.machine.NoReturnValueException.class)
-  public void EC_20()
-  {
-    final List<String> lines = readInstructions("examples/BoundaryTests/EC-20.s");
-    Machine m = new Machine();
-    m.execute(lines);
-  }
+  // @Test(expected = swen90006.machine.NoReturnValueException.class)
+  // public void EC_20()
+  // {
+  //   final List<String> lines = readInstructions("examples/BoundaryTests/EC-20.s");
+  //   Machine m = new Machine();
+  //   m.execute(lines);
+  // }
 
   @Test(expected = swen90006.machine.NoReturnValueException.class) 
   public void EC_21()
diff --git a/test/swen90006/machine/PartitioningTests.java b/test/swen90006/machine/PartitioningTests.java
index 9dbabcf..9db1c67 100644
--- a/test/swen90006/machine/PartitioningTests.java
+++ b/test/swen90006/machine/PartitioningTests.java
@@ -5,7 +5,7 @@ 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 java.nio.file.FileSystems; 
 
 import org.junit.*;
 import static org.junit.Assert.*;
@@ -24,52 +24,52 @@ public class PartitioningTests
   {
   }
 
-  //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);
-  }
+  // //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);
+  // }
 
-  @Test public void anotherTest()
-  {
-    List<String> list = new ArrayList<String>();
-    list.add("a");
-    list.add("b");
+  // @Test public void anotherTest()
+  // {
+  //   List<String> list = new ArrayList<String>();
+  //   list.add("a");
+  //   list.add("b");
 
-    //the assertTrue method is used to check whether something holds.
-    assertTrue(list.contains("a"));
-  }
+  //   //the assertTrue method is used to check whether something holds.
+  //   assertTrue(list.contains("a"));
+  // }
 
-  //Test test opens a file and executes the machine
-  @Test public void aFileOpenTest()
-  {
-    final List<String> lines = readInstructions("examples/array.s");
-    Machine m = new Machine();
-    assertEquals(m.execute(lines), 45);
-  }
+  // //Test test opens a file and executes the machine
+  // @Test public void aFileOpenTest()
+  // {
+  //   final List<String> lines = readInstructions("examples/array.s");
+  //   Machine m = new Machine();
+  //   assertEquals(m.execute(lines), 45);
+  // }
   
-  //To test an exception, specify the expected exception after the @Test
-  @Test(expected = java.io.IOException.class) 
-    public void anExceptionTest()
-    throws Throwable
-  {
-    throw new java.io.IOException();
-  }
+  // //To test an exception, specify the expected exception after the @Test
+  // @Test(expected = java.io.IOException.class) 
+  //   public void anExceptionTest()
+  //   throws Throwable
+  // {
+  //   throw new java.io.IOException();
+  // }
 
   //This test should fail.
   //To provide additional feedback when a test fails, an error message
   //can be included
-  @Test public void aFailedTest()
-  {
-    //include a message for better feedback
-    final int expected = 2;
-    final int actual = 1 + 2;
-    assertEquals("Some failure message", expected, actual);
-  }
+  // @Test public void aFailedTest()
+  // {
+  //   //include a message for better feedback
+  //   final int expected = 2;
+  //   final int actual = 1 + 2;
+  //   assertEquals("Some failure message", expected, actual);
+  // }
 
   @Test(expected = swen90006.machine.NoReturnValueException.class) 
   public void EC_1()
@@ -124,7 +124,7 @@ public class PartitioningTests
   {
     final List<String> lines = readInstructions("examples/PartitioningTests/EC-7.s");
     Machine m = new Machine();
-    assertEquals(m.execute(lines), 0);
+    assertEquals(m.execute(lines), 3);
   }
 
   @Test (expected = swen90006.machine.InvalidInstructionException.class) 
@@ -180,7 +180,7 @@ public class PartitioningTests
   {
     final List<String> lines = readInstructions("examples/PartitioningTests/EC-14.s");
     Machine m = new Machine();
-    assertEquals(m.execute(lines), 0);
+    assertEquals(m.execute(lines), 88);
   }
 
   @Test
@@ -191,12 +191,12 @@ public class PartitioningTests
     assertEquals(m.execute(lines), 0);
   }
 
-  @Test
+  @Test(expected = swen90006.machine.NoReturnValueException.class)
   public void EC_16()
   {
     final List<String> lines = readInstructions("examples/PartitioningTests/EC-16.s");
     Machine m = new Machine();
-    assertEquals(m.execute(lines), 0);
+    m.execute(lines);
   }
 
   @Test
@@ -207,12 +207,12 @@ public class PartitioningTests
     assertEquals(m.execute(lines), 0);
   }
 
-  @Test
+  @Test(expected = swen90006.machine.NoReturnValueException.class)
   public void EC_18()
   {
     final List<String> lines = readInstructions("examples/PartitioningTests/EC-18.s");
     Machine m = new Machine();
-    assertEquals(m.execute(lines), 1);
+    m.execute(lines);
   }
 
   @Test
@@ -223,13 +223,13 @@ public class PartitioningTests
     assertEquals(m.execute(lines), 0);
   }
 
-  @Test(expected = swen90006.machine.NoReturnValueException.class)
-  public void EC_20()
-  {
-    final List<String> lines = readInstructions("examples/PartitioningTests/EC-20.s");
-    Machine m = new Machine();
-    m.execute(lines);
-  }
+  // @Test(expected = swen90006.machine.NoReturnValueException.class)
+  // public void EC_20()
+  // {
+  //   final List<String> lines = readInstructions("examples/PartitioningTests/EC-20.s");
+  //   Machine m = new Machine();
+  //   m.execute(lines);
+  // }
 
   @Test(expected = swen90006.machine.NoReturnValueException.class) 
   public void EC_21()
-- 
GitLab