diff --git a/src/main/java/edu/unl/cse/soft160/decomposition_and_conditionals/Game.java b/src/main/java/edu/unl/cse/soft160/decomposition_and_conditionals/Game.java index bec60b910478dcda316f064523df88cbfd3a058d..8668d37b37a2e1426bc03e5c8867ae1d5dc07cd6 100755 --- a/src/main/java/edu/unl/cse/soft160/decomposition_and_conditionals/Game.java +++ b/src/main/java/edu/unl/cse/soft160/decomposition_and_conditionals/Game.java @@ -4,12 +4,14 @@ public class Game { private static enum Direction { UP, DOWN, RIGHT, LEFT, } + private static enum Result { WIN, NOT_ALLOWED, NEW_POSITION, } - static final int x_win=7; - static final int y_win=6; - + + static final int x_win = 7; + static final int y_win = 6; + public static void main(String... arguments) { // [write code here] } diff --git a/src/main/java/edu/unl/cse/soft160/decomposition_and_conditionals/Nand.java b/src/main/java/edu/unl/cse/soft160/decomposition_and_conditionals/Nand.java index e07ed759b39acaced8358f45dc113a0b2c5abd26..8322764cc08338aed194c064921304107c213520 100755 --- a/src/main/java/edu/unl/cse/soft160/decomposition_and_conditionals/Nand.java +++ b/src/main/java/edu/unl/cse/soft160/decomposition_and_conditionals/Nand.java @@ -1,6 +1,5 @@ package edu.unl.cse.soft160.decomposition_and_conditionals; - public class Nand { private static enum TruthValue { TRUE, FALSE, UNKNOWN, diff --git a/src/test/java/edu/unl/cse/soft160/decomposition_and_conditionals/GameTest.java b/src/test/java/edu/unl/cse/soft160/decomposition_and_conditionals/GameTest.java index 9209b71602a26e6b1d823283f216c13b53a2599b..03df0980b2f81cc02f3b95708ea13c7b23cd6144 100644 --- a/src/test/java/edu/unl/cse/soft160/decomposition_and_conditionals/GameTest.java +++ b/src/test/java/edu/unl/cse/soft160/decomposition_and_conditionals/GameTest.java @@ -26,7 +26,7 @@ public class GameTest { System.setOut(out); return collector.toString(); } - + @Test public void testUpNotallowed() { assertEquals( @@ -34,7 +34,7 @@ public class GameTest { + "Enter the number of the steps to move: Move result: NOT_ALLOWED"), runMain("6", "7", "Up", "7")); } - + @Test public void testUpWin() { assertEquals( @@ -42,7 +42,7 @@ public class GameTest { + "Enter the number of the steps to move: Move result: WIN"), runMain("7", "3", "Up", "3")); } - + @Test public void testUpNewPosition() { assertEquals( @@ -50,7 +50,7 @@ public class GameTest { + "Enter the number of the steps to move: Move result: NEW_POSITION"), runMain("6", "1", "Up", "7")); } - + @Test public void testDownNotallowed() { assertEquals( @@ -58,7 +58,7 @@ public class GameTest { + "Enter the number of the steps to move: Move result: NOT_ALLOWED"), runMain("6", "3", "Down", "7")); } - + @Test public void testDownWin() { assertEquals( @@ -66,7 +66,7 @@ public class GameTest { + "Enter the number of the steps to move: Move result: WIN"), runMain("7", "8", "Down", "2")); } - + @Test public void testDownNewPosition() { assertEquals( @@ -82,7 +82,7 @@ public class GameTest { + "Enter the number of the steps to move: Move result: NOT_ALLOWED"), runMain("6", "7", "Left", "9")); } - + @Test public void testLeftWin() { assertEquals( @@ -90,7 +90,7 @@ public class GameTest { + "Enter the number of the steps to move: Move result: WIN"), runMain("9", "6", "Left", "2")); } - + @Test public void testLeftNewPosition() { assertEquals( @@ -98,7 +98,7 @@ public class GameTest { + "Enter the number of the steps to move: Move result: NEW_POSITION"), runMain("6", "7", "Left", "3")); } - + @Test public void testRightNotallowed() { assertEquals( @@ -106,7 +106,7 @@ public class GameTest { + "Enter the number of the steps to move: Move result: NOT_ALLOWED"), runMain("6", "7", "Right", "7")); } - + @Test public void testRightWin() { assertEquals( @@ -114,7 +114,7 @@ public class GameTest { + "Enter the number of the steps to move: Move result: WIN"), runMain("6", "6", "Right", "1")); } - + @Test public void testRightNewPosition() { assertEquals( diff --git a/src/test/java/edu/unl/cse/soft160/decomposition_and_conditionals/NandTest.java b/src/test/java/edu/unl/cse/soft160/decomposition_and_conditionals/NandTest.java index 7afcfbf7c234ae45d63b2240ddb8ce669b25791a..156eebc21acd54c1b0af5a32fc8ec064d9aa248f 100644 --- a/src/test/java/edu/unl/cse/soft160/decomposition_and_conditionals/NandTest.java +++ b/src/test/java/edu/unl/cse/soft160/decomposition_and_conditionals/NandTest.java @@ -26,29 +26,29 @@ public class NandTest { System.setOut(out); return collector.toString(); } - - @Test + + @Test public void testTrueTrue() { assertEquals(assemble( "Enter truth value of operand 1: Enter truth value of operand 2: The NAND value of TRUE and TRUE is FALSE."), runMain("TRUE", "TRUE")); } - @Test + @Test public void testTrueFalse() { assertEquals(assemble( "Enter truth value of operand 1: Enter truth value of operand 2: The NAND value of TRUE and FALSE is TRUE."), runMain("TRUE", "FALSE")); } - @Test + @Test public void testFalseTrue() { assertEquals(assemble( "Enter truth value of operand 1: Enter truth value of operand 2: The NAND value of FALSE and TRUE is TRUE."), runMain("FALSE", "TRUE")); } - - @Test + + @Test public void testFalseFalse() { assertEquals(assemble( "Enter truth value of operand 1: Enter truth value of operand 2: The NAND value of FALSE and FALSE is TRUE."), @@ -62,42 +62,42 @@ public class NandTest { runMain("FALSE", "UNKNOWN")); } - @Test + @Test public void testUnknownFalse() { assertEquals(assemble( "Enter truth value of operand 1: Enter truth value of operand 2: The NAND value of UNKNOWN and FALSE is TRUE."), runMain("UNKNOWN", "FALSE")); } - @Test + @Test public void testUnknownUnknown() { assertEquals(assemble( "Enter truth value of operand 1: Enter truth value of operand 2: The NAND value of UNKNOWN and UNKNOWN is UNKNOWN."), runMain("UNKNOWN", "UNKNOWN")); } - @Test + @Test public void testTrueUnknown() { assertEquals(assemble( "Enter truth value of operand 1: Enter truth value of operand 2: The NAND value of TRUE and UNKNOWN is UNKNOWN."), runMain("TRUE", "UNKNOWN")); } - @Test + @Test public void testUnknownTrue() { assertEquals(assemble( "Enter truth value of operand 1: Enter truth value of operand 2: The NAND value of UNKNOWN and TRUE is UNKNOWN."), runMain("UNKNOWN", "TRUE")); } - @Test + @Test public void testExceptionInOp1() { assertEquals(assemble( "Enter truth value of operand 1: Enter truth value of operand 2: Truth value must be one of TRUE, FALSE, or UNKNOWN."), runMain("FOO", "TRUE")); } - - @Test + + @Test public void testExceptionInOp2() { assertEquals(assemble( "Enter truth value of operand 1: Enter truth value of operand 2: Truth value must be one of TRUE, FALSE, or UNKNOWN."),