From e9ad256faf524ae68ae5d94a3e8bdae63ea754a3 Mon Sep 17 00:00:00 2001 From: Hongyi Chen <h.chen74@student.unimelb.edu.au> Date: Mon, 17 Sep 2018 13:49:13 +1000 Subject: [PATCH] Replace PartitioningTests.java --- test/swen90006/machine/PartitioningTests.java | 55 +++++++------------ 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/test/swen90006/machine/PartitioningTests.java b/test/swen90006/machine/PartitioningTests.java index 1e4efeb..847d532 100644 --- a/test/swen90006/machine/PartitioningTests.java +++ b/test/swen90006/machine/PartitioningTests.java @@ -25,51 +25,36 @@ 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); - } - @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 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(); - } +// @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 public void TC1TestCase() -- GitLab