summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2021-12-19 19:51:38 +0100
committerRoland Reichwein <mail@reichwein.it>2021-12-19 19:51:38 +0100
commit9dc97269201603dd479e15a736a64479a5095556 (patch)
treeb5f215bf9cfbbf2bee092505f4fdfbf3e4501b7b /src
parente24a0d5d371d0916dbfb375d3ea404f7e6237c74 (diff)
Simplify utf_iterator for input, build on Debian 10+11, Ubuntu 2004-2204
Diffstat (limited to 'src')
-rw-r--r--src/test-unicode.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test-unicode.cpp b/src/test-unicode.cpp
index 29e5c2e..d00a33d 100644
--- a/src/test-unicode.cpp
+++ b/src/test-unicode.cpp
@@ -372,7 +372,7 @@ BOOST_AUTO_TEST_CASE(random_sequences_valid)
std::transform(u32list.begin(), u32list.end(), std::back_inserter(u16list), [](const std::u32string& s){return unicode::convert<unicode::UTF_32, unicode::UTF_16>(s);});
// Fill UTF-8 data list
- std::vector<std::u8string> u8list;
+ std::vector<std::basic_string<utf8_t>> u8list;
std::transform(u32list.begin(), u32list.end(), std::back_inserter(u8list), [](const std::u32string& s){return unicode::convert<unicode::UTF_32, unicode::UTF_8>(s);});
for (const auto& i : u32list) {
@@ -380,7 +380,7 @@ BOOST_AUTO_TEST_CASE(random_sequences_valid)
BOOST_CHECK(s32.size() == i.size());
std::u16string s16{unicode::convert<unicode::UTF_32, unicode::UTF_16>(i)};
BOOST_CHECK(s16.size() >= i.size());
- std::u8string s8{unicode::convert<unicode::UTF_32, unicode::UTF_8>(i)};
+ std::basic_string<utf8_t> s8{unicode::convert<unicode::UTF_32, unicode::UTF_8>(i)};
BOOST_CHECK(s8.size() >= i.size());
}
@@ -389,7 +389,7 @@ BOOST_AUTO_TEST_CASE(random_sequences_valid)
BOOST_CHECK(s32.size() > 0 || i.size() == 0);
std::u16string s16{unicode::convert<unicode::UTF_16, unicode::UTF_16>(i)};
BOOST_CHECK(s16.size() == i.size());
- std::u8string s8{unicode::convert<unicode::UTF_16, unicode::UTF_8>(i)};
+ std::basic_string<utf8_t> s8{unicode::convert<unicode::UTF_16, unicode::UTF_8>(i)};
BOOST_CHECK(s8.size() >= i.size());
}
@@ -398,7 +398,7 @@ BOOST_AUTO_TEST_CASE(random_sequences_valid)
BOOST_CHECK(s32.size() > 0 || i.size() == 0);
std::u16string s16{unicode::convert<unicode::UTF_8, unicode::UTF_16>(i)};
BOOST_CHECK(s16.size() > 0 || i.size() == 0);
- std::u8string s8{unicode::convert<unicode::UTF_8, unicode::UTF_8>(i)};
+ std::basic_string<utf8_t> s8{unicode::convert<unicode::UTF_8, unicode::UTF_8>(i)};
BOOST_CHECK(s8.size() == i.size());
}
@@ -424,7 +424,7 @@ BOOST_AUTO_TEST_CASE(random_sequences_valid)
// Performance test UTF-32 -> UTF-8
auto t0{std::chrono::steady_clock::now()};
for (const auto& i : u32list) {
- std::u8string s{unicode::convert<unicode::UTF_32, unicode::UTF_8>(i)};
+ std::basic_string<utf8_t> s{unicode::convert<unicode::UTF_32, unicode::UTF_8>(i)};
}
std::cout << "Performance test for converting 1M strings from UTF-32 to UTF-8: " << std::chrono::duration<double>(std::chrono::steady_clock::now() - t0).count() << std::endl;
}
@@ -451,7 +451,7 @@ BOOST_AUTO_TEST_CASE(random_sequences_valid)
// Performance test UTF-16 -> UTF-8
auto t0{std::chrono::steady_clock::now()};
for (const auto& i : u16list) {
- std::u8string s{unicode::convert<unicode::UTF_16, unicode::UTF_8>(i)};
+ std::basic_string<utf8_t> s{unicode::convert<unicode::UTF_16, unicode::UTF_8>(i)};
}
std::cout << "Performance test for converting 1M strings from UTF-16 to UTF-8: " << std::chrono::duration<double>(std::chrono::steady_clock::now() - t0).count() << std::endl;
}
@@ -478,7 +478,7 @@ BOOST_AUTO_TEST_CASE(random_sequences_valid)
// Performance test UTF-8 -> UTF-8
auto t0{std::chrono::steady_clock::now()};
for (const auto& i : u8list) {
- std::u8string s{unicode::convert<unicode::UTF_8, unicode::UTF_8>(i)};
+ std::basic_string<utf8_t> s{unicode::convert<unicode::UTF_8, unicode::UTF_8>(i)};
}
std::cout << "Performance test for converting 1M strings from UTF-8 to UTF-8: " << std::chrono::duration<double>(std::chrono::steady_clock::now() - t0).count() << std::endl;
}