|
9 | 9 | import java.util.ArrayList; |
10 | 10 | import java.util.List; |
11 | 11 |
|
| 12 | +import static hotciv.framework.GameConstants.WINNER_FOUND; |
12 | 13 | import static org.hamcrest.CoreMatchers.*; |
13 | 14 | import static org.junit.Assert.assertThat; |
14 | 15 |
|
@@ -73,24 +74,86 @@ public void gameStartIs4000BC() { |
73 | 74 | } |
74 | 75 |
|
75 | 76 | @Test |
76 | | - public void progress100YearsEveryTurn() { |
| 77 | + public void alphaCiv_Progress100YearsEveryTurn() { |
77 | 78 | int turn1 = game.getAge(); |
78 | 79 | game.endOfTurn(); |
79 | 80 | int turn2 = game.getAge(); |
80 | 81 |
|
81 | 82 | assertThat((turn2 - turn1), is(100)); |
82 | 83 | } |
83 | 84 |
|
| 85 | + @Test |
| 86 | + public void betaCiv_DynamicWorldAging() { |
| 87 | + |
| 88 | + // 100 Years per turn pre- 100BC |
| 89 | + for (int i = 0; i < 38; i++){ |
| 90 | + game.endOfTurn(); |
| 91 | + } |
| 92 | + assertThat(game.getAge(), is(-100)); |
| 93 | + |
| 94 | + // Next turn is 1BC |
| 95 | + game.endOfTurn(); |
| 96 | + assertThat(game.getAge(), is(-1)); |
| 97 | + |
| 98 | + // Next turn is 1AD |
| 99 | + game.endOfTurn(); |
| 100 | + assertThat(game.getAge(), is(1)); |
| 101 | + |
| 102 | + // Next turn is 50AD |
| 103 | + game.endOfTurn(); |
| 104 | + assertThat(game.getAge(), is(50)); |
| 105 | + |
| 106 | + |
| 107 | + // 50 years per turn until 1750 |
| 108 | + for (int j = 0; j < 33; j++) { |
| 109 | + game.endOfTurn(); |
| 110 | + } |
| 111 | + assertThat(game.getAge(), is(1750)); |
| 112 | + |
| 113 | + // 25 years per turn until 1900 |
| 114 | + for (int h = 0; h < 5; h++) { |
| 115 | + game.endOfTurn(); |
| 116 | + } |
| 117 | + assertThat(game.getAge(), is(1900)); |
| 118 | + |
| 119 | + // 5 years per turn until 1970 |
| 120 | + for (int k = 0; k < 34; k++) { |
| 121 | + game.endOfTurn(); |
| 122 | + } |
| 123 | + assertThat(game.getAge(), is(1970)); |
| 124 | + |
| 125 | + // 1 year per turn for the rest of the game |
| 126 | + for (int m = 0; m < 99; m++) { |
| 127 | + game.endOfTurn(); |
| 128 | + } |
| 129 | + assertThat(game.getAge(), is(2070)); |
| 130 | + } |
| 131 | + |
84 | 132 |
|
85 | 133 | @Test |
86 | | - public void redWinsIf3000BC() { |
| 134 | + public void alphaCiv_RedWinsIf3000BC() { |
87 | 135 | for (int i = 0; i < 10; i++) { |
88 | 136 | game.endOfTurn(); |
89 | 137 | } |
90 | 138 | assertThat(game.getAge(), is(-3000)); |
91 | 139 | assertThat(game.getWinner(), is(Player.RED)); |
92 | 140 | } |
93 | 141 |
|
| 142 | + @Test |
| 143 | + public void betaCiv_FirstPlayerThatConquersWorldWins() { |
| 144 | + Position city1 = new Position(1,1); |
| 145 | + Position city2 = new Position(1,4); |
| 146 | + |
| 147 | + game.setCityAt(city1, Player.BLUE); |
| 148 | + |
| 149 | + assertThat(game.getWinner(), is(Player.BLUE)); // Blue owns both cities and should win |
| 150 | + |
| 151 | + game.setCityAt(city1, Player.RED); |
| 152 | + game.setCityAt(city2, Player.RED); |
| 153 | + |
| 154 | + assertThat(game.getWinner(), is(Player.BLUE)); // Blue already won the game, so they remain the winner. |
| 155 | + } |
| 156 | + |
94 | 157 | @Test //TPD |
95 | 158 | public void attackingUnitAlwaysWins(){ |
96 | 159 | Position posArcher = new Position(0, 2); //Attacker |
|
0 commit comments