Skip to content

Commit 918870b

Browse files
committed
Explicitly compare size() in tests with size_t
1 parent 328fc14 commit 918870b

8 files changed

+110
-114
lines changed

test/ArgumentTests.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TEST(ArgumentsCase, ListArgumentStrings)
2727
FAIL() << response::toJSON(ex.getErrors());
2828
}
2929

30-
ASSERT_EQ(3, actual.size()) << "should get 3 entries";
30+
ASSERT_EQ(size_t { 3 }, actual.size()) << "should get 3 entries";
3131
EXPECT_EQ("string1", actual[0]) << "entry should match";
3232
EXPECT_EQ("string2", actual[1]) << "entry should match";
3333
EXPECT_EQ("string3", actual[2]) << "entry should match";
@@ -80,7 +80,7 @@ TEST(ArgumentsCase, ListArgumentStringsNullable)
8080
FAIL() << response::toJSON(ex.getErrors());
8181
}
8282

83-
ASSERT_EQ(4, actual.size()) << "should get 4 entries";
83+
ASSERT_EQ(size_t { 4 }, actual.size()) << "should get 4 entries";
8484
ASSERT_TRUE(actual[0].has_value()) << "should not be null";
8585
EXPECT_EQ("string1", *actual[0]) << "entry should match";
8686
ASSERT_TRUE(actual[1].has_value()) << "should not be null";
@@ -108,11 +108,11 @@ TEST(ArgumentsCase, ListArgumentListArgumentStrings)
108108
FAIL() << response::toJSON(ex.getErrors());
109109
}
110110

111-
ASSERT_EQ(2, actual.size()) << "should get 2 entries";
112-
ASSERT_EQ(2, actual[0].size()) << "should get 2 entries";
111+
ASSERT_EQ(size_t { 2 }, actual.size()) << "should get 2 entries";
112+
ASSERT_EQ(size_t { 2 }, actual[0].size()) << "should get 2 entries";
113113
EXPECT_EQ("list1string1", actual[0][0]) << "entry should match";
114114
EXPECT_EQ("list1string2", actual[0][1]) << "entry should match";
115-
ASSERT_EQ(2, actual[1].size()) << "should get 2 entries";
115+
ASSERT_EQ(size_t { 2 }, actual[1].size()) << "should get 2 entries";
116116
EXPECT_EQ("list2string1", actual[1][0]) << "entry should match";
117117
EXPECT_EQ("list2string2", actual[1][1]) << "entry should match";
118118
}
@@ -136,9 +136,9 @@ TEST(ArgumentsCase, ListArgumentNullableListArgumentStrings)
136136
FAIL() << response::toJSON(ex.getErrors());
137137
}
138138

139-
ASSERT_EQ(2, actual.size()) << "should get 2 entries";
139+
ASSERT_EQ(size_t { 2 }, actual.size()) << "should get 2 entries";
140140
EXPECT_FALSE(actual[0].has_value()) << "should be null";
141-
ASSERT_EQ(2, actual[1]->size()) << "should get 2 entries";
141+
ASSERT_EQ(size_t { 2 }, actual[1]->size()) << "should get 2 entries";
142142
EXPECT_EQ("list2string1", (*actual[1])[0]) << "entry should match";
143143
EXPECT_EQ("list2string2", (*actual[1])[1]) << "entry should match";
144144
}
@@ -227,7 +227,7 @@ TEST(ArgumentsCase, ScalarArgumentMap)
227227

228228
ASSERT_EQ(response::Type::Map, actual.type()) << "should parse the object";
229229
values = actual.release<response::MapType>();
230-
ASSERT_EQ(1, values.size()) << "should have a single key/value";
230+
ASSERT_EQ(size_t { 1 }, values.size()) << "should have a single key/value";
231231
ASSERT_EQ("foo", values.front().first) << "should match the key";
232232
ASSERT_EQ("bar", values.front().second.get<std::string>()) << "should match the value";
233233
}
@@ -250,7 +250,7 @@ TEST(ArgumentsCase, ScalarArgumentList)
250250

251251
ASSERT_EQ(response::Type::List, actual.type()) << "should parse the array";
252252
values = actual.release<response::ListType>();
253-
ASSERT_EQ(2, values.size()) << "should have 2 values";
253+
ASSERT_EQ(size_t { 2 }, values.size()) << "should have 2 values";
254254
ASSERT_EQ("foo", values.front().get<std::string>()) << "should match the value";
255255
ASSERT_EQ("bar", values.back().get<std::string>()) << "should match the value";
256256
}

test/ClientTests.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,11 @@ TEST_F(ClientCase, QueryEverything)
130130
auto serviceResponse = client::parseServiceResponse(std::move(result));
131131
const auto response = parseResponse(std::move(serviceResponse.data));
132132

133-
EXPECT_EQ(0, serviceResponse.errors.size()) << "no errors expected";
133+
EXPECT_EQ(size_t {}, serviceResponse.errors.size()) << "no errors expected";
134134

135135
ASSERT_TRUE(response.appointments.edges.has_value()) << "appointments should be set";
136-
ASSERT_EQ(1, response.appointments.edges->size()) << "appointments should have 1 entry";
136+
ASSERT_EQ(size_t { 1 }, response.appointments.edges->size())
137+
<< "appointments should have 1 entry";
137138
ASSERT_TRUE((*response.appointments.edges)[0].has_value()) << "edge should be set";
138139
const auto& appointmentNode = (*response.appointments.edges)[0]->node;
139140
ASSERT_TRUE(appointmentNode.has_value()) << "node should be set";
@@ -146,7 +147,7 @@ TEST_F(ClientCase, QueryEverything)
146147
EXPECT_EQ("Appointment", appointmentNode->_typename) << "__typename should match";
147148

148149
ASSERT_TRUE(response.tasks.edges.has_value()) << "tasks should be set";
149-
ASSERT_EQ(1, response.tasks.edges->size()) << "tasks should have 1 entry";
150+
ASSERT_EQ(size_t { 1 }, response.tasks.edges->size()) << "tasks should have 1 entry";
150151
ASSERT_TRUE((*response.tasks.edges)[0].has_value()) << "edge should be set";
151152
const auto& taskNode = (*response.tasks.edges)[0]->node;
152153
ASSERT_TRUE(taskNode.has_value()) << "node should be set";
@@ -157,7 +158,8 @@ TEST_F(ClientCase, QueryEverything)
157158
EXPECT_EQ("Task", taskNode->_typename) << "__typename should match";
158159

159160
ASSERT_TRUE(response.unreadCounts.edges.has_value()) << "unreadCounts should be set";
160-
ASSERT_EQ(1, response.unreadCounts.edges->size()) << "unreadCounts should have 1 entry";
161+
ASSERT_EQ(size_t { 1 }, response.unreadCounts.edges->size())
162+
<< "unreadCounts should have 1 entry";
161163
ASSERT_TRUE((*response.unreadCounts.edges)[0].has_value()) << "edge should be set";
162164
const auto& unreadCountNode = (*response.unreadCounts.edges)[0]->node;
163165
ASSERT_TRUE(unreadCountNode.has_value()) << "node should be set";
@@ -170,7 +172,7 @@ TEST_F(ClientCase, QueryEverything)
170172
EXPECT_EQ(client::query::Query::TaskState::Unassigned, response.testTaskState)
171173
<< "testTaskState should match";
172174

173-
ASSERT_EQ(1, response.anyType.size()) << "anyType should have 1 entry";
175+
ASSERT_EQ(size_t { 1 }, response.anyType.size()) << "anyType should have 1 entry";
174176
ASSERT_TRUE(response.anyType[0].has_value()) << "appointment should be set";
175177
const auto& anyType = *response.anyType[0];
176178
EXPECT_EQ("Appointment", anyType._typename) << "__typename should match";
@@ -208,7 +210,7 @@ TEST_F(ClientCase, MutateCompleteTask)
208210
auto serviceResponse = client::parseServiceResponse(std::move(result));
209211
const auto response = parseResponse(std::move(serviceResponse.data));
210212

211-
EXPECT_EQ(0, serviceResponse.errors.size()) << "no errors expected";
213+
EXPECT_EQ(size_t {}, serviceResponse.errors.size()) << "no errors expected";
212214

213215
const auto& completedTask = response.completedTask;
214216
const auto& task = completedTask.completedTask;
@@ -256,7 +258,7 @@ TEST_F(ClientCase, SubscribeNextAppointmentChangeDefault)
256258
auto serviceResponse = client::parseServiceResponse(std::move(result));
257259
const auto response = parseResponse(std::move(serviceResponse.data));
258260

259-
EXPECT_EQ(0, serviceResponse.errors.size()) << "no errors expected";
261+
EXPECT_EQ(size_t {}, serviceResponse.errors.size()) << "no errors expected";
260262

261263
const auto& appointmentNode = response.nextAppointment;
262264
ASSERT_TRUE(appointmentNode.has_value()) << "should get back a task";

test/NoIntrospectionTests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ TEST_F(NoIntrospectionServiceCase, QueryEverything)
174174
const auto appointments = service::ScalarArgument::require("appointments", data);
175175
const auto appointmentEdges =
176176
service::ScalarArgument::require<service::TypeModifier::List>("edges", appointments);
177-
ASSERT_EQ(1, appointmentEdges.size()) << "appointments should have 1 entry";
177+
ASSERT_EQ(size_t { 1 }, appointmentEdges.size()) << "appointments should have 1 entry";
178178
ASSERT_TRUE(appointmentEdges[0].type() == response::Type::Map)
179179
<< "appointment should be an object";
180180
const auto appointmentNode = service::ScalarArgument::require("node", appointmentEdges[0]);
@@ -192,7 +192,7 @@ TEST_F(NoIntrospectionServiceCase, QueryEverything)
192192
const auto tasks = service::ScalarArgument::require("tasks", data);
193193
const auto taskEdges =
194194
service::ScalarArgument::require<service::TypeModifier::List>("edges", tasks);
195-
ASSERT_EQ(1, taskEdges.size()) << "tasks should have 1 entry";
195+
ASSERT_EQ(size_t { 1 }, taskEdges.size()) << "tasks should have 1 entry";
196196
ASSERT_TRUE(taskEdges[0].type() == response::Type::Map) << "task should be an object";
197197
const auto taskNode = service::ScalarArgument::require("node", taskEdges[0]);
198198
EXPECT_EQ(_fakeTaskId, service::IdArgument::require("id", taskNode))
@@ -207,7 +207,7 @@ TEST_F(NoIntrospectionServiceCase, QueryEverything)
207207
const auto unreadCounts = service::ScalarArgument::require("unreadCounts", data);
208208
const auto unreadCountEdges =
209209
service::ScalarArgument::require<service::TypeModifier::List>("edges", unreadCounts);
210-
ASSERT_EQ(1, unreadCountEdges.size()) << "unreadCounts should have 1 entry";
210+
ASSERT_EQ(size_t { 1 }, unreadCountEdges.size()) << "unreadCounts should have 1 entry";
211211
ASSERT_TRUE(unreadCountEdges[0].type() == response::Type::Map)
212212
<< "unreadCount should be an object";
213213
const auto unreadCountNode = service::ScalarArgument::require("node", unreadCountEdges[0]);

test/PegtlCombinedTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ using namespace tao::graphqlpeg;
1414

1515
TEST(PegtlCombinedCase, AnalyzeMixedGrammar)
1616
{
17-
ASSERT_EQ(0, analyze<mixed_document>(true))
17+
ASSERT_EQ(size_t {}, analyze<mixed_document>(true))
1818
<< "there shouldn't be any infinite loops in the PEG version of the grammar";
1919
}

test/PegtlExecutableTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,6 @@ TEST(PegtlExecutableCase, ParseVariableDefaultEmptyList)
136136

137137
TEST(PegtlExecutableCase, AnalyzeExecutableGrammar)
138138
{
139-
ASSERT_EQ(0, analyze<executable_document>(true))
139+
ASSERT_EQ(size_t {}, analyze<executable_document>(true))
140140
<< "there shouldn't be any infinite loops in the PEG version of the grammar";
141141
}

test/PegtlSchemaTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,6 @@ TEST(PegtlSchemaCase, ParseTodaySchema)
219219

220220
TEST(PegtlSchemaCase, AnalyzeSchemaGrammar)
221221
{
222-
ASSERT_EQ(0, analyze<schema_document>(true))
222+
ASSERT_EQ(size_t {}, analyze<schema_document>(true))
223223
<< "there shouldn't be any infinite loops in the PEG version of the grammar";
224224
}

0 commit comments

Comments
 (0)