@@ -18,6 +18,10 @@ TEST(CornerPiece_constructor){
1818 Player& test_player = board.getPlayer (0 );
1919
2020 CornerPiece test_cp (&board, loc, test_player);
21+ CHECK_EQUAL (loc, test_cp.getLocation ());
22+ CHECK_EQUAL (&board, test_cp.getBoard ());
23+ CHECK_EQUAL (&test_player, test_cp.getOwner ());
24+ CHECK_EQUAL (0 , test_cp.getVictoryPoints ());
2125}
2226
2327TEST (Settlement_constructor){
@@ -26,6 +30,10 @@ TEST(Settlement_constructor){
2630 Player& test_player = board.getPlayer (0 );
2731
2832 Settlement test_cp (&board, loc, test_player);
33+ CHECK_EQUAL (loc, test_cp.getLocation ());
34+ CHECK_EQUAL (&board, test_cp.getBoard ());
35+ CHECK_EQUAL (&test_player, test_cp.getOwner ());
36+ CHECK_EQUAL (1 , test_cp.getVictoryPoints ());
2937}
3038
3139TEST (City_constructor){
@@ -34,6 +42,10 @@ TEST(City_constructor){
3442 Player& test_player = board.getPlayer (0 );
3543
3644 City test_cp (&board, loc, test_player);
45+ CHECK_EQUAL (loc, test_cp.getLocation ());
46+ CHECK_EQUAL (&board, test_cp.getBoard ());
47+ CHECK_EQUAL (&test_player, test_cp.getOwner ());
48+ CHECK_EQUAL (2 , test_cp.getVictoryPoints ());
3749}
3850
3951TEST (Wonder_constructor){
@@ -42,48 +54,123 @@ TEST(Wonder_constructor){
4254 Player& test_player = board.getPlayer (0 );
4355
4456 Wonder test_cp (&board, loc, test_player);
57+ CHECK_EQUAL (loc, test_cp.getLocation ());
58+ CHECK_EQUAL (&board, test_cp.getBoard ());
59+ CHECK_EQUAL (&test_player, test_cp.getOwner ());
60+ CHECK_EQUAL (10 , test_cp.getVictoryPoints ());
4561}
4662
4763TEST (City_upgrade_constructor){
64+ Coordinate loc = Coordinate (0 ,0 );
65+ GameBoard board ({" test board" });
66+ Player& test_player = board.getPlayer (0 );
4867
68+ Settlement intermediate_cp (&board, loc, test_player);
69+ City test_cp (&intermediate_cp);
70+ CHECK_EQUAL (loc, test_cp.getLocation ());
71+ CHECK_EQUAL (&board, test_cp.getBoard ());
72+ CHECK_EQUAL (&test_player, test_cp.getOwner ());
73+ CHECK_EQUAL (2 , test_cp.getVictoryPoints ());
4974}
5075
51- TEST (Wonder_upgrade_constructor){
76+ TEST (Wonder_upgrade_settlement_constructor){
77+ Coordinate loc = Coordinate (0 ,0 );
78+ GameBoard board ({" test board" });
79+ Player& test_player = board.getPlayer (0 );
80+
81+ Settlement intermediate_cp (&board, loc, test_player);
82+ Wonder test_cp (&intermediate_cp);
83+ CHECK_EQUAL (loc, test_cp.getLocation ());
84+ CHECK_EQUAL (&board, test_cp.getBoard ());
85+ CHECK_EQUAL (&test_player, test_cp.getOwner ());
86+ CHECK_EQUAL (10 , test_cp.getVictoryPoints ());
87+ }
88+
89+ TEST (Wonder_upgrade_city_constructor){
90+ Coordinate loc = Coordinate (0 ,0 );
91+ GameBoard board ({" test board" });
92+ Player& test_player = board.getPlayer (0 );
5293
94+ City intermediate_cp (&board, loc, test_player);
95+ Wonder test_cp (&intermediate_cp);
96+ CHECK_EQUAL (loc, test_cp.getLocation ());
97+ CHECK_EQUAL (&board, test_cp.getBoard ());
98+ CHECK_EQUAL (&test_player, test_cp.getOwner ());
99+ CHECK_EQUAL (10 , test_cp.getVictoryPoints ());
53100}
54101
55102// TEST RESOURCE MODIFIERS
56103TEST (CornerPiece_Resource_Mod){
104+ Coordinate loc = Coordinate (0 ,0 );
105+ GameBoard board ({" test board" });
106+ Player& test_player = board.getPlayer (0 );
57107
108+ CornerPiece test_cp (&board, loc, test_player);
109+ CHECK_EQUAL (0 , test_cp.getResourceModifier ());
58110}
59111
60112TEST (Settlement_Resource_Mod){
113+ Coordinate loc = Coordinate (0 ,0 );
114+ GameBoard board ({" test board" });
115+ Player& test_player = board.getPlayer (0 );
61116
117+ Settlement test_cp (&board, loc, test_player);
118+ CHECK_EQUAL (1 , test_cp.getResourceModifier ());
62119}
63120
64121TEST (City_Resource_Mod){
122+ Coordinate loc = Coordinate (0 ,0 );
123+ GameBoard board ({" test board" });
124+ Player& test_player = board.getPlayer (0 );
65125
126+ City test_cp (&board, loc, test_player);
127+ CHECK_EQUAL (2 , test_cp.getResourceModifier ());
66128}
67129
68130TEST (Wonder_Resource_Mod){
131+ Coordinate loc = Coordinate (0 ,0 );
132+ GameBoard board ({" test board" });
133+ Player& test_player = board.getPlayer (0 );
69134
135+ Wonder test_cp (&board, loc, test_player);
136+ CHECK_EQUAL (10 , test_cp.getResourceModifier ());
70137}
71138
72139// TEST VICTORY POINTS
73140TEST (CornerPiece_Victory_Pts){
141+ Coordinate loc = Coordinate (0 ,0 );
142+ GameBoard board ({" test board" });
143+ Player& test_player = board.getPlayer (0 );
74144
145+ CornerPiece test_cp (&board, loc, test_player);
146+ CHECK_EQUAL (0 , test_cp.getVictoryPoints ());
75147}
76148
77149TEST (Settlement_Victory_Pts){
150+ Coordinate loc = Coordinate (0 ,0 );
151+ GameBoard board ({" test board" });
152+ Player& test_player = board.getPlayer (0 );
78153
154+ Settlement test_cp (&board, loc, test_player);
155+ CHECK_EQUAL (1 , test_cp.getVictoryPoints ());
79156}
80157
81158TEST (City_Victory_Pts){
159+ Coordinate loc = Coordinate (0 ,0 );
160+ GameBoard board ({" test board" });
161+ Player& test_player = board.getPlayer (0 );
82162
163+ City test_cp (&board, loc, test_player);
164+ CHECK_EQUAL (2 , test_cp.getVictoryPoints ());
83165}
84166
85167TEST (Wonder_Victory_Pts){
168+ Coordinate loc = Coordinate (0 ,0 );
169+ GameBoard board ({" test board" });
170+ Player& test_player = board.getPlayer (0 );
86171
172+ Wonder test_cp (&board, loc, test_player);
173+ CHECK_EQUAL (10 , test_cp.getVictoryPoints ());
87174}
88175
89176
0 commit comments