|
37 | 37 | // |
38 | 38 | // CHECK(testBoard == copyBoard); |
39 | 39 | //} |
40 | | -// |
| 40 | +///* |
41 | 41 | //TEST(testCardSerialization) { |
42 | 42 | // GameBoard testBoard({"test"}); |
43 | 43 | // Player& testPlayer = testBoard.getPlayer(0); |
44 | | -// |
45 | | -// unique_ptr<DevelopmentCard> knight = unique_ptr<DevelopmentCard>(new KnightCard()); |
46 | | -// unique_ptr<DevelopmentCard> victory = unique_ptr<DevelopmentCard>(new VictoryPointCard()); |
47 | | -// unique_ptr<DevelopmentCard> yearofplenty = unique_ptr<DevelopmentCard>(new YearOfPlentyCard()); |
48 | | -// unique_ptr<DevelopmentCard> monopoly = unique_ptr<DevelopmentCard>(new MonopolyCard()); |
49 | | -// unique_ptr<DevelopmentCard> roadbuilding = unique_ptr<DevelopmentCard>(new RoadBuildingCard()); |
50 | | -// |
51 | | -// testPlayer.addOre(5); |
52 | | -// testPlayer.addWheat(5); |
53 | | -// testPlayer.addWool(5); |
54 | | -// |
55 | | -// testPlayer.buyCard(knight); |
56 | | -// testPlayer.buyCard(victory); |
57 | | -// testPlayer.buyCard(yearofplenty); |
58 | | -// testPlayer.buyCard(monopoly); |
59 | | -// testPlayer.buyCard(roadbuilding); |
| 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))); |
60 | 49 | // |
61 | 50 | // stringstream stream; |
62 | 51 | // testBoard.save(stream); |
63 | 52 | // |
64 | 53 | // GameBoard copyBoard(stream); |
65 | 54 | // |
66 | 55 | // CHECK(testBoard == copyBoard); |
67 | | -//} |
| 56 | +//}*/ |
68 | 57 | // |
69 | 58 | //TEST(roadSerialization) { |
70 | 59 | // GameBoard testBoard({"test", "test2"}); |
|
98 | 87 | // |
99 | 88 | // CHECK(testBoard == copyBoard); |
100 | 89 | //} |
101 | | -#include <UnitTest++.h> |
102 | | - |
103 | | -#include "Serialization.h" |
104 | | -#include "GameBoard.h" |
105 | | -#include "DevelopmentCard.h" |
106 | | -#include "Player.h" |
107 | | - |
108 | | -#include "tinyxml2.h" |
109 | | - |
110 | | -#include <iostream> |
111 | | -#include <sstream> |
112 | | -#include <memory> |
113 | | -#include <vector> |
114 | | - |
115 | | -using std::vector; |
116 | | -using std::unique_ptr; |
117 | | -using std::stringstream; |
118 | | - |
119 | | -TEST(emptyBoardSerialization) { |
120 | | - GameBoard testBoard({}); |
121 | | - |
122 | | - stringstream stream; |
123 | | - testBoard.save(stream); |
124 | | - |
125 | | - GameBoard copyBoard(stream); |
126 | | - |
127 | | - CHECK(testBoard == copyBoard); |
128 | | -} |
129 | | - |
130 | | -TEST(multiplePlayerSerialization) { |
131 | | - GameBoard testBoard({"test", "test2"}); |
132 | | - |
133 | | - stringstream stream; |
134 | | - testBoard.save(stream); |
135 | | - |
136 | | - GameBoard copyBoard(stream); |
137 | | - |
138 | | - CHECK(testBoard == copyBoard); |
139 | | -} |
140 | | -/* |
141 | | -TEST(testCardSerialization) { |
142 | | - GameBoard testBoard({"test"}); |
143 | | - Player& testPlayer = testBoard.getPlayer(0); |
144 | | - testPlayer.buyCard(unique_ptr<DevelopmentCard>(new KnightCard(testBoard))); |
145 | | - testPlayer.buyCard(unique_ptr<DevelopmentCard>(new VictoryPointCard(testBoard))); |
146 | | - testPlayer.buyCard(unique_ptr<DevelopmentCard>(new YearOfPlentyCard(testBoard))); |
147 | | - testPlayer.buyCard(unique_ptr<DevelopmentCard>(new MonopolyCard(testBoard))); |
148 | | - testPlayer.buyCard(unique_ptr<DevelopmentCard>(new RoadBuildingCard(testBoard))); |
149 | | - |
150 | | - stringstream stream; |
151 | | - testBoard.save(stream); |
152 | | - |
153 | | - GameBoard copyBoard(stream); |
154 | | - |
155 | | - CHECK(testBoard == copyBoard); |
156 | | -}*/ |
157 | | - |
158 | | -TEST(roadSerialization) { |
159 | | - GameBoard testBoard({"test", "test2"}); |
160 | | - Player& firstPlayer = testBoard.getPlayer(0); |
161 | | - Player& secondPlayer = testBoard.getPlayer(1); |
162 | | - |
163 | | - testBoard.PlaceSettlement(Coordinate(0,0), firstPlayer); |
164 | | - testBoard.PlaceSettlement(Coordinate(-1,1), secondPlayer); |
165 | | - testBoard.PlaceRoad(Coordinate(0,0), Coordinate(-1,1), firstPlayer); |
166 | | - testBoard.PlaceRoad(Coordinate(-1,1), Coordinate(-1,2), secondPlayer); |
167 | | - |
168 | | - stringstream stream; |
169 | | - testBoard.save(stream); |
170 | | - |
171 | | - GameBoard copyBoard(stream); |
172 | | - |
173 | | - CHECK(testBoard == copyBoard); |
174 | | -} |
175 | | - |
176 | | -TEST(settlementSerialization) { |
177 | | - GameBoard testBoard({"test"}); |
178 | | - Player& player = testBoard.getPlayer(0); |
179 | | - |
180 | | - testBoard.PlaceSettlement(Coordinate(0, 0), player); |
181 | | - testBoard.PlaceSettlement(Coordinate(1, 1), player); |
182 | | - |
183 | | - stringstream stream; |
184 | | - testBoard.save(stream); |
185 | | - |
186 | | - GameBoard copyBoard(stream); |
187 | | - |
188 | | - CHECK(testBoard == copyBoard); |
189 | | -} |
0 commit comments