From a897661f4f9aaf4f91e7f778e4805e2b5a23bc82 Mon Sep 17 00:00:00 2001 From: Nalveer <55257682+Nalveer@users.noreply.github.com> Date: Sun, 15 Mar 2020 19:52:09 -0400 Subject: [PATCH 1/3] Create TestGameDifficulty.java --- tests/kakuro/TestGameDifficulty.java | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/kakuro/TestGameDifficulty.java diff --git a/tests/kakuro/TestGameDifficulty.java b/tests/kakuro/TestGameDifficulty.java new file mode 100644 index 0000000..d2f3d04 --- /dev/null +++ b/tests/kakuro/TestGameDifficulty.java @@ -0,0 +1,36 @@ + +// @author Nalveer Moocheet +// @brief Test for the Game Difficulty + +package kakuro; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import kakuro.core.GameDifficulty; + +public class TestGameDifficulty { + + // This method tests if the corresponding integer of a difficulty level is correct + @Test + public void testGameDifficultyToInt() { + + //Arrange + GameDifficulty easyGame = GameDifficulty.EASY; + GameDifficulty mediumGame = GameDifficulty.MEDIUM; + GameDifficulty hardGame = GameDifficulty.DIFFICULT; + + //Act + int one = GameDifficulty.GameDifficultyToInt(easyGame); + int two = GameDifficulty.GameDifficultyToInt(easyGame); + int three = GameDifficulty.GameDifficultyToInt(easyGame); + + //Assert + assertEquals(one, 1); + assertEquals(two, 2); + assertEquals(three, 3); + + } + + + +} From 589c300adcce2a0d5919cd8975b61f48a004c09d Mon Sep 17 00:00:00 2001 From: Nalveer <55257682+Nalveer@users.noreply.github.com> Date: Sun, 15 Mar 2020 19:54:18 -0400 Subject: [PATCH 2/3] Update TestGameDifficulty.java --- tests/kakuro/TestGameDifficulty.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/kakuro/TestGameDifficulty.java b/tests/kakuro/TestGameDifficulty.java index d2f3d04..2a01ab6 100644 --- a/tests/kakuro/TestGameDifficulty.java +++ b/tests/kakuro/TestGameDifficulty.java @@ -21,8 +21,8 @@ public void testGameDifficultyToInt() { //Act int one = GameDifficulty.GameDifficultyToInt(easyGame); - int two = GameDifficulty.GameDifficultyToInt(easyGame); - int three = GameDifficulty.GameDifficultyToInt(easyGame); + int two = GameDifficulty.GameDifficultyToInt(mediumGame); + int three = GameDifficulty.GameDifficultyToInt(hardGame); //Assert assertEquals(one, 1); From 53aa7f816cd17855d00d1996db7bae434d5ee9a0 Mon Sep 17 00:00:00 2001 From: Nalveer <55257682+Nalveer@users.noreply.github.com> Date: Sun, 15 Mar 2020 20:12:42 -0400 Subject: [PATCH 3/3] Create TestGameDifficultyListItem.java --- tests/kakuro/TestGameDifficultyListItem.java | 78 ++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 tests/kakuro/TestGameDifficultyListItem.java diff --git a/tests/kakuro/TestGameDifficultyListItem.java b/tests/kakuro/TestGameDifficultyListItem.java new file mode 100644 index 0000000..66eedd6 --- /dev/null +++ b/tests/kakuro/TestGameDifficultyListItem.java @@ -0,0 +1,78 @@ +package kakuro; + +//@author Nalveer Moocheet +//@brief Test for the GameDifficultyListItem + + + import static org.junit.Assert.assertEquals; + import org.junit.Test; + import kakuro.core.GameDifficulty; + import kakuro.core.GameDifficultyListItem; + + + public class TestGameDifficultyListItem { + + + //this function tests the constructor of GameDifficultyListItem + @Test + public void testConstructorOfTestGameDifficultyListItem() { + + //Arrange + String description = "Difficult Game"; + GameDifficulty gameDiff = GameDifficulty.DIFFICULT; + + //Act + GameDifficultyListItem obj = new GameDifficultyListItem(description,gameDiff); + + //Assert + assertEquals(obj.getDifficulty(),gameDiff); + assertEquals(obj.toString(),description); + + + + } + + //this function test the toString method + @Test + public void testToString() { + + //Arrange + String description = "Easy Game"; + GameDifficulty gameDiff = GameDifficulty.EASY; + GameDifficultyListItem obj = new GameDifficultyListItem(description,gameDiff); + + //Act + String toString = obj.toString(); + + //Assert + assertEquals(toString, description); + + + } + + //this function tests the getDifficulty method + @Test + public void testGetDifficulty() { + + //Arrange + String description = "Medium Game"; + GameDifficulty gameDiff = GameDifficulty.MEDIUM; + GameDifficultyListItem obj = new GameDifficultyListItem(description,gameDiff); + + //Act + GameDifficulty difficulty= obj.getDifficulty(); + + //Assert + assertEquals(difficulty, gameDiff); + + + } + + + + + + + + + }