From 9e5936e3e5f5eed490b4c507eb8ef0ffe3284d38 Mon Sep 17 00:00:00 2001 From: Avril Date: Sun, 6 Jun 2021 14:48:09 +0100 Subject: [PATCH] contrived bs example test --- src/test/main.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/test/main.cpp b/src/test/main.cpp index 79d3c55..5c8cada 100644 --- a/src/test/main.cpp +++ b/src/test/main.cpp @@ -3,14 +3,66 @@ #include #include #include +#include #include using namespace _cow_util; +/// UTF8 multibyte 4. +struct utf8_t { + const static constexpr size_t MULTIBYTE =4; + typedef std::array Unicode; + + constexpr inline utf8_t() { data[0] = 0; } + + template + constexpr inline utf8_t(const char (&buffer)[N]) + { + static_assert(N<=MULTIBYTE, "Expected multibyte 4"); + data = { + buffer[0], + buffer[1], + buffer[2], + buffer[3], + 0, + }; + } + + constexpr inline utf8_t(char ascii) { + data[0] = ascii; + data[1] = 0; + } + + constexpr inline utf8_t(const char* c) { + for(int i=0;i