aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-08-11 10:02:32 +0200
committerSimon Warta <[email protected]>2015-08-11 10:02:51 +0200
commit7264369898fda03bfb3926d755bdb3370b6bf25d (patch)
treea54d164f4738a8808bdc43595dc01f4e8e7f806b /src/tests
parent765f445f3cef73f5bd6647eab1b99c39a7ad24cb (diff)
Strict uint32 parsing
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/catchy/test_utils.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/tests/catchy/test_utils.cpp b/src/tests/catchy/test_utils.cpp
index b63076c4f..c2b22c34a 100644
--- a/src/tests/catchy/test_utils.cpp
+++ b/src/tests/catchy/test_utils.cpp
@@ -190,13 +190,16 @@ TEST_CASE("uint32 parsing valid", "[utils]")
CHECK_THAT(to_u32bit("0000000000000000000000000010"), Equals(10));
// leading and trailing whitespace
- CHECK_THAT(to_u32bit(" 1"), Equals(1));
- CHECK_THAT(to_u32bit(" 1 "), Equals(1));
- CHECK_THAT(to_u32bit("\n1"), Equals(1));
- CHECK_THAT(to_u32bit("1\n"), Equals(1));
- CHECK_THAT(to_u32bit("1 5"), Equals(1));
- CHECK_THAT(to_u32bit("1\t5"), Equals(1));
- CHECK_THAT(to_u32bit("1\n5"), Equals(1));
+ CHECK_THROWS(to_u32bit(" 1"));
+ CHECK_THROWS(to_u32bit(" 1 "));
+ CHECK_THROWS(to_u32bit("\n1"));
+ CHECK_THROWS(to_u32bit("1\n"));
+ CHECK_THROWS(to_u32bit("1 5"));
+ CHECK_THROWS(to_u32bit("1\t5"));
+ CHECK_THROWS(to_u32bit("1\n5"));
+
+ // Other stuff that is no digit
+ CHECK_THROWS(to_u32bit("1Z"));
// invalid input
CHECK_THROWS(to_u32bit(""));