From 60ec11de73d3384903b5bd5718420cf70037d9a5 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 13 Mar 2019 18:12:58 +0100 Subject: [PATCH] Test Utility::ValidateUTF8() --- test/CMakeLists.txt | 1 + test/base-utility.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) 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() -- 2.40.0