diff options
Diffstat (limited to 'src/unittest/test_utilities.cpp')
-rw-r--r-- | src/unittest/test_utilities.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/unittest/test_utilities.cpp b/src/unittest/test_utilities.cpp index 3c000e760..1785997de 100644 --- a/src/unittest/test_utilities.cpp +++ b/src/unittest/test_utilities.cpp @@ -43,6 +43,7 @@ public: void testStrToIntConversion(); void testStringReplace(); void testStringAllowed(); + void testAsciiPrintableHelper(); void testUTF8(); void testWrapRows(); void testIsNumber(); @@ -68,6 +69,7 @@ void TestUtilities::runTests(IGameDef *gamedef) TEST(testStrToIntConversion); TEST(testStringReplace); TEST(testStringAllowed); + TEST(testAsciiPrintableHelper); TEST(testUTF8); TEST(testWrapRows); TEST(testIsNumber); @@ -232,6 +234,18 @@ void TestUtilities::testStringAllowed() UASSERT(string_allowed_blacklist("hello123", "123") == false); } +void TestUtilities::testAsciiPrintableHelper() +{ + UASSERT(IS_ASCII_PRINTABLE_CHAR('e') == true); + UASSERT(IS_ASCII_PRINTABLE_CHAR('\0') == false); + + // Ensures that there is no cutting off going on... + // If there were, 331 would be cut to 75 in this example + // and 73 is a valid ASCII char. + int ch = 331; + UASSERT(IS_ASCII_PRINTABLE_CHAR(ch) == false); +} + void TestUtilities::testUTF8() { UASSERT(wide_to_utf8(utf8_to_wide("")) == ""); |