Commit ba2c41da authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers 🍪

add unit test for other two conditions for game over

parent 2b234e74
Pipeline #2190 passed with stages
in 9 minutes and 1 second
......@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## v1.2.4
### Added
- New unit tests to check basic state properties
- New unit tests to check endgame conditions fire correctly
### Fixes
- Fix regression in end of game detection ( issue #23 )
......
......@@ -8,6 +8,41 @@ import com.fossgalaxy.games.fireworks.state.actions.PlayCard;
public class TestBasicState {
/**
* Game logic test: check that initial conditions hold
*/
@Test
public void testCreate() {
GameState state = new BasicState(2);
assertEquals(8, state.getInformation());
assertEquals(3, state.getLives());
assertEquals(2, state.getPlayerCount());
assertEquals(8, state.getStartingInfomation());
assertEquals(3, state.getStartingLives());
assertEquals(0, state.getScore());
}
@Test
public void testNoLivesIsGameOver() {
GameState state = new BasicState(2);
state.setLives(0);
assertEquals(true, state.isGameOver());
}
@Test
public void testPerfectScoreIsGameOver() {
GameState state = new BasicState(2);
for (CardColour colour : CardColour.values()) {
state.setTableValue(colour, 5);
}
assertEquals(25, state.getScore());
assertEquals(true, state.isGameOver());
}
/**
* Game logic test: check the end game plays out correctly
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment