|
8 | 8 | #include "UnitTest++.h" |
9 | 9 | #include "Player.h" |
10 | 10 | #include "GameBoard.h" |
| 11 | +#include "DevelopmentCard.h" |
11 | 12 |
|
12 | 13 |
|
13 | 14 | /** |
@@ -230,11 +231,140 @@ TEST(Buy_DevCard_False){ |
230 | 231 |
|
231 | 232 |
|
232 | 233 | //INSERT VICTORY POINT TESTS HERE |
| 234 | +TEST(UpdateVictoryPoints_Settlements){ |
| 235 | + GameBoard test_board({"tester"}); |
| 236 | + Player& test_player = test_board.getPlayer(0); |
233 | 237 |
|
| 238 | + CHECK(test_player.getVictoryPoints() == 0); |
234 | 239 |
|
235 | | -//INSERT DEV CARD TESTS HERE |
| 240 | + Coordinate start1(0,0); |
| 241 | + test_board.PlaceSettlement(start1, test_player); |
236 | 242 |
|
| 243 | + CHECK(test_player.getVictoryPoints() == 1); |
| 244 | +} |
| 245 | + |
| 246 | +TEST(UpdateVictoryPoints_cities){ |
| 247 | + GameBoard test_board({"tester"}); |
| 248 | + Player& test_player = test_board.getPlayer(0); |
| 249 | + |
| 250 | + CHECK(test_player.getVictoryPoints() == 0); |
| 251 | + |
| 252 | + Coordinate start1(0,0); |
| 253 | + test_board.PlaceSettlement(start1, test_player); |
| 254 | + |
| 255 | + CHECK(test_player.getVictoryPoints() == 1); |
| 256 | + |
| 257 | + test_board.UpgradeSettlement(start1); |
| 258 | + CHECK(test_player.getVictoryPoints() == 2); |
| 259 | +} |
| 260 | + |
| 261 | +TEST(UpdateVictoryPoints_longestRoad){ |
| 262 | + GameBoard test_board({"tester"}); |
| 263 | + Player& test_player = test_board.getPlayer(0); |
| 264 | + |
| 265 | + CHECK(test_player.getVictoryPoints() == 0); |
237 | 266 |
|
238 | | -//INSERT TRADING TESTS HERE |
| 267 | + Coordinate start1(0,0); |
| 268 | + test_board.PlaceSettlement(start1, test_player); |
239 | 269 |
|
| 270 | + CHECK(test_player.getVictoryPoints() == 1); |
| 271 | + |
| 272 | + test_board.PlaceRoad(start1, Coordinate(-1,1), test_player); |
| 273 | + test_board.PlaceRoad(Coordinate(-1,1), Coordinate(-1,2), test_player); |
| 274 | + test_board.PlaceRoad(Coordinate(-1,2), Coordinate(0,2), test_player); |
| 275 | + test_board.PlaceRoad(Coordinate(0,2), Coordinate(0,3), test_player); |
| 276 | + test_board.PlaceRoad(Coordinate(0,3), Coordinate(1,3), test_player); |
| 277 | + |
| 278 | + CHECK(test_player.getVictoryPoints() == 3); |
| 279 | +} |
| 280 | + |
| 281 | +TEST(UpdateVictoryPoints_VictoryCards){ |
| 282 | + GameBoard test_board({"tester"}); |
| 283 | + Player& test_player = test_board.getPlayer(0); |
| 284 | + |
| 285 | + CHECK(test_player.getVictoryPoints() == 0); |
| 286 | + CHECK(test_player.getVictoryPointsWithoutCards() == 0); |
| 287 | + |
| 288 | + std::unique_ptr<DevelopmentCard> test_VictoryCard = std::unique_ptr<DevelopmentCard>(new VictoryPointCard()); |
| 289 | + test_player.addOre(1); |
| 290 | + test_player.addWheat(1); |
| 291 | + test_player.addWool(1); |
| 292 | + |
| 293 | + test_player.buyCard(test_VictoryCard); |
| 294 | + CHECK(test_player.getVictoryPoints() == 1); |
| 295 | + CHECK(test_player.getVictoryPointsWithoutCards() == 0); |
| 296 | +} |
| 297 | + |
| 298 | +TEST(UpdateVictoryPoints_LargestArmy){ |
| 299 | + GameBoard test_board({"tester1", "tester2"}); |
| 300 | + Player& test_player = test_board.getPlayer(0); |
| 301 | + Player& opponent = test_board.getPlayer(1); |
| 302 | + |
| 303 | + CHECK(test_player.getVictoryPoints() == 0); |
| 304 | + |
| 305 | + test_player.addOre(3); |
| 306 | + test_player.addWheat(3); |
| 307 | + test_player.addWool(3); |
| 308 | + |
| 309 | + std::unique_ptr<DevelopmentCard> test_KnightCard = std::unique_ptr<DevelopmentCard>(new KnightCard()); |
| 310 | + test_player.buyCard(test_KnightCard); |
| 311 | + test_player.buyCard(test_KnightCard); |
| 312 | + test_player.buyCard(test_KnightCard); |
| 313 | + |
| 314 | + test_board.PlaceSettlement(Coordinate(0,0), opponent); |
| 315 | +// WILL NOT WORK UNTIL THE KNIGHT WORKS |
| 316 | +// test_player.playKnight(Coordinate(0,1), opponent); |
| 317 | +// test_player.playKnight(Coordinate(0,1), opponent); |
| 318 | +// test_player.playKnight(Coordinate(0,1), opponent); |
| 319 | +// |
| 320 | +// CHECK(test_player.getVictoryPoints() == 2); |
| 321 | +} |
| 322 | + |
| 323 | +TEST(UpdateVictoryPoints_all){ |
| 324 | + GameBoard test_board({"tester", "opponent"}); |
| 325 | + Player& test_player = test_board.getPlayer(0); |
| 326 | + Player& opponent = test_board.getPlayer(1); |
| 327 | + |
| 328 | + CHECK(test_player.getVictoryPoints() == 0); |
| 329 | + |
| 330 | + Coordinate start1(0,0); |
| 331 | + |
| 332 | + test_board.PlaceSettlement(start1, test_player); |
| 333 | + |
| 334 | + CHECK(test_player.getVictoryPoints() == 1); |
| 335 | + |
| 336 | + test_board.PlaceRoad(start1, Coordinate(-1,1), test_player); |
| 337 | + test_board.PlaceRoad(Coordinate(-1,1), Coordinate(-1,2), test_player); |
| 338 | + test_board.PlaceRoad(Coordinate(-1,2), Coordinate(0,2), test_player); |
| 339 | + test_board.PlaceRoad(Coordinate(0,2), Coordinate(0,3), test_player); |
| 340 | + test_board.PlaceRoad(Coordinate(0,3), Coordinate(1,3), test_player); |
| 341 | + |
| 342 | + CHECK(test_player.getVictoryPoints() == 3); |
| 343 | + |
| 344 | + test_board.UpgradeSettlement(start1); |
| 345 | + |
| 346 | + CHECK(test_player.getVictoryPoints() == 4); |
| 347 | + |
| 348 | + std::unique_ptr<DevelopmentCard> test_VictoryCard = std::unique_ptr<DevelopmentCard>(new VictoryPointCard()); |
| 349 | + test_player.addOre(4); |
| 350 | + test_player.addWheat(4); |
| 351 | + test_player.addWool(4); |
| 352 | + |
| 353 | + test_player.buyCard(test_VictoryCard); |
| 354 | + CHECK(test_player.getVictoryPoints() == 5); |
| 355 | + |
| 356 | + std::unique_ptr<DevelopmentCard> test_KnightCard = std::unique_ptr<DevelopmentCard>(new KnightCard()); |
| 357 | + test_player.buyCard(test_KnightCard); |
| 358 | + test_player.buyCard(test_KnightCard); |
| 359 | + test_player.buyCard(test_KnightCard); |
| 360 | + |
| 361 | +// WILL NOT WORK UNTIL THE KNIGHT WORKS |
| 362 | +// test_board.PlaceSettlement(Coordinate(0,6), opponent); |
| 363 | +// |
| 364 | +// test_player.playKnight(Coordinate(0,5), opponent); |
| 365 | +// test_player.playKnight(Coordinate(0,5), opponent); |
| 366 | +// test_player.playKnight(Coordinate(0,5), opponent); |
| 367 | +// |
| 368 | +// CHECK(test_player.getVictoryPoints() == 7); |
| 369 | +} |
240 | 370 |
|
0 commit comments