summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/model/GameStateTest.java
blob: 8f311a6e9b7b6ea786887f3e53bbbd4eb5f2a93f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package jrummikub.model;

import static org.junit.Assert.*;

import java.util.Arrays;

import org.junit.Test;

public class GameStateTest {
	GameState gameState = new GameState();

	@Test
	public void testAccumulatedScore() {
		Score score1 = new Score(Arrays.asList(true, false, false), Arrays.asList(
				30, -20, -10));
		Score score2 = new Score(Arrays.asList(true, true, false), Arrays.asList(
				-10, -10, -50));
		Score score3 = new Score(Arrays.asList(false, false, true), Arrays.asList(
				-30, -20, 50));
		Score score4 = new Score(Arrays.asList(false, true, false), Arrays.asList(
				-20, -10, -30));

		gameState.getScores().addAll(Arrays.asList(score1, score2, score3, score4));

		Score accum = gameState.getAccumulatedScore();
		assertEquals(Arrays.asList(true, false, false), accum.getWinners());
		assertEquals(Arrays.asList(-30, -60, -40), accum.getPoints());
	}

	@Test
	public void testAccumulatedScoreDraw() {
		Score score1 = new Score(Arrays.asList(true, false, false), Arrays.asList(
				10, -10, -5));
		Score score2 = new Score(Arrays.asList(true, true, false), Arrays.asList(
				-10, -10, -50));
		Score score3 = new Score(Arrays.asList(false, false, true), Arrays.asList(
				-20, -10, 30));
		Score score4 = new Score(Arrays.asList(false, true, false), Arrays.asList(
				-20, -10, -30));

		gameState.getScores().addAll(Arrays.asList(score1, score2, score3, score4));

		Score accum = gameState.getAccumulatedScore();
		assertEquals(Arrays.asList(true, true, false), accum.getWinners());
		assertEquals(Arrays.asList(-40, -40, -55), accum.getPoints());
	}
}