Skip to content

Commit

Permalink
Merge pull request #66 from binarytrails/nalveer/Iteration2
Browse files Browse the repository at this point in the history
Nalveer/iteration2
  • Loading branch information
binarytrails committed Mar 16, 2020
2 parents cf8f747 + 53aa7f8 commit 6cf9dee
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/kakuro/TestGameDifficulty.java
Original file line number Diff line number Diff line change
@@ -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(mediumGame);
int three = GameDifficulty.GameDifficultyToInt(hardGame);

//Assert
assertEquals(one, 1);
assertEquals(two, 2);
assertEquals(three, 3);

}



}
78 changes: 78 additions & 0 deletions tests/kakuro/TestGameDifficultyListItem.java
Original file line number Diff line number Diff line change
@@ -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);


}








}

0 comments on commit 6cf9dee

Please sign in to comment.