-
Notifications
You must be signed in to change notification settings - Fork 1
/
LogicTest.java
56 lines (44 loc) · 1.76 KB
/
LogicTest.java
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
48
49
50
51
52
53
54
55
56
package de.ktran.anno1404warenrechner.data;
import org.junit.Test;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
public class LogicTest {
@Test
public void testPopulationCalculationsOccidental() throws Exception {
final Game game = Game.newGame(0, "");
final Logic logic = new Logic(game);
for (int total = 0; total < 5000; total++) {
final Map<PopulationType, Integer> res = logic.calculateAscensionRightsOccidental(total, 3);
int sum = 0;
for (Map.Entry<PopulationType, Integer> e : res.entrySet()) {
assertTrue(e.getValue() >= 0);
sum += e.getValue();
}
assertTrue(total == sum);
}
}
@Test
public void testPopulationCalculationsOriental() throws Exception {
final Game game = Game.newGame(0, "");
final Logic logic = new Logic(game);
for (int total = 0; total < 5000; total++) {
final Map<PopulationType, Integer> res = logic.calculateAscensionRightsOriental(total, 1);
int sum = 0;
for (Map.Entry<PopulationType, Integer> e : res.entrySet()) {
assertTrue(e.getValue() >= 0);
sum += e.getValue();
System.out.println(e.getKey().name() + ": " + e.getValue());
}
assertTrue(total == sum);
}
}
@Test
public void testChainDependencies() throws Exception {
final Game game = Game.newGame(0, "");
game.setOtherGoods(ProductionBuilding.TOOLMAKERS_WORKSHOP, 1);
final Logic logic = new Logic(game);
List<BuildingAlternative> res = logic.calculateChainWithDependencies(Goods.TOOLS);
System.out.println(res.toString());
}
}