@@ -17,9 +17,7 @@ using std::unique_ptr;
1717using std::stringstream;
1818
1919TEST (emptyBoardSerialization) {
20- vector<unique_ptr<Player>> players;
21-
22- GameBoard testBoard (std::move (players));
20+ GameBoard testBoard ({});
2321
2422 stringstream stream;
2523 testBoard.save (stream);
@@ -30,11 +28,7 @@ TEST(emptyBoardSerialization) {
3028}
3129
3230TEST (multiplePlayerSerialization) {
33- vector<unique_ptr<Player>> players;
34- players.emplace_back (unique_ptr<Player>(new Player (" test" )));
35- players.emplace_back (unique_ptr<Player>(new Player (" test2" )));
36-
37- GameBoard testBoard (std::move (players));
31+ GameBoard testBoard ({" test" , " test2" });
3832
3933 stringstream stream;
4034 testBoard.save (stream);
@@ -45,15 +39,13 @@ TEST(multiplePlayerSerialization) {
4539}
4640
4741TEST (testCardSerialization) {
48- vector<unique_ptr<Player>> players;
49- players.emplace_back (unique_ptr<Player>(new Player (" test" )));
50- players[0 ]->buyCard (unique_ptr<DevelopmentCard>(new KnightCard ()));
51- players[0 ]->buyCard (unique_ptr<DevelopmentCard>(new VictoryPointCard ()));
52- players[0 ]->buyCard (unique_ptr<DevelopmentCard>(new YearOfPlentyCard ()));
53- players[0 ]->buyCard (unique_ptr<DevelopmentCard>(new MonopolyCard ()));
54- players[0 ]->buyCard (unique_ptr<DevelopmentCard>(new RoadBuildingCard ()));
55-
56- GameBoard testBoard (std::move (players));
42+ GameBoard testBoard ({" test" });
43+ Player& testPlayer = testBoard.getPlayer (0 );
44+ testPlayer.buyCard (unique_ptr<DevelopmentCard>(new KnightCard (testBoard)));
45+ testPlayer.buyCard (unique_ptr<DevelopmentCard>(new VictoryPointCard (testBoard)));
46+ testPlayer.buyCard (unique_ptr<DevelopmentCard>(new YearOfPlentyCard (testBoard)));
47+ testPlayer.buyCard (unique_ptr<DevelopmentCard>(new MonopolyCard (testBoard)));
48+ testPlayer.buyCard (unique_ptr<DevelopmentCard>(new RoadBuildingCard (testBoard)));
5749
5850 stringstream stream;
5951 testBoard.save (stream);
@@ -64,15 +56,9 @@ TEST(testCardSerialization) {
6456}
6557
6658TEST (roadSerialization) {
67- vector<unique_ptr<Player>> players;
68- players.emplace_back (unique_ptr<Player>(new Player (" test" )));
69- players.emplace_back (unique_ptr<Player>(new Player (" test2" )));
70- std::cout << __LINE__ << " \n " ;
71- Player& firstPlayer = *players[0 ];
72- Player& secondPlayer = *players[1 ];
73- std::cout << __LINE__ << " \n " ;
74-
75- GameBoard testBoard (std::move (players));
59+ GameBoard testBoard ({" test" , " test2" });
60+ Player& firstPlayer = testBoard.getPlayer (0 );
61+ Player& secondPlayer = testBoard.getPlayer (1 );
7662
7763 testBoard.PlaceSettlement (Coordinate (0 ,0 ), firstPlayer);
7864 testBoard.PlaceSettlement (Coordinate (-1 ,1 ), secondPlayer);
@@ -88,12 +74,8 @@ TEST(roadSerialization) {
8874}
8975
9076TEST (settlementSerialization) {
91- vector<unique_ptr<Player>> players;
92- players.emplace_back (unique_ptr<Player>(new Player (" test" )));
93-
94- Player& player = *players[0 ];
95-
96- GameBoard testBoard (std::move (players));
77+ GameBoard testBoard ({" test" });
78+ Player& player = testBoard.getPlayer (0 );
9779
9880 testBoard.PlaceSettlement (Coordinate (0 , 0 ), player);
9981 testBoard.PlaceSettlement (Coordinate (1 , 1 ), player);
0 commit comments