diff options
author | Simon Warta <[email protected]> | 2015-08-11 10:02:32 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-08-11 10:02:51 +0200 |
commit | 7264369898fda03bfb3926d755bdb3370b6bf25d (patch) | |
tree | a54d164f4738a8808bdc43595dc01f4e8e7f806b /src/tests | |
parent | 765f445f3cef73f5bd6647eab1b99c39a7ad24cb (diff) |
Strict uint32 parsing
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/catchy/test_utils.cpp | 17 |
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("")); |