summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2021-12-16 13:11:03 +0100
committerRoland Reichwein <mail@reichwein.it>2021-12-16 13:11:03 +0100
commit3e5d303e59b66a1c52b14c88b24a59eb07209e5d (patch)
tree037b060a5cc3d380fe2d8cae853b42b2809dac57
parent506553dc5b0dd8973ae4d378a1ea6b0a65b6a72b (diff)
Update tests
-rw-r--r--Makefile2
-rw-r--r--include/unicode.h3
-rw-r--r--src/test-unicode.cpp24
3 files changed, 8 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index d1a7f76..e8a8f29 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
PROJECTNAME=unicode
VERSION=$(shell dpkg-parsechangelog --show-field Version)
-DISTROS=base debian11 ubuntu2004 ubuntu2010
+DISTROS=base debian11 ubuntu2110
ifeq ($(wildcard $(shell which clang++-13)),)
ifeq ($(wildcard $(shell which clang++)),)
diff --git a/include/unicode.h b/include/unicode.h
index 36fc6ae..37342a1 100644
--- a/include/unicode.h
+++ b/include/unicode.h
@@ -19,11 +19,10 @@
#ifdef __cpp_char8_t
// char8_t available
typedef char8_t utf8_t;
- typedef char iso_t;
#else
typedef char utf8_t;
- typedef char iso_t;
#endif
+typedef char iso_t;
namespace unicode {
diff --git a/src/test-unicode.cpp b/src/test-unicode.cpp
index ef68e02..c793399 100644
--- a/src/test-unicode.cpp
+++ b/src/test-unicode.cpp
@@ -39,19 +39,11 @@ std::vector<types_collection_type> success_sets {
// Error cases: throwing upon convert to all other types
std::vector<std::basic_string<utf8_t>> failure_strings_char8_t {
// using u8"" here doesn't work on MSVC
-#if (__cplusplus >= 202002L)
- (char8_t*)"\x80", // utf-8 continuation byte
- (char8_t*)"\x81", // utf-8 continuation byte
- (char8_t*)"\xc3\xc3\xa4", // initial byte of utf-8 "ä", followed by valid utf-8 "ä"
- (char8_t*)"\xF8\x80\x80\x80\x80", // overlong encoding
- (char8_t*)"\xF7\xBF\xBF\xBF", // valid encoding of invalid code point
-#else
- "\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
-#endif
+ (utf8_t*)"\x80", // utf-8 continuation byte
+ (utf8_t*)"\x81", // utf-8 continuation byte
+ (utf8_t*)"\xc3\xc3\xa4", // initial byte of utf-8 "ä", followed by valid utf-8 "ä"
+ (utf8_t*)"\xF8\x80\x80\x80\x80", // overlong encoding
+ (utf8_t*)"\xF7\xBF\xBF\xBF", // valid encoding of invalid code point
};
std::vector<std::basic_string<char16_t>> failure_strings_char16_t {
@@ -395,11 +387,7 @@ BOOST_AUTO_TEST_CASE(convert)
BOOST_CHECK((unicode::convert<char, wchar_t>("\u732b")) == std::wstring{L"\u732b"});
BOOST_CHECK((unicode::convert<char, wchar_t>("\U0001F63A")) == std::wstring{L"\U0001F63A"});
BOOST_CHECK((unicode::convert<wchar_t, char32_t>(L"\U0001F63A")) == std::u32string{U"\U0001F63A"});
-#if (__cplusplus >= 202002L)
- BOOST_CHECK((unicode::convert<wchar_t, utf8_t>(L"\U0001F63A")) == std::u8string{u8"\U0001F63A"});
-#else
- BOOST_CHECK((unicode::convert<wchar_t, utf8_t>(L"\U0001F63A")) == std::string{"\U0001F63A"});
-#endif
+ BOOST_CHECK((unicode::convert<wchar_t, utf8_t>(L"\U0001F63A")) == std::basic_string<utf8_t>{(utf8_t*)"\U0001F63A"});
BOOST_CHECK((unicode::convert<std::string, std::wstring>(std::string{"äöü"})) == std::wstring{L"äöü"});