You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testutils.cpp
+28-28Lines changed: 28 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -232,34 +232,34 @@ class TestUtils : public TestFixture {
232
232
ASSERT_EQUALS(0, ::strToInt<int>("-0"));
233
233
ASSERT_EQUALS(0, ::strToInt<std::size_t>("0"));
234
234
ASSERT_EQUALS(0, ::strToInt<std::size_t>("+0"));
235
-
ASSERT_THROW_EQUALS(::strToInt<int>(""), std::runtime_error, "converting '' to integer failed - not an integer");
236
-
ASSERT_THROW_EQUALS(::strToInt<std::size_t>(""), std::runtime_error, "converting '' to integer failed - not an integer");
237
-
ASSERT_THROW_EQUALS(::strToInt<int>(""), std::runtime_error, "converting ' ' to integer failed - not an integer");
238
-
ASSERT_THROW_EQUALS(::strToInt<std::size_t>(""), std::runtime_error, "converting ' ' to integer failed - not an integer");
235
+
ASSERT_THROW_EQUALS(::strToInt<int>(""), std::runtime_error, "converting '' to integer failed - not an integer (invalid_argument)");
236
+
ASSERT_THROW_EQUALS(::strToInt<std::size_t>(""), std::runtime_error, "converting '' to integer failed - not an integer (invalid_argument)");
237
+
ASSERT_THROW_EQUALS(::strToInt<int>(""), std::runtime_error, "converting ' ' to integer failed - not an integer (invalid_argument)");
238
+
ASSERT_THROW_EQUALS(::strToInt<std::size_t>(""), std::runtime_error, "converting ' ' to integer failed - not an integer (invalid_argument)");
239
239
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("-1"), std::runtime_error, "converting '-1' to integer failed - needs to be positive");
240
240
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("-0"), std::runtime_error, "converting '-0' to integer failed - needs to be positive");
241
241
ASSERT_THROW_EQUALS(::strToInt<std::size_t>("-1"), std::runtime_error, "converting '-1' to integer failed - needs to be positive");
242
242
ASSERT_THROW_EQUALS(::strToInt<std::size_t>("-0"), std::runtime_error, "converting '-0' to integer failed - needs to be positive");
243
-
ASSERT_THROW_EQUALS(::strToInt<int>("1ms"), std::runtime_error, "converting '1ms' to integer failed - not an integer");
244
-
ASSERT_THROW_EQUALS(::strToInt<int>("1.0"), std::runtime_error, "converting '1.0' to integer failed - not an integer");
245
-
ASSERT_THROW_EQUALS(::strToInt<int>("+1.0"), std::runtime_error, "converting '+1.0' to integer failed - not an integer");
246
-
ASSERT_THROW_EQUALS(::strToInt<int>("-1.0"), std::runtime_error, "converting '-1.0' to integer failed - not an integer");
247
-
ASSERT_THROW_EQUALS(::strToInt<int>("one"), std::runtime_error, "converting 'one' to integer failed - not an integer");
248
-
//ASSERT_THROW_EQUALS(::strToInt<int>(" 1"), std::runtime_error, "converting ' 1' to integer failed - not an integer"); // TODO: should fail
249
-
//ASSERT_THROW_EQUALS(::strToInt<int>("\t1"), std::runtime_error, "converting '\t1' to integer failed - not an integer"); // TODO should fail
250
-
ASSERT_THROW_EQUALS(::strToInt<int>("1 "), std::runtime_error, "converting '1 ' to integer failed - not an integer");
251
-
ASSERT_THROW_EQUALS(::strToInt<int>("1\t"), std::runtime_error, "converting '1\t' to integer failed - not an integer");
252
-
ASSERT_THROW_EQUALS(::strToInt<int>("+ 1"), std::runtime_error, "converting '+ 1' to integer failed - not an integer");
253
-
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("1ms"), std::runtime_error, "converting '1ms' to integer failed - not an integer");
254
-
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("1.0"), std::runtime_error, "converting '1.0' to integer failed - not an integer");
255
-
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("+1.0"), std::runtime_error, "converting '+1.0' to integer failed - not an integer");
256
-
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("-1.0"), std::runtime_error, "converting '-1.0' to integer failed - not an integer");
257
-
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("one"), std::runtime_error, "converting 'one' to integer failed - not an integer");
258
-
//ASSERT_THROW_EQUALS(::strToInt<unsigned int>(" 1"), std::runtime_error, "converting ' 1' to integer failed - not an integer"); // TODO: should fail
259
-
//ASSERT_THROW_EQUALS(::strToInt<unsigned int>("\t1"), std::runtime_error, "converting '\t1' to integer failed - not an integer"); // TODO: should fail
260
-
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("1 "), std::runtime_error, "converting '1 ' to integer failed - not an integer");
261
-
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("1\t"), std::runtime_error, "converting '1\t' to integer failed - not an integer");
262
-
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("- 1"), std::runtime_error, "converting '- 1' to integer failed - not an integer");
243
+
ASSERT_THROW_EQUALS(::strToInt<int>("1ms"), std::runtime_error, "converting '1ms' to integer failed - not an integer (pos)");
244
+
ASSERT_THROW_EQUALS(::strToInt<int>("1.0"), std::runtime_error, "converting '1.0' to integer failed - not an integer (pos)");
245
+
ASSERT_THROW_EQUALS(::strToInt<int>("+1.0"), std::runtime_error, "converting '+1.0' to integer failed - not an integer (pos)");
246
+
ASSERT_THROW_EQUALS(::strToInt<int>("-1.0"), std::runtime_error, "converting '-1.0' to integer failed - not an integer (pos)");
247
+
ASSERT_THROW_EQUALS(::strToInt<int>("one"), std::runtime_error, "converting 'one' to integer failed - not an integer (invalid_argument)");
248
+
ASSERT_THROW_EQUALS(::strToInt<int>(" 1"), std::runtime_error, "converting ' 1' to integer failed - not an integer");
249
+
ASSERT_THROW_EQUALS(::strToInt<int>("\t1"), std::runtime_error, "converting '\t1' to integer failed - not an integer");
250
+
ASSERT_THROW_EQUALS(::strToInt<int>("1 "), std::runtime_error, "converting '1 ' to integer failed - not an integer (pos)");
251
+
ASSERT_THROW_EQUALS(::strToInt<int>("1\t"), std::runtime_error, "converting '1\t' to integer failed - not an integer (pos)");
252
+
ASSERT_THROW_EQUALS(::strToInt<int>("+ 1"), std::runtime_error, "converting '+ 1' to integer failed - not an integer (invalid_argument)");
253
+
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("1ms"), std::runtime_error, "converting '1ms' to integer failed - not an integer (pos)");
254
+
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("1.0"), std::runtime_error, "converting '1.0' to integer failed - not an integer (pos)");
255
+
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("+1.0"), std::runtime_error, "converting '+1.0' to integer failed - not an integer (pos)");
256
+
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("-1.0"), std::runtime_error, "converting '-1.0' to integer failed - not an integer (pos)");
257
+
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("one"), std::runtime_error, "converting 'one' to integer failed - not an integer (invalid_argument)");
258
+
ASSERT_THROW_EQUALS(::strToInt<unsignedint>(" 1"), std::runtime_error, "converting ' 1' to integer failed - not an integer");
259
+
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("\t1"), std::runtime_error, "converting '\t1' to integer failed - not an integer");
260
+
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("1 "), std::runtime_error, "converting '1 ' to integer failed - not an integer (pos)");
261
+
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("1\t"), std::runtime_error, "converting '1\t' to integer failed - not an integer (pos)");
262
+
ASSERT_THROW_EQUALS(::strToInt<unsignedint>("- 1"), std::runtime_error, "converting '- 1' to integer failed - not an integer (invalid_argument)");
263
263
ASSERT_THROW_EQUALS(::strToInt<int>(std::to_string(static_cast<int64_t>(std::numeric_limits<int>::max()) + 1)), std::runtime_error, "converting '2147483648' to integer failed - out of range (limits)");
264
264
ASSERT_THROW_EQUALS(::strToInt<int>(std::to_string(static_cast<int64_t>(std::numeric_limits<int>::min()) - 1)), std::runtime_error, "converting '-2147483649' to integer failed - out of range (limits)");
265
265
ASSERT_THROW_EQUALS(::strToInt<int8_t>(std::to_string(static_cast<int64_t>(std::numeric_limits<int8_t>::max()) + 1)), std::runtime_error, "converting '128' to integer failed - out of range (limits)");
@@ -335,25 +335,25 @@ class TestUtils : public TestFixture {
335
335
long tmp;
336
336
std::string err;
337
337
ASSERT(!::strToInt("1ms", tmp, &err));
338
-
ASSERT_EQUALS("not an integer", err);
338
+
ASSERT_EQUALS("not an integer (pos)", err);
339
339
}
340
340
{
341
341
long tmp;
342
342
std::string err;
343
343
ASSERT(!::strToInt("1.0", tmp, &err));
344
-
ASSERT_EQUALS("not an integer", err);
344
+
ASSERT_EQUALS("not an integer (pos)", err);
345
345
}
346
346
{
347
347
long tmp;
348
348
std::string err;
349
349
ASSERT(!::strToInt("one", tmp, &err));
350
-
ASSERT_EQUALS("not an integer", err);
350
+
ASSERT_EQUALS("not an integer (invalid_argument)", err);
0 commit comments