From 40526eb7f247fdfc9d08c39ed3eaa97844b3c448 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 5 Dec 2021 20:25:51 +0100 Subject: Fix build on C++20, tests --- src/test-unicode.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/test-unicode.cpp') diff --git a/src/test-unicode.cpp b/src/test-unicode.cpp index 9c68c59..b5b48f0 100644 --- a/src/test-unicode.cpp +++ b/src/test-unicode.cpp @@ -37,13 +37,13 @@ std::vector success_sets { }; // Error cases: throwing upon convert to all other types -std::vector> failure_strings_char8_t { +std::vector> failure_strings_char8_t { // using u8"" here doesn't work on MSVC - "\x80", // utf-8 continuation byte - "\x81", // utf-8 continuation byte - "\xc3\xc3\xa4", // initial byte of utf-8 "ä", followed by valid utf-8 "ä" - "\xF8\x80\x80\x80\x80", // overlong encoding - "\xF7\xBF\xBF\xBF", // valid encoding of invalid code point + u8"\x80", // utf-8 continuation byte + u8"\x81", // utf-8 continuation byte + u8"\xc3\xc3\xa4", // initial byte of utf-8 "ä", followed by valid utf-8 "ä" + u8"\xF8\x80\x80\x80\x80", // overlong encoding + u8"\xF7\xBF\xBF\xBF", // valid encoding of invalid code point }; std::vector> failure_strings_char16_t { @@ -367,10 +367,10 @@ BOOST_AUTO_TEST_CASE(convert) BOOST_CHECK((unicode::convert(u8"abc")) == std::u16string{u"abc"}); BOOST_CHECK((unicode::convert(U"abc")) == std::u16string{u"abc"}); - BOOST_CHECK((unicode::convert("abc")) == std::u16string{u"abc"}); + BOOST_CHECK((unicode::convert(u8"abc")) == std::u16string{u"abc"}); BOOST_CHECK((unicode::convert(U"abc")) == std::u16string{u"abc"}); - BOOST_CHECK((unicode::convert(u8"äöü")) == std::u32string{U"äöü"}); + BOOST_CHECK((unicode::convert("äöü")) == std::u32string{U"äöü"}); #ifdef _WIN32 BOOST_CHECK(sizeof(wchar_t) == 2); @@ -381,9 +381,9 @@ BOOST_AUTO_TEST_CASE(convert) // For the following checks, wchar_t size and encoding is system dependent: // Windows: UTF-16 // Linux: UTF-32 - BOOST_CHECK((unicode::convert(u8"äöü")) == std::wstring{L"äöü"}); - BOOST_CHECK((unicode::convert(u8"\u732b")) == std::wstring{L"\u732b"}); - BOOST_CHECK((unicode::convert(u8"\U0001F63A")) == std::wstring{L"\U0001F63A"}); + BOOST_CHECK((unicode::convert("äöü")) == std::wstring{L"äöü"}); + BOOST_CHECK((unicode::convert("\u732b")) == std::wstring{L"\u732b"}); + BOOST_CHECK((unicode::convert("\U0001F63A")) == std::wstring{L"\U0001F63A"}); BOOST_CHECK((unicode::convert(L"\U0001F63A")) == std::u32string{U"\U0001F63A"}); BOOST_CHECK((unicode::convert(L"\U0001F63A")) == std::u8string{u8"\U0001F63A"}); -- cgit v1.2.3