]> granicus.if.org Git - icinga2/commitdiff
Test Utility::ValidateUTF8() 7014/head
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Wed, 13 Mar 2019 17:12:58 +0000 (18:12 +0100)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Fri, 15 Mar 2019 12:34:20 +0000 (13:34 +0100)
test/CMakeLists.txt
test/base-utility.cpp

index 8dc05b64557a00b0883b23a2fb8e688870af12b4..517197e7b46dd151d0e6784eb716d0a8a0adb11b 100644 (file)
@@ -108,6 +108,7 @@ add_boost_test(base
     base_type/instantiate
     base_utility/comparepasswords_works
     base_utility/comparepasswords_issafe
+    base_utility/validateutf8
     base_value/scalar
     base_value/convert
     base_value/format
index a4e9eafe4a52cdb3d710c722eac2e05f972728c4..ed0c92d1c01eba482f442abdc038f7884d062f70 100644 (file)
@@ -50,4 +50,12 @@ BOOST_AUTO_TEST_CASE(comparepasswords_issafe)
        BOOST_CHECK(0.9 <= diff && diff <= 1.1);
 }
 
+BOOST_AUTO_TEST_CASE(validateutf8)
+{
+       BOOST_CHECK(Utility::ValidateUTF8("") == "");
+       BOOST_CHECK(Utility::ValidateUTF8("a") == "a");
+       BOOST_CHECK(Utility::ValidateUTF8("\xC3") == "\xEF\xBF\xBD");
+       BOOST_CHECK(Utility::ValidateUTF8("\xC3\xA4") == "\xC3\xA4");
+}
+
 BOOST_AUTO_TEST_SUITE_END()