|
5 | 5 | * Author: Kyle Grage |
6 | 6 | */ |
7 | 7 |
|
8 | | -#include "gtest/gtest.h" |
9 | | - |
| 8 | +#include "UnitTest++.h" |
10 | 9 | #include "CornerPiece.h" |
11 | 10 | #include "Settlement.h" |
12 | 11 | #include "City.h" |
|
15 | 14 | #include "Player.h" |
16 | 15 |
|
17 | 16 | //TEST CONSTRUCTORS |
18 | | -TEST(CornerPieceTest, Settlement_constructor){ |
| 17 | +TEST(Settlement_constructor){ |
19 | 18 | Coordinate loc = Coordinate(0,0); |
20 | 19 | GameBoard board({"test board"}); |
21 | 20 | Player& test_player = board.getPlayer(0); |
22 | 21 |
|
23 | 22 | Settlement test_cp(board, loc, test_player); |
24 | | - ASSERT_EQ(loc, test_cp.getLocation()); |
25 | | - ASSERT_EQ(board, test_cp.getBoard()); |
26 | | - ASSERT_EQ(1, test_cp.getVictoryPoints()); |
| 23 | + CHECK(loc==test_cp.getLocation()); |
| 24 | + CHECK(board==test_cp.getBoard()); |
| 25 | + CHECK_EQUAL(1, test_cp.getVictoryPoints()); |
27 | 26 | } |
28 | 27 |
|
29 | | -TEST(CornerPieceTest, City_constructor){ |
| 28 | +TEST(City_constructor){ |
30 | 29 | Coordinate loc = Coordinate(0,0); |
31 | 30 | GameBoard board({"test board"}); |
32 | 31 | Player& test_player = board.getPlayer(0); |
33 | 32 |
|
34 | 33 | City test_cp(board, loc, test_player); |
35 | | - ASSERT_EQ(loc, test_cp.getLocation()); |
36 | | - ASSERT_EQ(board, test_cp.getBoard()); |
37 | | - ASSERT_EQ(2, test_cp.getVictoryPoints()); |
| 34 | + CHECK(loc==test_cp.getLocation()); |
| 35 | + CHECK(board==test_cp.getBoard()); |
| 36 | + CHECK_EQUAL(2, test_cp.getVictoryPoints()); |
38 | 37 | } |
39 | 38 |
|
40 | | -TEST(CornerPieceTest, Wonder_constructor){ |
| 39 | +TEST(Wonder_constructor){ |
41 | 40 | Coordinate loc = Coordinate(0,0); |
42 | 41 | GameBoard board({"test board"}); |
43 | 42 | Player& test_player = board.getPlayer(0); |
44 | 43 |
|
45 | 44 | Wonder test_cp(board, loc, test_player); |
46 | | - ASSERT_EQ(loc, test_cp.getLocation()); |
47 | | - ASSERT_EQ(board, test_cp.getBoard()); |
48 | | - ASSERT_EQ(10, test_cp.getVictoryPoints()); |
| 45 | + CHECK(loc==test_cp.getLocation()); |
| 46 | + CHECK(board==test_cp.getBoard()); |
| 47 | + CHECK_EQUAL(10, test_cp.getVictoryPoints()); |
49 | 48 | } |
50 | 49 |
|
51 | | -TEST(CornerPieceTest, City_upgrade_constructor){ |
| 50 | +TEST(City_upgrade_constructor){ |
52 | 51 | Coordinate loc = Coordinate(0,0); |
53 | 52 | GameBoard board({"test board"}); |
54 | 53 | Player& test_player = board.getPlayer(0); |
55 | 54 |
|
56 | 55 | Settlement intermediate_cp(board, loc, test_player); |
57 | 56 | City test_cp(intermediate_cp); |
58 | | - ASSERT_EQ(loc, test_cp.getLocation()); |
59 | | - ASSERT_EQ(board, test_cp.getBoard()); |
60 | | - ASSERT_EQ(2, test_cp.getVictoryPoints()); |
| 57 | + CHECK(loc==test_cp.getLocation()); |
| 58 | + CHECK(board==test_cp.getBoard()); |
| 59 | + CHECK_EQUAL(2, test_cp.getVictoryPoints()); |
61 | 60 | } |
62 | 61 |
|
63 | | -TEST(CornerPieceTest, Wonder_upgrade_settlement_constructor){ |
| 62 | +TEST(Wonder_upgrade_settlement_constructor){ |
64 | 63 | Coordinate loc = Coordinate(0,0); |
65 | 64 | GameBoard board({"test board"}); |
66 | 65 | Player& test_player = board.getPlayer(0); |
67 | 66 |
|
68 | 67 | Settlement intermediate_cp(board, loc, test_player); |
69 | 68 | Wonder test_cp(intermediate_cp); |
70 | | - ASSERT_EQ(loc, test_cp.getLocation()); |
71 | | - ASSERT_EQ(board, test_cp.getBoard()); |
72 | | - ASSERT_EQ(10, test_cp.getVictoryPoints()); |
| 69 | + CHECK(loc==test_cp.getLocation()); |
| 70 | + CHECK(board==test_cp.getBoard()); |
| 71 | + CHECK_EQUAL(10, test_cp.getVictoryPoints()); |
73 | 72 | } |
74 | 73 |
|
75 | | -TEST(CornerPieceTest, Wonder_upgrade_city_constructor){ |
| 74 | +TEST(Wonder_upgrade_city_constructor){ |
76 | 75 | Coordinate loc = Coordinate(0,0); |
77 | 76 | GameBoard board({"test board"}); |
78 | 77 | Player& test_player = board.getPlayer(0); |
79 | 78 |
|
80 | 79 | City intermediate_cp(board, loc, test_player); |
81 | 80 | Wonder test_cp(intermediate_cp); |
82 | | - ASSERT_EQ(loc, test_cp.getLocation()); |
83 | | - ASSERT_EQ(board, test_cp.getBoard()); |
84 | | - ASSERT_EQ(10, test_cp.getVictoryPoints()); |
| 81 | + CHECK(loc==test_cp.getLocation()); |
| 82 | + CHECK(board==test_cp.getBoard()); |
| 83 | + CHECK_EQUAL(10, test_cp.getVictoryPoints()); |
85 | 84 | } |
86 | 85 |
|
87 | 86 | //TEST RESOURCE MODIFIERS |
88 | | -TEST(CornerPieceTest, Settlement_Resource_Mod){ |
| 87 | +TEST(Settlement_Resource_Mod){ |
89 | 88 | Coordinate loc = Coordinate(0,0); |
90 | 89 | GameBoard board({"test board"}); |
91 | 90 | Player& test_player = board.getPlayer(0); |
92 | 91 |
|
93 | 92 | Settlement test_cp(board, loc, test_player); |
94 | | - ASSERT_EQ(1, test_cp.getResourceModifier()); |
| 93 | + CHECK_EQUAL(1, test_cp.getResourceModifier()); |
95 | 94 | } |
96 | 95 |
|
97 | | -TEST(CornerPieceTest, City_Resource_Mod){ |
| 96 | +TEST(City_Resource_Mod){ |
98 | 97 | Coordinate loc = Coordinate(0,0); |
99 | 98 | GameBoard board({"test board"}); |
100 | 99 | Player& test_player = board.getPlayer(0); |
101 | 100 |
|
102 | 101 | City test_cp(board, loc, test_player); |
103 | | - ASSERT_EQ(2, test_cp.getResourceModifier()); |
| 102 | + CHECK_EQUAL(2, test_cp.getResourceModifier()); |
104 | 103 | } |
105 | 104 |
|
106 | | -TEST(CornerPieceTest, Wonder_Resource_Mod){ |
| 105 | +TEST(Wonder_Resource_Mod){ |
107 | 106 | Coordinate loc = Coordinate(0,0); |
108 | 107 | GameBoard board({"test board"}); |
109 | 108 | Player& test_player = board.getPlayer(0); |
110 | 109 |
|
111 | 110 | Wonder test_cp(board, loc, test_player); |
112 | | - ASSERT_EQ(10, test_cp.getResourceModifier()); |
| 111 | + CHECK_EQUAL(10, test_cp.getResourceModifier()); |
113 | 112 | } |
114 | 113 |
|
115 | 114 | //TEST VICTORY POINTS |
116 | | -TEST(CornerPieceTest, Settlement_Victory_Pts){ |
| 115 | +TEST(Settlement_Victory_Pts){ |
117 | 116 | Coordinate loc = Coordinate(0,0); |
118 | 117 | GameBoard board({"test board"}); |
119 | 118 | Player& test_player = board.getPlayer(0); |
120 | 119 |
|
121 | 120 | Settlement test_cp(board, loc, test_player); |
122 | | - ASSERT_EQ(1, test_cp.getVictoryPoints()); |
| 121 | + CHECK_EQUAL(1, test_cp.getVictoryPoints()); |
123 | 122 | } |
124 | 123 |
|
125 | | -TEST(CornerPieceTest, City_Victory_Pts){ |
| 124 | +TEST(City_Victory_Pts){ |
126 | 125 | Coordinate loc = Coordinate(0,0); |
127 | 126 | GameBoard board({"test board"}); |
128 | 127 | Player& test_player = board.getPlayer(0); |
129 | 128 |
|
130 | 129 | City test_cp(board, loc, test_player); |
131 | | - ASSERT_EQ(2, test_cp.getVictoryPoints()); |
| 130 | + CHECK_EQUAL(2, test_cp.getVictoryPoints()); |
132 | 131 | } |
133 | 132 |
|
134 | | -TEST(CornerPieceTest, Wonder_Victory_Pts){ |
| 133 | +TEST(Wonder_Victory_Pts){ |
135 | 134 | Coordinate loc = Coordinate(0,0); |
136 | 135 | GameBoard board({"test board"}); |
137 | 136 | Player& test_player = board.getPlayer(0); |
138 | 137 |
|
139 | 138 | Wonder test_cp(board, loc, test_player); |
140 | | - ASSERT_EQ(10, test_cp.getVictoryPoints()); |
| 139 | + CHECK_EQUAL(10, test_cp.getVictoryPoints()); |
141 | 140 | } |
142 | 141 |
|
143 | 142 |
|
0 commit comments