From: Alexander A. Klimov Date: Wed, 13 Mar 2019 17:12:58 +0000 (+0100) Subject: Test Utility::ValidateUTF8() X-Git-Tag: v2.11.0-rc1~204^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60ec11de73d3384903b5bd5718420cf70037d9a5;p=icinga2 Test Utility::ValidateUTF8() --- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8dc05b645..517197e7b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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 diff --git a/test/base-utility.cpp b/test/base-utility.cpp index a4e9eafe4..ed0c92d1c 100644 --- a/test/base-utility.cpp +++ b/test/base-utility.cpp @@ -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()