summaryrefslogtreecommitdiffhomepage
path: root/src/test-helper.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2022-01-02 19:02:38 +0100
committerRoland Reichwein <mail@reichwein.it>2022-01-02 19:02:38 +0100
commitaa2edab739e3daac42cd5dbb44d10234ad880626 (patch)
treea89ff831861346ffb4ece6b0ca770c8be8315770 /src/test-helper.h
parentc3124ce89b53e0b1ff3b666aeee9d1829b74229c (diff)
Separated unit tests and performance tests
Diffstat (limited to 'src/test-helper.h')
-rw-r--r--src/test-helper.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test-helper.h b/src/test-helper.h
new file mode 100644
index 0000000..c3e2900
--- /dev/null
+++ b/src/test-helper.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <unicode.h>
+
+#include <string>
+
+// output operators must be in same namespace as the type itself
+namespace std {
+
+#ifdef __cpp_char8_t
+ std::ostream& operator<<(std::ostream& os, std::basic_string<utf8_t> const& s);
+#endif
+
+ std::ostream& operator<<(std::ostream& os, std::basic_string<char16_t> const& s);
+ std::ostream& operator<<(std::ostream& os, std::basic_string<char32_t> const& s);
+
+} // namespace std
+
+template<typename From, typename To>
+std::basic_string<To> std_convert(const std::basic_string<From>& s);
+
+template<>
+std::basic_string<utf8_t> std_convert<utf8_t, utf8_t>(const std::basic_string<utf8_t>& s);
+template<>
+std::basic_string<char16_t> std_convert<utf8_t, char16_t>(const std::basic_string<utf8_t>& s);
+template<>
+std::basic_string<char32_t> std_convert<utf8_t, char32_t>(const std::basic_string<utf8_t>& s);
+template<>
+std::basic_string<utf8_t> std_convert<char16_t, utf8_t>(const std::basic_string<char16_t>& s);
+template<>
+std::basic_string<char16_t> std_convert<char16_t, char16_t>(const std::basic_string<char16_t>& s);
+template<>
+std::basic_string<char32_t> std_convert<char16_t, char32_t>(const std::basic_string<char16_t>& s);
+template<>
+std::basic_string<utf8_t> std_convert<char32_t, utf8_t>(const std::basic_string<char32_t>& s);
+template<>
+std::basic_string<char16_t> std_convert<char32_t, char16_t>(const std::basic_string<char32_t>& s);
+template<>
+std::basic_string<char32_t> std_convert<char32_t, char32_t>(const std::basic_string<char32_t>& s);