diff options
| author | Stefan Boberg <[email protected]> | 2025-11-07 14:49:13 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-11-07 14:49:13 +0100 |
| commit | 24e43a913f29ac3b314354e8ce5175f135bcc64f (patch) | |
| tree | ca442937ceeb63461012b33a4576e9835099f106 /thirdparty/ryml/ext/c4core/test | |
| parent | get oplog attachments (#622) (diff) | |
| download | zen-24e43a913f29ac3b314354e8ce5175f135bcc64f.tar.xz zen-24e43a913f29ac3b314354e8ce5175f135bcc64f.zip | |
switch to xmake for package management (#611)
This change removes our dependency on vcpkg for package management, in favour of bringing some code in-tree in the `thirdparty` folder as well as using the xmake build-in package management feature. For the latter, all the package definitions are maintained in the zen repo itself, in the `repo` folder.
It should now also be easier to build the project as it will no longer depend on having the right version of vcpkg installed, which has been a common problem for new people coming in to the codebase. Now you should only need xmake to build.
* Bumps xmake requirement on github runners to 2.9.9 to resolve an issue where xmake on Windows invokes cmake with `v144` toolchain which does not exist
* BLAKE3 is now in-tree at `thirdparty/blake3`
* cpr is now in-tree at `thirdparty/cpr`
* cxxopts is now in-tree at `thirdparty/cxxopts`
* fmt is now in-tree at `thirdparty/fmt`
* robin-map is now in-tree at `thirdparty/robin-map`
* ryml is now in-tree at `thirdparty/ryml`
* sol2 is now in-tree at `thirdparty/sol2`
* spdlog is now in-tree at `thirdparty/spdlog`
* utfcpp is now in-tree at `thirdparty/utfcpp`
* xmake package repo definitions is in `repo`
* implemented support for sanitizers. ASAN is supported on windows, TSAN, UBSAN, MSAN etc are supported on Linux/MacOS though I have not yet tested it extensively on MacOS
* the zencore encryption implementation also now supports using mbedTLS which is used on MacOS, though for now we still use openssl on Linux
* crashpad
* bumps libcurl to 8.11.0 (from 8.8.0) which should address a rare build upload bug
Diffstat (limited to 'thirdparty/ryml/ext/c4core/test')
36 files changed, 23491 insertions, 0 deletions
diff --git a/thirdparty/ryml/ext/c4core/test/c4/libtest/archetypes.cpp b/thirdparty/ryml/ext/c4core/test/c4/libtest/archetypes.cpp new file mode 100644 index 000000000..9c4fb4310 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/c4/libtest/archetypes.cpp @@ -0,0 +1,9 @@ +#include "c4/libtest/archetypes.hpp"
+
+namespace c4 {
+namespace archetypes {
+
+int IdOwner::s_current = 0;
+
+} // namespace archetypes
+} // namespace c4
diff --git a/thirdparty/ryml/ext/c4core/test/c4/libtest/archetypes.hpp b/thirdparty/ryml/ext/c4core/test/c4/libtest/archetypes.hpp new file mode 100644 index 000000000..87a4644e9 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/c4/libtest/archetypes.hpp @@ -0,0 +1,551 @@ +#ifndef _C4_TEST_ARCHETYPES_HPP_ +#define _C4_TEST_ARCHETYPES_HPP_ + +#ifdef C4CORE_SINGLE_HEADER +#include "c4/c4core_all.hpp" +#else +#include "c4/memory_resource.hpp" +#include "c4/allocator.hpp" +#include "c4/char_traits.hpp" +#endif +#include "c4/test.hpp" + +#include <vector> +#include <string> +#include <array> + +namespace c4 { + +template< class String > class sstream; + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +namespace archetypes { + +template< class T > void check_archetype(T const& a) { a.check(); } +template< class T > void check_archetype(T const& a, T const& ref) { a.check(ref); } +inline void check_archetype(char ) {} +inline void check_archetype(wchar_t ) {} +inline void check_archetype(int8_t ) {} +inline void check_archetype(uint8_t ) {} +inline void check_archetype(int16_t ) {} +inline void check_archetype(uint16_t) {} +inline void check_archetype(int32_t ) {} +inline void check_archetype(uint32_t) {} +inline void check_archetype(int64_t ) {} +inline void check_archetype(uint64_t) {} +inline void check_archetype(float ) {} +inline void check_archetype(double ) {} +inline void check_archetype(char a, char ref) { CHECK_EQ(a, ref); } +inline void check_archetype(wchar_t a, wchar_t ref) { CHECK_EQ(a, ref); } +inline void check_archetype(int8_t a, int8_t ref) { CHECK_EQ(a, ref); } +inline void check_archetype(uint8_t a, uint8_t ref) { CHECK_EQ(a, ref); } +inline void check_archetype(int16_t a, int16_t ref) { CHECK_EQ(a, ref); } +inline void check_archetype(uint16_t a, uint16_t ref) { CHECK_EQ(a, ref); } +inline void check_archetype(int32_t a, int32_t ref) { CHECK_EQ(a, ref); } +inline void check_archetype(uint32_t a, uint32_t ref) { CHECK_EQ(a, ref); } +inline void check_archetype(int64_t a, int64_t ref) { CHECK_EQ(a, ref); } +inline void check_archetype(uint64_t a, uint64_t ref) { CHECK_EQ(a, ref); } +inline void check_archetype(float a, float ref) { CHECK_EQ((double)a, doctest::Approx((double)ref)); } +inline void check_archetype(double a, double ref) { CHECK_EQ(a, doctest::Approx(ref)); } + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +template< class T, class Proto > +struct archetype_proto_base +{ + static T const& get(size_t which) + { + auto const& a = Proto::arr(); + C4_ASSERT(which < (int)a.size()); + return a[which]; + } + static std::array< T, 8 > dup() + { + std::array< T, 8 > d = Proto::arr; + return d; + } + static std::array< Counting<T>, 8 > cdup() + { + std::array< Counting<T>, 8 > d = Proto::carr; + return d; + } + static std::vector< T > dup(size_t n) + { + auto const& a = Proto::arr(); + std::vector< T > d; + d.reserve(n); + for(size_t i = 0, pos = 0; i < n; ++i, pos = ((pos+1)%a.size())) + { + d.push_back(a[pos]); + } + return d; + } + static std::vector< Counting<T> > cdup(size_t n) + { + auto const& a = Proto::arr(); + std::vector< Counting<T> > d; + d.reserve(n); + for(size_t i = 0, pos = 0; i < n; ++i, pos = ((pos+1)%a.size())) + { + d.push_back(a[pos]); + } + return d; + } +}; + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wmissing-braces" // warning : suggest braces around initialization of subobject [-Wmissing-braces] +#endif + +// for scalar types: ints and floats +template< class T > +struct archetype_proto : public archetype_proto_base< T, archetype_proto<T> > +{ + static_assert(std::is_fundamental< T >::value, "T must be a fundamental type"); + static std::array<T, 8> const& arr() + { + static const std::array<T, 8> arr_{0, 1, 2, 3, 4, 5, 6, 7}; + return arr_; + } + static std::array<Counting<T>, 8> const& carr() + { + static const std::array<Counting<T>, 8> arr_ = {0, 1, 2, 3, 4, 5, 6, 7}; + return arr_; + } + static std::initializer_list< T > il() + { + static const std::initializer_list< T > l{0, 1, 2, 3, 4, 5, 6, 7}; + return l; + } + static std::initializer_list< Counting<T> > cil() + { + static const std::initializer_list< Counting<T> > l = {0, 1, 2, 3, 4, 5, 6, 7}; + C4_ASSERT(l.size() == 8); + return l; + } +}; + +#define _C4_DECLARE_ARCHETYPE_PROTO(ty, ...) \ +template<> \ +struct archetype_proto<ty> : public archetype_proto_base< ty, archetype_proto<ty> > \ +{ \ + static std::array<ty, 8> const& arr() \ + { \ + static const std::array<ty, 8> arr_{__VA_ARGS__}; \ + return arr_; \ + } \ + static std::array<Counting<ty>, 8> const& carr() \ + { \ + static const std::array<Counting<ty>, 8> arr_{__VA_ARGS__}; \ + return arr_; \ + } \ + static std::initializer_list< ty > il() \ + { \ + static const std::initializer_list< ty > l{__VA_ARGS__}; \ + return l; \ + } \ + static std::initializer_list< Counting<ty> > cil() \ + { \ + static const std::initializer_list< Counting<ty> > l{__VA_ARGS__}; \ + return l; \ + } \ +} + +#define _C4_DECLARE_ARCHETYPE_PROTO_TPL1(tplparam1, ty, ...) \ +template< tplparam1 > \ +struct archetype_proto< ty > : public archetype_proto_base< ty, archetype_proto<ty> > \ +{ \ + static std::array<ty, 8> const& arr() \ + { \ + static const std::array<ty, 8> arr_{__VA_ARGS__}; \ + return arr_; \ + } \ + static std::array<Counting<ty>, 8> const& carr() \ + { \ + static const std::array<Counting<ty>, 8> arr_{__VA_ARGS__}; \ + return arr_; \ + } \ + static std::initializer_list< ty > il() \ + { \ + static const std::initializer_list< ty > l{__VA_ARGS__}; \ + return l; \ + } \ + static std::initializer_list< Counting<ty> > cil() \ + { \ + static const std::initializer_list< Counting<ty> > l{__VA_ARGS__}; \ + return l; \ + } \ +} + +_C4_DECLARE_ARCHETYPE_PROTO(std::string, + "str0", "str1", "str2", "str3", + "str4", "str5", "str6", "str7"); + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +/** Resource-owning archetype */ + +template< class T > +struct exvec3 +{ + T x, y, z; + bool operator== (exvec3 const& that) const + { + return x == that.x && y == that.y && z == that.z; + } +}; +template< class String, class T > +sstream< String >& operator<< (sstream< String >& ss, exvec3<T> const& v) +{ + using char_type = typename sstream< String >::char_type; + ss.printp(C4_TXTTY("({},{},{})", char_type), v.x, v.y, v.z); + return ss; +} +template< class String, class T > +sstream< String >& operator>> (sstream< String >& ss, exvec3<T> & v) +{ + using char_type = typename sstream< String >::char_type; + ss.scanp(C4_TXTTY("({},{},{})", char_type), v.x, v.y, v.z); + return ss; +} + +#define _ C4_COMMA +#define c4v(v0, v1, v2) exvec3<T>{v0 _ v1 _ v2} +_C4_DECLARE_ARCHETYPE_PROTO_TPL1(class T, exvec3<T>, + c4v(0, 1, 2), c4v(3, 4, 5), c4v(6, 7, 8), c4v(9, 10, 11), + c4v(100, 101, 102), c4v(103, 104, 105), c4v(106, 107, 108), c4v(109, 110, 111) + ); +#undef c4v +#undef _ + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +/** Resource-owning archetype */ +struct IdOwner +{ + static int s_current; + int id; + int val; + + void check() const + { + CHECK_UNARY(id > 0); + } + void check(IdOwner const& that) const + { + check(); + CHECK_NE(id, that.id); + } + + IdOwner(int v = 0) { id = ++s_current; val = v; } + ~IdOwner() { if(id > 0) --s_current; } + IdOwner(IdOwner const& that) { id = ++s_current; val = that.val; } + IdOwner(IdOwner && that) { id = that.id; val = that.val; that.id = 0; } + IdOwner& operator= (IdOwner const& that) { C4_CHECK(id > 0); --s_current; id = ++s_current; val = that.val; return *this; } + IdOwner& operator= (IdOwner && that) { C4_CHECK(id > 0); --s_current; id = that.id; val = that.val; that.id = 0; return *this; } + bool operator== (IdOwner const& that) const + { + return val == that.val; + } +}; + +_C4_DECLARE_ARCHETYPE_PROTO(IdOwner, 0, 1, 2, 3, 4, 5, 6, 7); + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +/** Memory-owning archetype, raw mem resource calls */ +template< class T > +struct MemOwner +{ + T *mem; + // prevent initialization order problems by using a memory resource here + MemoryResourceMalloc mr; + + void check() const + { + EXPECT_NE(mem, nullptr); + check_archetype(*mem); + } + void check(MemOwner const& that) const + { + EXPECT_NE(mem, that.mem); + } + + ~MemOwner() + { + if(!mem) return; + mem->~T(); + mr.deallocate(mem, sizeof(T), alignof(T)); + mem = nullptr; + } + + MemOwner() + { + mem = (T*)mr.allocate(sizeof(T), alignof(T)); + new (mem) T(); + } + template< class ...Args > + MemOwner(varargs_t, Args && ...args) + { + mem = (T*)mr.allocate(sizeof(T), alignof(T)); + new (mem) T(std::forward< Args >(args)...); + } + MemOwner(MemOwner const& that) + { + mem = (T*)mr.allocate(sizeof(T), alignof(T)); + new (mem) T(*that.mem); + } + MemOwner(MemOwner && that) + { + mem = that.mem; + that.mem = nullptr; + } + MemOwner& operator= (MemOwner const& that) + { + if(!mem) + { + mem = (T*)mr.allocate(sizeof(T), alignof(T)); + } + else + { + mem->~T(); + } + new (mem) T(*that.mem); + return *this; + } + MemOwner& operator= (MemOwner && that) + { + if(mem) + { + mem->~T(); + mr.deallocate(mem, sizeof(T), alignof(T)); + } + mem = that.mem; + that.mem = nullptr; + return *this; + } + bool operator== (MemOwner const& that) const + { + return *mem == *that.mem; + } +}; + +#define _ C4_COMMA +#define c4v(which) MemOwner<T>{varargs _ archetype_proto<T>::get(which)} +_C4_DECLARE_ARCHETYPE_PROTO_TPL1(class T, MemOwner<T>, + c4v(0), c4v(1), c4v(2), c4v(3), + c4v(4), c4v(5), c4v(6), c4v(7) + ); +#undef c4v +#undef _ + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +/** Memory-owning archetype, with allocator */ +template< class T > +struct MemOwnerAlloc +{ + T *mem; + // prevent initialization order problems by using a memory resource here + MemoryResourceMalloc mr; + c4::Allocator< T > m_alloc; + using alloc_traits = std::allocator_traits< c4::Allocator< T > >; + + void check() const + { + EXPECT_NE(mem, nullptr); + check_archetype(*mem); + } + void check(MemOwnerAlloc const& that) const + { + check(); + EXPECT_NE(mem, that.mem); + } + + void free() + { + alloc_traits::destroy(m_alloc, mem); + alloc_traits::deallocate(m_alloc, mem, 1); + mem = nullptr; + } + ~MemOwnerAlloc() + { + if(!mem) return; + free(); + } + + MemOwnerAlloc() : m_alloc(&mr) + { + C4_ASSERT(m_alloc.resource() == &mr); + mem = alloc_traits::allocate(m_alloc, 1); + alloc_traits::construct(m_alloc, mem); + } + template< class ...Args > + MemOwnerAlloc(varargs_t, Args && ...args) : m_alloc(&mr) + { + mem = alloc_traits::allocate(m_alloc, 1); + alloc_traits::construct(m_alloc, mem, std::forward< Args >(args)...); + } + + MemOwnerAlloc(MemOwnerAlloc const& that) : m_alloc(&mr) + { + mem = alloc_traits::allocate(m_alloc, 1); + alloc_traits::construct(m_alloc, mem, *that.mem); + } + MemOwnerAlloc(MemOwnerAlloc && that) : m_alloc(&mr) + { + mem = that.mem; + that.mem = nullptr; + } + + MemOwnerAlloc& operator= (MemOwnerAlloc const& that) + { + if(!mem) + { + mem = alloc_traits::allocate(m_alloc, 1); + } + else + { + mem->~T(); + } + alloc_traits::construct(m_alloc, mem, *that.mem); + return *this; + } + MemOwnerAlloc& operator= (MemOwnerAlloc && that) + { + if(mem) + { + free(); + } + mem = that.mem; + that.mem = nullptr; + return *this; + } + + bool operator== (MemOwnerAlloc const& that) const + { + return *mem == *that.mem; + } +}; + +#define _ C4_COMMA +#define c4v(which) MemOwnerAlloc<T>{varargs _ archetype_proto<T>::get(which)} +_C4_DECLARE_ARCHETYPE_PROTO_TPL1(class T, MemOwnerAlloc<T>, + c4v(0), c4v(1), c4v(2), c4v(3), + c4v(4), c4v(5), c4v(6), c4v(7) + ); +#undef c4v +#undef _ + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +/** base class archetype */ +struct Base +{ + virtual ~Base() = default; +protected: + Base() = default; +}; +/** derived class archetype */ +struct Derived : public Base +{ + +}; + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +template< class T > +struct InsidePtr +{ + T a; + T b; + T c; + T *ptr; + + InsidePtr(int which = 0) : a(), b(), c(), ptr(&a + (which % 3)) {} + InsidePtr(InsidePtr const& that) : a(that.a), b(that.b), c(that.c), ptr(&a + (that.ptr - &that.a)) {} + InsidePtr(InsidePtr && that) : a(std::move(that.a)), b(std::move(that.b)), c(std::move(that.c)), ptr(&a + (that.ptr - &that.a)) { that.ptr = nullptr; } + InsidePtr& operator= (InsidePtr const& that) { a = (that.a); b = (that.b); c = (that.c); ptr = (&a + (that.ptr - &that.a)); return *this; } + InsidePtr& operator= (InsidePtr && that) { a = std::move(that.a); b = std::move(that.b); c = std::move(that.c); ptr = (&a + (that.ptr - &that.a)); that.ptr = nullptr; return *this; } + ~InsidePtr() { EXPECT_TRUE(ptr == &a || ptr == &b || ptr == &c || ptr == nullptr); } + + void check() const + { + EXPECT_TRUE(ptr == &a || ptr == &b || ptr == &c); + } + void check(InsidePtr const& that) const + { + check(); + EXPECT_EQ(ptr - &a, that.ptr - &that.a); + } + bool operator== (InsidePtr const& that) const + { + return that.a == a && that.b == b && that.c == c && (ptr - &a) == (that.ptr - &that.a); + } + +}; + +#define _ C4_COMMA +_C4_DECLARE_ARCHETYPE_PROTO_TPL1(class T, InsidePtr<T>, + 0, 1, 2, 3, 4, 5, 6, 7 + ); +#undef _ + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +# define CALL_FOR_SCALAR_ARCHETYPES(mcr) \ + mcr(int , int) \ + mcr(uint64_t , uint64_t) + +# define CALL_FOR_CONTAINEE_ARCHETYPES(mcr) \ + CALL_FOR_SCALAR_ARCHETYPES(mcr) \ + mcr(MemOwnerAlloc_std_string , archetypes::MemOwnerAlloc<std::string>) + + + +using scalars_quick = std::tuple<int, uint64_t>; +using scalars = std::tuple< + char, wchar_t, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float, double +>; +using containees_quick = std::tuple< + int, + uint64_t, + archetypes::MemOwnerAlloc<std::string> +>; +using containees = std::tuple< + char, wchar_t, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float, double, + archetypes::exvec3<int>, + archetypes::exvec3<float>, + archetypes::IdOwner, + archetypes::MemOwner<int>, + archetypes::MemOwner<std::string>, + archetypes::MemOwnerAlloc<int>, + archetypes::MemOwnerAlloc<std::string>, + archetypes::InsidePtr<int>, + archetypes::InsidePtr<std::string> +>; + + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + +} // namespace archetypes +} // namespace c4 + +#endif // _C4_TEST_ARCHETYPES_HPP_ diff --git a/thirdparty/ryml/ext/c4core/test/c4/libtest/supprwarn_pop.hpp b/thirdparty/ryml/ext/c4core/test/c4/libtest/supprwarn_pop.hpp new file mode 100644 index 000000000..695035ef6 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/c4/libtest/supprwarn_pop.hpp @@ -0,0 +1,12 @@ +#ifndef _C4_SUPPRWARN_POP_HPP_ +#define _C4_SUPPRWARN_POP_HPP_ + +#ifdef __clang__ +# pragma clang diagnostic pop +#elif defined(__GNUC__) +# pragma GCC diagnostic pop +#elif defined(_MSC_VER) +# pragma warning(pop) +#endif + +#endif /* SUPPRWARN_POP_H */ diff --git a/thirdparty/ryml/ext/c4core/test/c4/libtest/supprwarn_push.hpp b/thirdparty/ryml/ext/c4core/test/c4/libtest/supprwarn_push.hpp new file mode 100644 index 000000000..4651e227c --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/c4/libtest/supprwarn_push.hpp @@ -0,0 +1,48 @@ +#ifndef _C4_LIBTEST_SUPPRWARN_PUSH_HPP_ +#define _C4_LIBTEST_SUPPRWARN_PUSH_HPP_ + +/** @file supprwarn_push.hpp this file contains directives to make the + * compiler ignore warnings in test code. It should NOT be used for c4stl + * itself, but only in test code. */ + +#ifdef __clang__ +# pragma clang diagnostic push + /* NOTE: using , ## __VA_ARGS__ to deal with zero-args calls to + * variadic macros is not portable, but works in clang, gcc, msvc, icc. + * clang requires switching off compiler warnings for pedantic mode. + * @see http://stackoverflow.com/questions/32047685/variadic-macro-without-arguments */ +# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" // warning: token pasting of ',' and __VA_ARGS__ is a GNU extension +# pragma clang diagnostic ignored "-Wunused-local-typedef" +# pragma clang diagnostic ignored "-Wsign-compare" // warning: comparison of integers of different signs: 'const unsigned long' and 'const int' +# pragma clang diagnostic ignored "-Wfloat-equal" // warning: comparing floating point with == or != is unsafe +# pragma clang diagnostic ignored "-Wwritable-strings" // ISO C++11 does not allow conversion from string literal to char* +# pragma clang diagnostic ignored "-Wunused-variable" +# pragma clang diagnostic ignored "-Wunused-parameter" +#elif defined(__GNUC__) +# pragma GCC diagnostic push + /* GCC also issues a warning for zero-args calls to variadic macros. + * This warning is switched on with -pedantic and apparently there is no + * easy way to turn it off as with clang. But marking this as a system + * header works. + * @see https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html + * @see http://stackoverflow.com/questions/35587137/ */ +# pragma GCC system_header +# pragma GCC diagnostic ignored "-Wvariadic-macros" +# pragma GCC diagnostic ignored "-Wwrite-strings" // ISO C++ forbids converting a string constant to โC* {aka char*}โ +# pragma GCC diagnostic ignored "-Wunused-local-typedefs" +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wunused-parameter" +# pragma GCC diagnostic ignored "-Wsign-compare" // warning: comparison of integers of different signs: 'const unsigned long' and 'const int' +# pragma GCC diagnostic ignored "-Wfloat-equal" // warning: comparing floating point with == or != is unsafe +# pragma GCC diagnostic ignored "-Wpedantic" +# pragma GCC diagnostic ignored "-pedantic" +#elif defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable:4018) // '>=': signed/unsigned mismatch +# pragma warning(disable:4127) // conditional expression is constant +# pragma warning(disable:4189) // local variable is initialized but not referenced +# pragma warning(disable:4389) // '==': signed/unsigned mismatch +# pragma warning(disable:4702) // unreachable code +#endif + +#endif /* _C4_LIBTEST_SUPPRWARN_PUSH_HPP_ */ diff --git a/thirdparty/ryml/ext/c4core/test/c4/libtest/test.cpp b/thirdparty/ryml/ext/c4core/test/c4/libtest/test.cpp new file mode 100644 index 000000000..f005d24ac --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/c4/libtest/test.cpp @@ -0,0 +1,7 @@ +#include "c4/test.hpp" + +namespace c4 { + +size_t TestErrorOccurs::num_errors = 0; + +} // namespace c4 diff --git a/thirdparty/ryml/ext/c4core/test/c4/main.cpp b/thirdparty/ryml/ext/c4core/test/c4/main.cpp new file mode 100644 index 000000000..36c8001e6 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/c4/main.cpp @@ -0,0 +1,3 @@ +#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS +#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include <doctest/doctest.h> diff --git a/thirdparty/ryml/ext/c4core/test/c4/test.hpp b/thirdparty/ryml/ext/c4core/test/c4/test.hpp new file mode 100644 index 000000000..936283a2a --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/c4/test.hpp @@ -0,0 +1,324 @@ +#ifndef _C4_TEST_HPP_ +#define _C4_TEST_HPP_ + +#ifdef C4CORE_SINGLE_HEADER +#include "c4/c4core_all.hpp" +#else +#include "c4/config.hpp" +#include "c4/memory_resource.hpp" +#include "c4/allocator.hpp" +#include "c4/substr.hpp" +#endif +#include <cstdio> +#include <iostream> + +// FIXME - these are just dumb placeholders +#define C4_LOGF_ERR(...) fprintf(stderr, __VA_ARGS__) +#define C4_LOGF_WARN(...) fprintf(stderr, __VA_ARGS__) +#define C4_LOGP(msg, ...) printf(msg) + +#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS +#include <doctest/doctest.h> + +#define CHECK_STREQ(lhs, rhs) CHECK_EQ(c4::to_csubstr(lhs), c4::to_csubstr(rhs)) +#define CHECK_FLOAT_EQ(lhs, rhs) CHECK((double)(lhs) == doctest::Approx((double)(rhs))) + + +namespace c4 { + +template<class C> +inline std::ostream& operator<< (std::ostream& stream, c4::basic_substring<C> s) +{ + stream.write(s.str, std::streamsize(s.len)); + return stream; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +/** RAII class that tests whether an error occurs inside a scope. */ +struct TestErrorOccurs +{ + TestErrorOccurs(size_t num_expected_errors = 1) + : + expected_errors(num_expected_errors), + tmp_settings(c4::ON_ERROR_CALLBACK, &TestErrorOccurs::error_callback) + { + num_errors = 0; + } + ~TestErrorOccurs() + { + CHECK_EQ(num_errors, expected_errors); + num_errors = 0; + } + + size_t expected_errors; + static size_t num_errors; + ScopedErrorSettings tmp_settings; + static void error_callback(const char* /*msg*/, size_t /*msg_size*/) + { + ++num_errors; + } +}; + +#define C4_EXPECT_ERROR_OCCURS(...) \ + auto _testerroroccurs##__LINE__ = TestErrorOccurs(__VA_ARGS__) + +#if C4_USE_ASSERT +# define C4_EXPECT_ASSERT_TRIGGERS(...) C4_EXPECT_ERROR_OCCURS(__VA_ARGS__) +#else +# define C4_EXPECT_ASSERT_TRIGGERS(...) +#endif + +#if C4_USE_XASSERT +# define C4_EXPECT_XASSERT_TRIGGERS(...) C4_EXPECT_ERROR_OCCURS(__VA_ARGS__) +#else +# define C4_EXPECT_XASSERT_TRIGGERS(...) +#endif + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +/** count constructors, destructors and assigns */ +template< class T > +struct Counting +{ + using value_type = T; + + T obj; + + bool operator== (T const& that) const { return obj == that; } + + static bool log_ctors; + static size_t num_ctors; + template< class ...Args > + Counting(Args && ...args); + + static bool log_dtors; + static size_t num_dtors; + ~Counting(); + + static bool log_copy_ctors; + static size_t num_copy_ctors; + Counting(Counting const& that); + + static bool log_move_ctors; + static size_t num_move_ctors; + Counting(Counting && that); + + static bool log_copy_assigns; + static size_t num_copy_assigns; + Counting& operator= (Counting const& that); + + static bool log_move_assigns; + static size_t num_move_assigns; + Counting& operator= (Counting && that); + + + struct check_num + { + char const* name; + size_t const& what; + size_t const initial; + size_t const must_be_num; + check_num(char const* nm, size_t const& w, size_t n) : name(nm), what(w), initial(what), must_be_num(n) {} + ~check_num() + { + size_t del = what - initial; + INFO("# of " << name << " calls: expected " << must_be_num << ", but got " << del); + CHECK_EQ(del, must_be_num); + } + }; + + static check_num check_ctors(size_t n) { return check_num("ctor", num_ctors, n); } + static check_num check_dtors(size_t n) { return check_num("dtor", num_dtors, n); } + static check_num check_copy_ctors(size_t n) { return check_num("copy_ctor", num_copy_ctors, n); } + static check_num check_move_ctors(size_t n) { return check_num("move_ctor", num_move_ctors, n); } + static check_num check_copy_assigns(size_t n) { return check_num("copy_assign", num_copy_assigns, n); } + static check_num check_move_assigns(size_t n) { return check_num("move_assign", num_move_assigns, n); } + + struct check_num_ctors_dtors + { + check_num ctors, dtors; + check_num_ctors_dtors(size_t _ctors, size_t _dtors) + : + ctors(check_ctors(_ctors)), + dtors(check_dtors(_dtors)) + { + } + }; + static check_num_ctors_dtors check_ctors_dtors(size_t _ctors, size_t _dtors) + { + return check_num_ctors_dtors(_ctors, _dtors); + } + + struct check_num_all + { + check_num ctors, dtors, cp_ctors, mv_ctors, cp_assigns, mv_assigns; + check_num_all(size_t _ctors, size_t _dtors, size_t _cp_ctors, size_t _mv_ctors, size_t _cp_assigns, size_t _mv_assigns) + { + ctors = check_ctors(_ctors); + dtors = check_dtors(_dtors); + cp_ctors = check_copy_ctors(_cp_ctors); + mv_ctors = check_move_ctors(_mv_ctors); + cp_assigns = check_copy_assigns(_cp_assigns); + mv_assigns = check_move_assigns(_mv_assigns); + } + }; + static check_num_all check_all(size_t _ctors, size_t _dtors, size_t _cp_ctors, size_t _move_ctors, size_t _cp_assigns, size_t _mv_assigns) + { + return check_num_all(_ctors, _dtors, _cp_ctors, _move_ctors, _cp_assigns, _mv_assigns); + } + + static void reset() + { + num_ctors = 0; + num_dtors = 0; + num_copy_ctors = 0; + num_move_ctors = 0; + num_copy_assigns = 0; + num_move_assigns = 0; + } +}; + +template< class T > size_t Counting< T >::num_ctors = 0; +template< class T > bool Counting< T >::log_ctors = false; +template< class T > size_t Counting< T >::num_dtors = 0; +template< class T > bool Counting< T >::log_dtors = false; +template< class T > size_t Counting< T >::num_copy_ctors = 0; +template< class T > bool Counting< T >::log_copy_ctors = false; +template< class T > size_t Counting< T >::num_move_ctors = 0; +template< class T > bool Counting< T >::log_move_ctors = false; +template< class T > size_t Counting< T >::num_copy_assigns = 0; +template< class T > bool Counting< T >::log_copy_assigns = false; +template< class T > size_t Counting< T >::num_move_assigns = 0; +template< class T > bool Counting< T >::log_move_assigns = false; + +template< class T > +template< class ...Args > +Counting< T >::Counting(Args && ...args) : obj(std::forward< Args >(args)...) +{ + if(log_ctors) C4_LOGP("Counting[{}]::ctor #{}\n", (void*)this, num_ctors); + ++num_ctors; +} + +template< class T > +Counting< T >::~Counting() +{ + if(log_dtors) C4_LOGP("Counting[{}]::dtor #{}\n", (void*)this, num_dtors); + ++num_dtors; +} + +template< class T > +Counting< T >::Counting(Counting const& that) : obj(that.obj) +{ + if(log_copy_ctors) C4_LOGP("Counting[{}]::copy_ctor #{}\n", (void*)this, num_copy_ctors); + ++num_copy_ctors; +} + +template< class T > +Counting< T >::Counting(Counting && that) : obj(std::move(that.obj)) +{ + if(log_move_ctors) C4_LOGP("Counting[{}]::move_ctor #{}\n", (void*)this, num_move_ctors); + ++num_move_ctors; +} + +template< class T > +Counting< T >& Counting< T >::operator= (Counting const& that) +{ + obj = that.obj; + if(log_copy_assigns) C4_LOGP("Counting[{}]::copy_assign #{}\n", (void*)this, num_copy_assigns); + ++num_copy_assigns; + return *this; +} + +template< class T > +Counting< T >& Counting< T >::operator= (Counting && that) +{ + obj = std::move(that.obj); + if(log_move_assigns) C4_LOGP("Counting[{}]::move_assign #{}\n", (void*)this, num_move_assigns); + ++num_move_assigns; + return *this; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +/** @todo refactor to use RAII @see Counting */ +struct AllocationCountsChecker : public ScopedMemoryResourceCounts +{ + AllocationCounts first; + +public: + + AllocationCountsChecker() + : + ScopedMemoryResourceCounts(), + first(mr.counts()) + { + } + + AllocationCountsChecker(MemoryResource *mr_) + : + ScopedMemoryResourceCounts(mr_), + first(mr.counts()) + { + } + + void reset() + { + first = mr.counts(); + } + + /** check value of curr allocations and size */ + void check_curr(ssize_t expected_allocs, ssize_t expected_size) const + { + CHECK_EQ(mr.counts().curr.allocs, expected_allocs); + CHECK_EQ(mr.counts().curr.size, expected_size); + } + /** check delta of curr allocations and size since construction or last reset() */ + void check_curr_delta(ssize_t expected_allocs, ssize_t expected_size) const + { + AllocationCounts delta = mr.counts() - first; + CHECK_EQ(delta.curr.allocs, expected_allocs); + CHECK_EQ(delta.curr.size, expected_size); + } + + /** check value of total allocations and size */ + void check_total(ssize_t expected_allocs, ssize_t expected_size) const + { + CHECK_EQ(mr.counts().total.allocs, expected_allocs); + CHECK_EQ(mr.counts().total.size, expected_size); + } + /** check delta of total allocations and size since construction or last reset() */ + void check_total_delta(ssize_t expected_allocs, ssize_t expected_size) const + { + AllocationCounts delta = mr.counts() - first; + CHECK_EQ(delta.total.allocs, expected_allocs); + CHECK_EQ(delta.total.size, expected_size); + } + + /** check value of max allocations and size */ + void check_max(ssize_t expected_max_allocs, ssize_t expected_max_size) const + { + CHECK_EQ(mr.counts().max.allocs, expected_max_allocs); + CHECK_EQ(mr.counts().max.size, expected_max_size); + } + + /** check that since construction or the last reset(): + * - num_allocs occcurred + * - totaling total_size + * - of which the largest is max_size */ + void check_all_delta(ssize_t num_allocs, ssize_t total_size, ssize_t max_size) const + { + check_curr_delta(num_allocs, total_size); + check_total_delta(num_allocs, total_size); + check_max(num_allocs > mr.counts().max.allocs ? num_allocs : mr.counts().max.allocs, + max_size > mr.counts().max.size ? max_size : mr.counts().max.size); + } +}; + +} // namespace c4 + +#endif // _C4_LIBTEST_TEST_HPP_ diff --git a/thirdparty/ryml/ext/c4core/test/printintegers.py b/thirdparty/ryml/ext/c4core/test/printintegers.py new file mode 100644 index 000000000..de7532491 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/printintegers.py @@ -0,0 +1,107 @@ + + +def nb(val): + return [val-1, val, val+1] + + +def ipowers2(min, max): + vals = [] + v = int(min / 2) + while v < -10: + vals += nb(v) + v = int(v / 2) + vals += upowers2(max) + return vals + + +def upowers2(max): + vals = [] + v = 16 + while v < max: + vals += nb(v) + v *= 2 + return vals + + +def ipowers10(min, max): + vals = [] + v = -100 + while v > min: + vals += nb(v) + v *= 10 + vals += upowers10(max) + return vals + + +def upowers10(max): + vals = [] + v = 10 + while v < max: + vals += nb(v) + v *= 10 + return vals + + +def idiv10(min, max): + vals = [] + v = int(min / 10) + while v < -10: + vals.append(v) + v = int(v / 10) + vals += udiv10(max) + return vals + + +def udiv10(max): + vals = [] + v = int(max / 10) + while v > 10: + vals += nb(v) + v = int(v / 10) + return vals + + +def ivals(bits): + min = -(1 << (bits-1)) + max = -min-1 + vals = [min, min+1, min+2, min+3, min+4, min+5] + vals += ipowers2(min, max) + vals += ipowers10(min, max) + vals += idiv10(min, max) + vals += [-11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + vals += [max-5, max-4, max-3, max-2, max-1, max] + return sorted(list(set(vals))) + + +def uvals(bits): + max = (1 << bits) - 1 + vals = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + vals += upowers2(max) + vals += upowers10(max) + vals += udiv10(max) + vals += [max-5, max-4, max-3, max-2, max-1, max] + return sorted(list(set(vals))) + + + +def p(v): + return f' nc({v}, "{v}", "{hex(v)}", "{oct(v)}", "{bin(v)}"),' + + +def pn(numbits, fn): + print() + for a in fn(numbits): + print(p(a)) + + +pn(8, ivals) +pn(8, uvals) + +pn(16, ivals) +pn(16, uvals) + +pn(32, ivals) +pn(32, uvals) + +pn(64, ivals) +pn(64, uvals) diff --git a/thirdparty/ryml/ext/c4core/test/test_allocator.cpp b/thirdparty/ryml/ext/c4core/test/test_allocator.cpp new file mode 100644 index 000000000..78d0daf88 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_allocator.cpp @@ -0,0 +1,246 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/allocator.hpp" +#endif + +#include "c4/test.hpp" +#include "c4/libtest/supprwarn_push.hpp" + +#include <vector> +#include <string> +#include <map> + +namespace c4 { + +template< class T > using small_adapter = c4::small_allocator< T >; +template< class T > using small_adapter_mr = c4::small_allocator_mr< T >; + +#define _c4definealloctypes(Alloc) \ +using AllocInt = typename Alloc::template rebind<int>::other;\ +using AllocChar = typename Alloc::template rebind<char>::other;\ +using _string = std::basic_string< char, std::char_traits<char>, AllocChar >;\ +using AllocString = typename Alloc::template rebind<_string>::other;\ +using AllocPair = typename Alloc::template rebind<std::pair<const _string,int>>::other;\ +using _vector_int = std::vector<int, AllocInt >;\ +using _vector_string = std::vector<_string, AllocString >;\ +using _map_string_int = std::map<_string, int, std::less<_string>, AllocPair >; + +//----------------------------------------------------------------------------- +template< class Alloc > +void test_traits_compat_construct(typename Alloc::value_type const& val, Alloc &a) +{ + using atraits = std::allocator_traits< Alloc >; + using value_type = typename Alloc::value_type; + + value_type *mem = a.allocate(1); + REQUIRE_NE(mem, nullptr); + atraits::construct(a, mem, val); + CHECK_EQ(*mem, val); + + atraits::destroy(a, mem); + a.deallocate(mem, 1); +} + +TEST_CASE("allocator.traits_compat_construct") +{ + allocator<int> a; + test_traits_compat_construct(1, a); +} + +TEST_CASE("small_allocator.traits_compat_construct") +{ + small_allocator<int> a; + test_traits_compat_construct(1, a); +} + +TEST_CASE("allocator_mr_global.traits_compat_construct") +{ + allocator_mr<int> a; + test_traits_compat_construct(1, a); +} + +TEST_CASE("allocator_mr_linear.traits_compat_construct") +{ + MemoryResourceLinear mr(1024); + allocator_mr<int> a(&mr); + test_traits_compat_construct(1, a); +} + +TEST_CASE("allocator_mr_linear_arr.traits_compat_construct") +{ + MemoryResourceLinearArr<1024> mr; + allocator_mr<int> a(&mr); + test_traits_compat_construct(1, a); +} + +TEST_CASE("small_allocator_mr_global.traits_compat_construct") +{ + small_allocator_mr<int> a; + test_traits_compat_construct(1, a); +} + +TEST_CASE("small_allocator_mr_linear.traits_compat_construct") +{ + MemoryResourceLinear mr(1024); + small_allocator_mr<int> a(&mr); + test_traits_compat_construct(1, a); +} + +TEST_CASE("small_allocator_mr_linear_arr.traits_compat_construct") +{ + MemoryResourceLinearArr<1024> mr; + small_allocator_mr<int> a(&mr); + test_traits_compat_construct(1, a); +} + +//----------------------------------------------------------------------------- + +template< class Alloc > +void clear_mr(Alloc a) +{ + auto mrl = dynamic_cast<MemoryResourceLinear*>(a.resource()); + if(mrl) + { + mrl->clear(); + } +} + +template< class Alloc > +void do_std_containers_test(Alloc alloc) +{ + _c4definealloctypes(Alloc); + + { + _string v(alloc); + v.reserve(256); + v = "adskjhsdfkjdflkjsdfkjhsdfkjh"; + CHECK_EQ(v, "adskjhsdfkjdflkjsdfkjhsdfkjh"); + } + + clear_mr(alloc); + + { + int arr[128]; + for(int &i : arr) + { + i = 42; + } + _vector_int vi(arr, arr+C4_COUNTOF(arr), alloc); + for(int i : vi) + { + CHECK_EQ(i, 42); + } + } + + clear_mr(alloc); + + { + AllocChar a = alloc; + _vector_string v({"foo", "bar", "baz", "bat", "bax"}, a); + CHECK_EQ(v.size(), 5); + CHECK_EQ(v[0], "foo"); + CHECK_EQ(v[1], "bar"); + CHECK_EQ(v[2], "baz"); + CHECK_EQ(v[3], "bat"); + CHECK_EQ(v[4], "bax"); + } + + clear_mr(alloc); + + { + AllocString a = alloc; + _vector_string v(a); + v.resize(4); + int count = 0; + for(auto &s : v) + { + _string ss(size_t(64), (char)('0' + count++)); + s = ss; + } + } + + clear_mr(alloc); + + { +#if !defined(__GNUC__) || (__GNUC__ >= 5) + /* constructor does not exist on gcc < 5) */ + AllocPair a = alloc; + _map_string_int v(a); +#else + _map_string_int v; +#endif + CHECK_EQ(v.size(), 0); + v["foo"] = 0; + v["bar"] = 1; + v["baz"] = 2; + v["bat"] = 3; + CHECK_EQ(v.size(), 4); + CHECK_EQ(v["foo"], 0); + CHECK_EQ(v["bar"], 1); + CHECK_EQ(v["baz"], 2); + CHECK_EQ(v["bat"], 3); + } +} + +TEST_CASE("allocator_global.std_containers") +{ + allocator<int> a; + do_std_containers_test(a); +} + +TEST_CASE("small_allocator_global.std_containers") +{ + /* this is failing, investigate + small_allocator<int> a; + do_std_containers_test(a); + */ +} + +TEST_CASE("allocator_mr_global.std_containers") +{ + allocator_mr<int> a; + do_std_containers_test(a); +} + +TEST_CASE("allocator_mr_linear.std_containers") +{ + MemoryResourceLinear mr(1024); + allocator_mr<int> a(&mr); + do_std_containers_test(a); +} + +TEST_CASE("allocator_mr_linear_arr.std_containers") +{ + MemoryResourceLinearArr<1024> mr; + allocator_mr<int> a(&mr); + do_std_containers_test(a); +} + +TEST_CASE("small_allocator_mr_global.std_containers") +{ + /* this is failing, investigate + small_allocator_mr<int> a; + do_std_containers_test(a); + */ +} + +TEST_CASE("small_allocator_mr_linear.std_containers") +{ + /* this is failing, investigate + MemoryResourceLinear mr(1024); + small_allocator_mr<int> a(&mr); + do_std_containers_test(a); + */ +} + +TEST_CASE("small_allocator_mr_linear_arr.std_containers") +{ + /* this is failing, investigate + MemoryResourceLinearArr<1024> mr; + small_allocator_mr<int> a(&mr); + do_std_containers_test(a); + */ +} + +} // namespace c4 + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_base64.cpp b/thirdparty/ryml/ext/c4core/test/test_base64.cpp new file mode 100644 index 000000000..e638a0d81 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_base64.cpp @@ -0,0 +1,265 @@ +#include "c4/test.hpp" +#ifndef C4CORE_SINGLE_HEADER +#include "c4/std/string.hpp" +#include "c4/std/vector.hpp" +#include "c4/format.hpp" +#include "c4/base64.hpp" +#endif + +#include "c4/libtest/supprwarn_push.hpp" + +#include <cstring> + +C4_SUPPRESS_WARNING_MSVC_WITH_PUSH(4310) // cast truncates constant value + +namespace c4 { + +namespace detail { +void base64_test_tables(); +TEST_CASE("base64.infrastructure") +{ + #ifndef NDEBUG + detail::base64_test_tables(); + #endif +} +// Since some the macros in c4/cpu.cpp cannot identify endanness at compile +// time, we use a simple runtime endianness-detection routine. +bool is_little_endian() +{ + unsigned long const v = 1UL; + unsigned char b[sizeof(v)]; + std::memcpy(&b[0], &v, sizeof(v)); + return !!b[0]; +} +} // namespace detail + +csubstr native(csubstr little_endian, csubstr big_endian) +{ + return detail::is_little_endian() ? little_endian : big_endian; +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +template<class T, class U> +void test_base64_str_roundtrip(T const& val, csubstr expected, U *ws) +{ + char buf_[512]; + substr buf(buf_); + + csubstr encoded = to_chars_sub(buf, fmt::base64(val)); + CHECK(base64_valid(encoded)); + CHECK_EQ(encoded, expected); + CHECK_EQ(encoded.len % 4, 0); + + auto req = fmt::base64(*ws); + size_t written = from_chars(encoded, &req); + CHECK_EQ(ws->first(written), val); +} + +template<class T> +void test_base64_roundtrip(T const& val, csubstr expected) +{ + char buf_[512]; + substr buf(buf_); + + csubstr encoded = to_chars_sub(buf, fmt::base64(val)); + CHECK(base64_valid(encoded)); + CHECK_EQ(encoded, expected); + CHECK_EQ(encoded.len % 4, 0); + + T ws = {}; + auto req = fmt::base64(ws); + size_t written = from_chars(encoded, &req); + CHECK_EQ(written, sizeof(T)); + CHECK_EQ(ws, val); +} + +template<class T> +struct base64_test_pair +{ + T val; + csubstr encoded; +}; + +base64_test_pair<csubstr> base64_str_pairs[] = { +#define __(val, expected) {csubstr(val), csubstr(expected)} + __("" , "" ), + __("0" , "MA==" ), + __("1" , "MQ==" ), + __("2" , "Mg==" ), + __("3" , "Mw==" ), + __("4" , "NA==" ), + __("5" , "NQ==" ), + __("6" , "Ng==" ), + __("7" , "Nw==" ), + __("8" , "OA==" ), + __("9" , "OQ==" ), + __("10" , "MTA=" ), + __("123" , "MTIz" ), + __("1234" , "MTIzNA==" ), + __("1235" , "MTIzNQ==" ), + __("Man" , "TWFu" ), + __("Ma" , "TWE=" ), + __("M" , "TQ==" ), + __("deadbeef" , "ZGVhZGJlZWY=" ), + __("any carnal pleasure.", "YW55IGNhcm5hbCBwbGVhc3VyZS4="), + __("any carnal pleasure" , "YW55IGNhcm5hbCBwbGVhc3VyZQ=="), + __("any carnal pleasur" , "YW55IGNhcm5hbCBwbGVhc3Vy" ), + __("any carnal pleasu" , "YW55IGNhcm5hbCBwbGVhc3U=" ), + __("any carnal pleas" , "YW55IGNhcm5hbCBwbGVhcw==" ), + __( "pleasure.", "cGxlYXN1cmUu" ), + __( "leasure.", "bGVhc3VyZS4=" ), + __( "easure.", "ZWFzdXJlLg==" ), + __( "asure.", "YXN1cmUu" ), + __( "sure.", "c3VyZS4=" ), +#undef __ +}; + + +TEST_CASE("base64.str") +{ + char buf_[512]; + substr buf(buf_); + for(auto p : base64_str_pairs) + { + INFO(p.val); + test_base64_str_roundtrip(p.val, p.encoded, &buf); + } +} + +TEST_CASE_TEMPLATE("base64.8bit", T, int8_t, uint8_t) +{ + base64_test_pair<T> pairs[] = { + {(T) 0, csubstr("AA==")}, + {(T) 1, csubstr("AQ==")}, + {(T) 2, csubstr("Ag==")}, + {(T) 3, csubstr("Aw==")}, + {(T) 4, csubstr("BA==")}, + {(T) 5, csubstr("BQ==")}, + {(T) 6, csubstr("Bg==")}, + {(T) 7, csubstr("Bw==")}, + {(T) 8, csubstr("CA==")}, + {(T) 9, csubstr("CQ==")}, + {(T) 10, csubstr("Cg==")}, + {(T) 11, csubstr("Cw==")}, + {(T) 12, csubstr("DA==")}, + {(T) 13, csubstr("DQ==")}, + {(T) 14, csubstr("Dg==")}, + {(T) 15, csubstr("Dw==")}, + {(T) 16, csubstr("EA==")}, + {(T) 17, csubstr("EQ==")}, + {(T) 18, csubstr("Eg==")}, + {(T) 19, csubstr("Ew==")}, + {(T) 20, csubstr("FA==")}, + {(T)127, csubstr("fw==")}, + {(T)128, csubstr("gA==")}, + {(T)254, csubstr("/g==")}, + {(T)255, csubstr("/w==")}, + }; + for(auto p : pairs) + { + INFO("val=" << (int)p.val << " expected=" << p.encoded); + test_base64_roundtrip(p.val, p.encoded); + } +} + +TEST_CASE_TEMPLATE("base64.16bit", T, int16_t, uint16_t) +{ + base64_test_pair<T> pairs[] = { + { 0, native("AAA=", "AAA=")}, + { 1, native("AQA=", "AAE=")}, + { 2, native("AgA=", "AAI=")}, + { 3, native("AwA=", "AAM=")}, + { 4, native("BAA=", "AAQ=")}, + { 5, native("BQA=", "AAU=")}, + { 6, native("BgA=", "AAY=")}, + { 7, native("BwA=", "AAc=")}, + { 8, native("CAA=", "AAg=")}, + { 9, native("CQA=", "AAk=")}, + { 10, native("CgA=", "AAo=")}, + {1234, native("0gQ=", "BNI=")}, + }; + for(auto p : pairs) + { + INFO("val=" << p.val << " expected=" << p.encoded); + test_base64_roundtrip(p.val, p.encoded); + } +} + +TEST_CASE_TEMPLATE("base64.32bit", T, int32_t, uint32_t) +{ + base64_test_pair<T> pairs[] = { + { 0, native("AAAAAA==", "AAAAAA==")}, + { 1, native("AQAAAA==", "AAAAAQ==")}, + { 2, native("AgAAAA==", "AAAAAg==")}, + { 3, native("AwAAAA==", "AAAAAw==")}, + { 4, native("BAAAAA==", "AAAABA==")}, + { 5, native("BQAAAA==", "AAAABQ==")}, + { 6, native("BgAAAA==", "AAAABg==")}, + { 7, native("BwAAAA==", "AAAABw==")}, + { 8, native("CAAAAA==", "AAAACA==")}, + { 9, native("CQAAAA==", "AAAACQ==")}, + { 10, native("CgAAAA==", "AAAACg==")}, + {1234, native("0gQAAA==", "AAAE0g==")}, + }; + for(auto p : pairs) + { + INFO("val=" << p.val << " expected=" << p.encoded); + test_base64_roundtrip(p.val, p.encoded); + } +} + +TEST_CASE_TEMPLATE("base64.64bit", T, int64_t, uint64_t) +{ + base64_test_pair<T> pairs[] = { + { 0, native("AAAAAAAAAAA=", "AAAAAAAAAAA=")}, + { 1, native("AQAAAAAAAAA=", "AAAAAAAAAAE=")}, + { 2, native("AgAAAAAAAAA=", "AAAAAAAAAAI=")}, + { 3, native("AwAAAAAAAAA=", "AAAAAAAAAAM=")}, + { 4, native("BAAAAAAAAAA=", "AAAAAAAAAAQ=")}, + { 5, native("BQAAAAAAAAA=", "AAAAAAAAAAU=")}, + { 6, native("BgAAAAAAAAA=", "AAAAAAAAAAY=")}, + { 7, native("BwAAAAAAAAA=", "AAAAAAAAAAc=")}, + { 8, native("CAAAAAAAAAA=", "AAAAAAAAAAg=")}, + { 9, native("CQAAAAAAAAA=", "AAAAAAAAAAk=")}, + { 10, native("CgAAAAAAAAA=", "AAAAAAAAAAo=")}, + {1234, native("0gQAAAAAAAA=", "AAAAAAAABNI=")}, + {0xdeadbeef, native("776t3gAAAAA=", "AAAAAN6tvu8=")}, + }; + for(auto p : pairs) + { + INFO("val=" << p.val << " expected=" << p.encoded); + test_base64_roundtrip(p.val, p.encoded); + } +} + +TEST_CASE("base64.high_bits_u32") +{ + test_base64_roundtrip(UINT32_C(0xdeadbeef), native("776t3g==", "3q2+7w==")); + test_base64_roundtrip(UINT32_MAX, native("/////w==", "/////w==")); +} + +TEST_CASE("base64.high_bits_i32") +{ + test_base64_roundtrip(INT32_C(0x7fffffff), native("////fw==", "f////w==")); + test_base64_roundtrip(INT32_MAX, native("////fw==", "f////w==")); +} + +TEST_CASE("base64.high_bits_u64") +{ + test_base64_roundtrip(UINT64_MAX, native("//////////8=", "//////////8=")); +} + +TEST_CASE("base64.high_bits_i64") +{ + test_base64_roundtrip(INT64_MAX, native("/////////38=", "f/////////8=")); +} + +} // namespace c4 + +C4_SUPPRESS_WARNING_MSVC_POP + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_bitmask.cpp b/thirdparty/ryml/ext/c4core/test/test_bitmask.cpp new file mode 100644 index 000000000..e7137d2a5 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_bitmask.cpp @@ -0,0 +1,385 @@ +#include <vector> +#include <sstream> + +#ifndef C4CORE_SINGLE_HEADER +#include <c4/bitmask.hpp> +#include <c4/std/vector.hpp> +#endif + +#include <c4/test.hpp> + +#include "./test_enum_common.hpp" + +template<typename Enum> +void cmp_enum(Enum lhs, Enum rhs) +{ + using I = typename std::underlying_type<Enum>::type; + CHECK_EQ(static_cast<I>(lhs), static_cast<I>(rhs)); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + + +TEST_CASE("str2bm.simple_bitmask") +{ + using namespace c4; + std::vector<char> str; + + CHECK_EQ(BM_NONE, str2bm<MyBitmask>("BM_NONE")); + CHECK_EQ(BM_NONE, str2bm<MyBitmask>("NONE")); + CHECK_EQ(BM_NONE, str2bm<MyBitmask>("0")); + CHECK_EQ(BM_NONE, str2bm<MyBitmask>("0x0")); + + CHECK_EQ(BM_FOO, str2bm<MyBitmask>("BM_FOO")); + CHECK_EQ(BM_FOO, str2bm<MyBitmask>("FOO")); + CHECK_EQ(BM_FOO, str2bm<MyBitmask>("1")); + CHECK_EQ(BM_FOO, str2bm<MyBitmask>("0x1")); + CHECK_EQ(BM_FOO, str2bm<MyBitmask>("BM_NONE|0x1")); + + CHECK_EQ(BM_BAR, str2bm<MyBitmask>("BM_BAR")); + CHECK_EQ(BM_BAR, str2bm<MyBitmask>("BAR")); + CHECK_EQ(BM_BAR, str2bm<MyBitmask>("2")); + CHECK_EQ(BM_BAR, str2bm<MyBitmask>("0x2")); + CHECK_EQ(BM_BAR, str2bm<MyBitmask>("BM_NONE|0x2")); + + CHECK_EQ(BM_BAZ, str2bm<MyBitmask>("BM_BAZ")); + CHECK_EQ(BM_BAZ, str2bm<MyBitmask>("BAZ")); + CHECK_EQ(BM_BAZ, str2bm<MyBitmask>("4")); + CHECK_EQ(BM_BAZ, str2bm<MyBitmask>("0x4")); + + CHECK_EQ(BM_FOO_BAR, str2bm<MyBitmask>("BM_FOO|BM_BAR")); + CHECK_EQ(BM_FOO_BAR, str2bm<MyBitmask>("BM_FOO|BAR")); + CHECK_EQ(BM_FOO_BAR, str2bm<MyBitmask>("FOO|BM_BAR")); + CHECK_EQ(BM_FOO_BAR, str2bm<MyBitmask>("BM_FOO_BAR")); + CHECK_EQ(BM_FOO_BAR, str2bm<MyBitmask>("FOO_BAR")); + CHECK_EQ(BM_FOO_BAR, str2bm<MyBitmask>("FOO|BAR")); + CHECK_EQ(BM_FOO_BAR, str2bm<MyBitmask>("0x1|0x2")); + CHECK_EQ(BM_FOO_BAR, str2bm<MyBitmask>("1|2")); + CHECK_EQ(BM_FOO_BAR, str2bm<MyBitmask>("0x3")); + CHECK_EQ(BM_FOO_BAR, str2bm<MyBitmask>("3")); + + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("BM_FOO|BM_BAR|BM_BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("BM_FOO|BM_BAR|BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("BM_FOO|BAR|BM_BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("FOO|BM_BAR|BM_BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("FOO|BM_BAR|BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("FOO|BAR|BM_BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("FOO|BAR|BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("FOO_BAR|BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("BM_FOO_BAR|BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("0x1|BAR|BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("FOO|0x2|BAZ")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("FOO|BAR|0x4")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("0x1|0x2|0x4")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("0x7")); + CHECK_EQ(BM_FOO_BAR_BAZ, str2bm<MyBitmask>("7")); +} + +TEST_CASE("str2bm.scoped_bitmask") +{ + using namespace c4; + std::vector<char> str; + using bmt = MyBitmaskClass; + + cmp_enum(bmt::BM_NONE, (bmt)str2bm<bmt>("MyBitmaskClass::BM_NONE")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("MyBitmaskClass::BM_FOO")); + cmp_enum(bmt::BM_BAR, (bmt)str2bm<bmt>("MyBitmaskClass::BM_BAR")); + cmp_enum(bmt::BM_BAZ, (bmt)str2bm<bmt>("MyBitmaskClass::BM_BAZ")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("MyBitmaskClass::BM_FOO_BAR")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("MyBitmaskClass::BM_FOO_BAR_BAZ")); + cmp_enum(bmt::BM_NONE, (bmt)str2bm<bmt>("BM_NONE")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("BM_FOO")); + cmp_enum(bmt::BM_BAR, (bmt)str2bm<bmt>("BM_BAR")); + cmp_enum(bmt::BM_BAZ, (bmt)str2bm<bmt>("BM_BAZ")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("BM_FOO_BAR")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("BM_FOO_BAR_BAZ")); + cmp_enum(bmt::BM_NONE, (bmt)str2bm<bmt>("NONE")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("FOO")); + cmp_enum(bmt::BM_BAR, (bmt)str2bm<bmt>("BAR")); + cmp_enum(bmt::BM_BAZ, (bmt)str2bm<bmt>("BAZ")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("FOO_BAR")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO_BAR_BAZ")); + + cmp_enum(bmt::BM_NONE, (bmt)str2bm<bmt>("NONE")); + cmp_enum(bmt::BM_NONE, (bmt)str2bm<bmt>("BM_NONE")); + cmp_enum(bmt::BM_NONE, (bmt)str2bm<bmt>("MyBitmaskClass::BM_NONE")); + cmp_enum(bmt::BM_NONE, (bmt)str2bm<bmt>("0")); + cmp_enum(bmt::BM_NONE, (bmt)str2bm<bmt>("0x0")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("FOO")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("BM_FOO")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("MyBitmaskClass::BM_FOO")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("1")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("0x1")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("NONE|0x1")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("BM_NONE|0x1")); + cmp_enum(bmt::BM_FOO, (bmt)str2bm<bmt>("MyBitmaskClass::BM_NONE|0x1")); + cmp_enum(bmt::BM_BAR, (bmt)str2bm<bmt>("BAR")); + cmp_enum(bmt::BM_BAR, (bmt)str2bm<bmt>("BM_BAR")); + cmp_enum(bmt::BM_BAR, (bmt)str2bm<bmt>("MyBitmaskClass::BM_BAR")); + cmp_enum(bmt::BM_BAR, (bmt)str2bm<bmt>("2")); + cmp_enum(bmt::BM_BAR, (bmt)str2bm<bmt>("0x2")); + cmp_enum(bmt::BM_BAZ, (bmt)str2bm<bmt>("BAZ")); + cmp_enum(bmt::BM_BAZ, (bmt)str2bm<bmt>("BM_BAZ")); + cmp_enum(bmt::BM_BAZ, (bmt)str2bm<bmt>("MyBitmaskClass::BM_BAZ")); + cmp_enum(bmt::BM_BAR, (bmt)str2bm<bmt>("BM_NONE|0x2")); + cmp_enum(bmt::BM_BAR, (bmt)str2bm<bmt>("MyBitmaskClass::BM_NONE|0x2")); + cmp_enum(bmt::BM_BAZ, (bmt)str2bm<bmt>("4")); + cmp_enum(bmt::BM_BAZ, (bmt)str2bm<bmt>("0x4")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("BM_FOO|BM_BAR")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("MyBitmaskClass::BM_FOO|MyBitmaskClass::BM_BAR")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("BM_FOO|BAR")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("MyBitmaskClass::BM_FOO|BAR")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("FOO|BM_BAR")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("FOO|MyBitmaskClass::BM_BAR")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("BM_FOO_BAR")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("MyBitmaskClass::BM_FOO_BAR")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("FOO_BAR")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("FOO|BAR")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("0x1|0x2")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("1|2")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("0x3")); + cmp_enum(bmt::BM_FOO_BAR, (bmt)str2bm<bmt>("3")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("BM_FOO|BM_BAR|BM_BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("MyBitmaskClass::BM_FOO|MyBitmaskClass::BM_BAR|MyBitmaskClass::BM_BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("BM_FOO|BM_BAR|BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("MyBitmaskClass::BM_FOO|MyBitmaskClass::BM_BAR|BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("BM_FOO|BAR|BM_BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("BM_FOO|BAR|MyBitmaskClass::BM_BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO|BM_BAR|BM_BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO|MyBitmaskClass::BM_BAR|MyBitmaskClass::BM_BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO|BM_BAR|BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO|MyBitmaskClass::BM_BAR|BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO|BAR|BM_BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO|BAR|MyBitmaskClass::BM_BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO|BAR|BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO_BAR|BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("MyBitmaskClass::BM_FOO_BAR|BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("0x1|BAR|BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO|0x2|BAZ")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("FOO|BAR|0x4")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("0x1|0x2|0x4")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("0x7")); + cmp_enum(bmt::BM_FOO_BAR_BAZ, (bmt)str2bm<bmt>("0x7")); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//---------------------------------------------------------------------------- + +template<class Enum> +const char* do_bm2str(Enum e, std::vector<char> *s, c4::EnumOffsetType which) +{ + size_t len = c4::bm2str<Enum>(e, nullptr, 0, which); + C4_CHECK(len > 0); + s->resize(len); + C4_CHECK(s->data() != nullptr); + c4::bm2str<Enum>(e, s->data(), s->size(), which); + return s->data(); +} + +TEST_CASE("bm2str.simple_bitmask") +{ + using namespace c4; + std::vector<char> str; + + CHECK_STREQ(do_bm2str(BM_NONE, &str, EOFFS_NONE), "BM_NONE"); + CHECK_STREQ(do_bm2str(BM_FOO, &str, EOFFS_NONE), "BM_FOO"); + CHECK_STREQ(do_bm2str(BM_BAR, &str, EOFFS_NONE), "BM_BAR"); + CHECK_STREQ(do_bm2str(BM_BAZ, &str, EOFFS_NONE), "BM_BAZ"); + CHECK_STREQ(do_bm2str(BM_FOO_BAR, &str, EOFFS_NONE), "BM_FOO_BAR"); + CHECK_STREQ(do_bm2str(BM_FOO_BAR_BAZ, &str, EOFFS_NONE), "BM_FOO_BAR_BAZ"); + CHECK_STREQ(do_bm2str(BM_NONE, &str, EOFFS_CLS ), "BM_NONE"); + CHECK_STREQ(do_bm2str(BM_FOO, &str, EOFFS_CLS ), "BM_FOO"); + CHECK_STREQ(do_bm2str(BM_BAR, &str, EOFFS_CLS ), "BM_BAR"); + CHECK_STREQ(do_bm2str(BM_BAZ, &str, EOFFS_CLS ), "BM_BAZ"); + CHECK_STREQ(do_bm2str(BM_FOO_BAR, &str, EOFFS_CLS ), "BM_FOO_BAR"); + CHECK_STREQ(do_bm2str(BM_FOO_BAR_BAZ, &str, EOFFS_CLS ), "BM_FOO_BAR_BAZ"); + CHECK_STREQ(do_bm2str(BM_NONE, &str, EOFFS_PFX ), "NONE"); + CHECK_STREQ(do_bm2str(BM_FOO, &str, EOFFS_PFX ), "FOO"); + CHECK_STREQ(do_bm2str(BM_BAR, &str, EOFFS_PFX ), "BAR"); + CHECK_STREQ(do_bm2str(BM_BAZ, &str, EOFFS_PFX ), "BAZ"); + CHECK_STREQ(do_bm2str(BM_FOO_BAR, &str, EOFFS_PFX ), "FOO_BAR"); + CHECK_STREQ(do_bm2str(BM_FOO_BAR_BAZ, &str, EOFFS_PFX ), "FOO_BAR_BAZ"); +} + +TEST_CASE("bm2str.scoped_bitmask") +{ + using namespace c4; + std::vector<char> str; + + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_NONE, &str, EOFFS_NONE), "MyBitmaskClass::BM_NONE"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_FOO, &str, EOFFS_NONE), "MyBitmaskClass::BM_FOO"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_BAR, &str, EOFFS_NONE), "MyBitmaskClass::BM_BAR"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_BAZ, &str, EOFFS_NONE), "MyBitmaskClass::BM_BAZ"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_FOO_BAR, &str, EOFFS_NONE), "MyBitmaskClass::BM_FOO_BAR"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_FOO_BAR_BAZ, &str, EOFFS_NONE), "MyBitmaskClass::BM_FOO_BAR_BAZ"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_NONE, &str, EOFFS_CLS ), "BM_NONE"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_FOO, &str, EOFFS_CLS ), "BM_FOO"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_BAR, &str, EOFFS_CLS ), "BM_BAR"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_BAZ, &str, EOFFS_CLS ), "BM_BAZ"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_FOO_BAR, &str, EOFFS_CLS ), "BM_FOO_BAR"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_FOO_BAR_BAZ, &str, EOFFS_CLS ), "BM_FOO_BAR_BAZ"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_NONE, &str, EOFFS_PFX ), "NONE"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_FOO, &str, EOFFS_PFX ), "FOO"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_BAR, &str, EOFFS_PFX ), "BAR"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_BAZ, &str, EOFFS_PFX ), "BAZ"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_FOO_BAR, &str, EOFFS_PFX ), "FOO_BAR"); + CHECK_STREQ(do_bm2str(MyBitmaskClass::BM_FOO_BAR_BAZ, &str, EOFFS_PFX ), "FOO_BAR_BAZ"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//---------------------------------------------------------------------------- + +template<class Enum> +std::string do_bm2stream(Enum e, c4::EnumOffsetType which) +{ + std::stringstream ss; + c4::bm2stream<Enum>(ss, e, which); + return ss.str(); +} + +TEST_CASE("bm2stream.simple_bitmask") +{ + using namespace c4; + + CHECK_EQ(do_bm2stream(BM_NONE, EOFFS_NONE), "BM_NONE"); + CHECK_EQ(do_bm2stream(BM_FOO, EOFFS_NONE), "BM_FOO"); + CHECK_EQ(do_bm2stream(BM_BAR, EOFFS_NONE), "BM_BAR"); + CHECK_EQ(do_bm2stream(BM_BAZ, EOFFS_NONE), "BM_BAZ"); + CHECK_EQ(do_bm2stream(BM_FOO_BAR, EOFFS_NONE), "BM_FOO_BAR"); + CHECK_EQ(do_bm2stream(BM_FOO_BAR_BAZ, EOFFS_NONE), "BM_FOO_BAR_BAZ"); + CHECK_EQ(do_bm2stream(BM_NONE, EOFFS_CLS ), "BM_NONE"); + CHECK_EQ(do_bm2stream(BM_FOO, EOFFS_CLS ), "BM_FOO"); + CHECK_EQ(do_bm2stream(BM_BAR, EOFFS_CLS ), "BM_BAR"); + CHECK_EQ(do_bm2stream(BM_BAZ, EOFFS_CLS ), "BM_BAZ"); + CHECK_EQ(do_bm2stream(BM_FOO_BAR, EOFFS_CLS ), "BM_FOO_BAR"); + CHECK_EQ(do_bm2stream(BM_FOO_BAR_BAZ, EOFFS_CLS ), "BM_FOO_BAR_BAZ"); + CHECK_EQ(do_bm2stream(BM_NONE, EOFFS_PFX ), "NONE"); + CHECK_EQ(do_bm2stream(BM_FOO, EOFFS_PFX ), "FOO"); + CHECK_EQ(do_bm2stream(BM_BAR, EOFFS_PFX ), "BAR"); + CHECK_EQ(do_bm2stream(BM_BAZ, EOFFS_PFX ), "BAZ"); + CHECK_EQ(do_bm2stream(BM_FOO_BAR, EOFFS_PFX ), "FOO_BAR"); + CHECK_EQ(do_bm2stream(BM_FOO_BAR_BAZ, EOFFS_PFX ), "FOO_BAR_BAZ"); +} + +TEST_CASE("bm2stream.scoped_bitmask") +{ + using namespace c4; + + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_NONE, EOFFS_NONE), "MyBitmaskClass::BM_NONE"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_FOO, EOFFS_NONE), "MyBitmaskClass::BM_FOO"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_BAR, EOFFS_NONE), "MyBitmaskClass::BM_BAR"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_BAZ, EOFFS_NONE), "MyBitmaskClass::BM_BAZ"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_FOO_BAR, EOFFS_NONE), "MyBitmaskClass::BM_FOO_BAR"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_FOO_BAR_BAZ, EOFFS_NONE), "MyBitmaskClass::BM_FOO_BAR_BAZ"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_NONE, EOFFS_CLS ), "BM_NONE"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_FOO, EOFFS_CLS ), "BM_FOO"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_BAR, EOFFS_CLS ), "BM_BAR"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_BAZ, EOFFS_CLS ), "BM_BAZ"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_FOO_BAR, EOFFS_CLS ), "BM_FOO_BAR"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_FOO_BAR_BAZ, EOFFS_CLS ), "BM_FOO_BAR_BAZ"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_NONE, EOFFS_PFX ), "NONE"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_FOO, EOFFS_PFX ), "FOO"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_BAR, EOFFS_PFX ), "BAR"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_BAZ, EOFFS_PFX ), "BAZ"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_FOO_BAR, EOFFS_PFX ), "FOO_BAR"); + CHECK_EQ(do_bm2stream(MyBitmaskClass::BM_FOO_BAR_BAZ, EOFFS_PFX ), "FOO_BAR_BAZ"); +} + +TEST_CASE("bm2stream.simple_bitmask_without_null_symbol") +{ + using namespace c4; + + CHECK_EQ(do_bm2stream(BM_KABOOM, EOFFS_NONE), "KABOOM"); + CHECK_EQ(do_bm2stream<BmWithoutNull>((BmWithoutNull)0, EOFFS_NONE), "0"); +} + +TEST_CASE("bm2stream.bitmask_class_without_null_symbol") +{ + using namespace c4; + + CHECK_EQ(do_bm2stream(BmClassWithoutNull::BM_KABOOM, EOFFS_PFX), "KABOOM"); + CHECK_EQ(do_bm2stream<BmClassWithoutNull>((BmClassWithoutNull)0, EOFFS_NONE), "0"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//---------------------------------------------------------------------------- + +// TODO +template<typename Enum> +void test_bm2str() +{ + using namespace c4; + using I = typename std::underlying_type<Enum>::type; + int combination_depth = 4; + auto syms = esyms<Enum>(); + + std::vector<int> indices; + std::string str; + std::vector<char> ws; + I val = 0, res; + size_t len; + + for(int k = 1; k <= combination_depth; ++k) + { + indices.clear(); + indices.resize(static_cast<size_t>(k)); + while(1) + { + str.clear(); + val = 0; + for(auto i : indices) + { + if(!str.empty()) str += '|'; + str += syms[i].name; + val |= static_cast<I>(syms[i].value); + //printf("%d", i); + } + //len = bm2str<Enum>(val); // needed length + //ws.resize(len); + //bm2str<Enum>(val, &ws[0], len); + //printf(": %s (%zu) %s\n", str.c_str(), (uint64_t)val, ws.data()); + + res = str2bm<Enum>(str.data()); + CHECK_EQ(res, val); + + len = bm2str<Enum>(res); // needed length + ws.resize(len); + bm2str<Enum>(val, &ws[0], len); + res = str2bm<Enum>(ws.data()); + CHECK_EQ(res, val); + + // write a string with the bitmask as an int + c4::catrs(&ws, val); + res = str2bm<Enum>(str.data()); + CHECK_EQ(res, val); + + bool carry = true; + for(size_t i = static_cast<size_t>(k-1); i != size_t(-1); --i) + { + if(indices[i] + 1 < syms.size()) + { + ++indices[i]; + carry = false; + break; + } + else + { + indices[i] = 0; + } + } + if(carry) + { + break; + } + } // while(1) + } // for k +} diff --git a/thirdparty/ryml/ext/c4core/test/test_blob.cpp b/thirdparty/ryml/ext/c4core/test/test_blob.cpp new file mode 100644 index 000000000..b803ba864 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_blob.cpp @@ -0,0 +1,43 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/blob.hpp" +#endif + +#include "c4/test.hpp" + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wcast-align" +#elif defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wcast-align" +#endif + + +namespace c4 { + +template<class T> +void test_blob() +{ + T v; + blob b(v); + CHECK_EQ((T*)b.buf, &v); + CHECK_EQ(b.len, sizeof(T)); + + blob b2 = b; + CHECK_EQ((T*)b2.buf, &v); + CHECK_EQ(b2.len, sizeof(T)); +} + +TEST_CASE("blob.basic") +{ + test_blob<int>(); +} + + +#ifdef __clang__ +# pragma clang diagnostic pop +#elif defined(__GNUC__) +# pragma GCC diagnostic pop +#endif + +} // namespace c4 diff --git a/thirdparty/ryml/ext/c4core/test/test_char_traits.cpp b/thirdparty/ryml/ext/c4core/test/test_char_traits.cpp new file mode 100644 index 000000000..0f4e01518 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_char_traits.cpp @@ -0,0 +1,67 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/char_traits.hpp" +#endif + +#include "c4/test.hpp" + +namespace c4 { + +TEST_CASE("num_needed_chars.char") +{ + CHECK_EQ(num_needed_chars<char>(0), 0); + CHECK_EQ(num_needed_chars<char>(1), 1); + CHECK_EQ(num_needed_chars<char>(2), 2); + CHECK_EQ(num_needed_chars<char>(3), 3); + CHECK_EQ(num_needed_chars<char>(4), 4); + for(int i = 0; i < 100; ++i) + { + CHECK_EQ(num_needed_chars<char>(i), i); + } +} + +TEST_CASE("num_needed_chars.wchar_t") +{ +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable : 4127) // C4127: conditional expression is constant +#endif + if(sizeof(wchar_t) == 2) + { + CHECK_EQ(num_needed_chars<wchar_t>( 0), 0); + CHECK_EQ(num_needed_chars<wchar_t>( 1), 1); + CHECK_EQ(num_needed_chars<wchar_t>( 2), 1); + CHECK_EQ(num_needed_chars<wchar_t>( 3), 2); + CHECK_EQ(num_needed_chars<wchar_t>( 4), 2); + CHECK_EQ(num_needed_chars<wchar_t>( 97), 49); + CHECK_EQ(num_needed_chars<wchar_t>( 98), 49); + CHECK_EQ(num_needed_chars<wchar_t>( 99), 50); + CHECK_EQ(num_needed_chars<wchar_t>(100), 50); + CHECK_EQ(num_needed_chars<wchar_t>(101), 51); + } + else if(sizeof(wchar_t) == 4) + { + CHECK_EQ(num_needed_chars<wchar_t>( 0), 0); + CHECK_EQ(num_needed_chars<wchar_t>( 1), 1); + CHECK_EQ(num_needed_chars<wchar_t>( 2), 1); + CHECK_EQ(num_needed_chars<wchar_t>( 3), 1); + CHECK_EQ(num_needed_chars<wchar_t>( 4), 1); + CHECK_EQ(num_needed_chars<wchar_t>( 5), 2); + CHECK_EQ(num_needed_chars<wchar_t>( 6), 2); + CHECK_EQ(num_needed_chars<wchar_t>( 7), 2); + CHECK_EQ(num_needed_chars<wchar_t>( 8), 2); + CHECK_EQ(num_needed_chars<wchar_t>( 93), 24); + CHECK_EQ(num_needed_chars<wchar_t>( 94), 24); + CHECK_EQ(num_needed_chars<wchar_t>( 95), 24); + CHECK_EQ(num_needed_chars<wchar_t>( 96), 24); + CHECK_EQ(num_needed_chars<wchar_t>( 97), 25); + CHECK_EQ(num_needed_chars<wchar_t>( 98), 25); + CHECK_EQ(num_needed_chars<wchar_t>( 99), 25); + CHECK_EQ(num_needed_chars<wchar_t>(100), 25); + CHECK_EQ(num_needed_chars<wchar_t>(101), 26); + } +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +} + +} // namespace c4 diff --git a/thirdparty/ryml/ext/c4core/test/test_charconv.cpp b/thirdparty/ryml/ext/c4core/test/test_charconv.cpp new file mode 100644 index 000000000..baa840d1e --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_charconv.cpp @@ -0,0 +1,2743 @@ +#ifdef C4CORE_SINGLE_HEADER +#include "c4/c4core_all.hpp" +#else +#include "c4/std/std.hpp" +#include "c4/charconv.hpp" +#include "c4/format.hpp" +#include "c4/type_name.hpp" +#endif + +#include "c4/libtest/supprwarn_push.hpp" + +C4_SUPPRESS_WARNING_GCC_PUSH +C4_SUPPRESS_WARNING_GCC("-Wfloat-equal") +C4_SUPPRESS_WARNING_GCC("-Wuseless-cast") +C4_SUPPRESS_WARNING_GCC("-Wconversion") +C4_SUPPRESS_WARNING_GCC("-Wtype-limits") +C4_SUPPRESS_WARNING_GCC("-Wfloat-equal") +#if defined (__GNUC__) && __GNUC_MAJOR__ >= 7 +C4_SUPPRESS_WARNING_GCC("-Wno-noexcept-type") +#endif +C4_SUPPRESS_WARNING_CLANG_PUSH +C4_SUPPRESS_WARNING_CLANG("-Wfloat-equal") + +#include <c4/test.hpp> + +#include "./test_numbers.hpp" + +namespace c4 { + +namespace { + +// skip the radix prefix: 0x, -0x, 0X, -0X, 0b, -0B, etc +csubstr nopfx(csubstr num) +{ + if(num.begins_with('-')) + num = num.sub(1); + if(num.len >= 2 && num[0] == '0') + { + switch(num[1]) + { + case 'x': case 'X': + case 'o': case 'O': + case 'b': case 'B': + num = num.sub(2); + } + } + return num; +} + +// filter out the radix prefix from anywhere: 0x, -0x, 0X, -0X, 0b, -0B, etc +csubstr nopfx(substr buf, csubstr num) +{ + REQUIRE_GE(buf.len, num.len); + if(num.begins_with('-')) + num = num.sub(1); + size_t pos = 0; + for(size_t i = 0; i < num.len; ++i) + { + const char c = num.str[i]; + if(c == '0') + { + const char n = i+1 < num.len ? num.str[i+1] : '\0'; + switch(n) + { + case 'x': case 'X': + case 'o': case 'O': + case 'b': case 'B': + ++i; + break; + default: + buf[pos++] = c; + break; + } + } + else + { + buf[pos++] = c; + } + } + return buf.first(pos); +} + +// capitalize the alphabetical characters +// eg 0xdeadbeef --> 0XDEADBEEF +substr capitalize(substr buf, csubstr str) +{ + C4_ASSERT(!buf.overlaps(str)); + memcpy(buf.str, str.str, str.len); + substr ret = buf.first(str.len); + ret.toupper(); + return ret; +} + +// prepend zeroes to the left of the number: +// eg 1234 --> 00001234 +// eg -1234 --> -00001234 +// eg 0x1234 --> 0x00001234 +// eg -0x1234 --> -0x00001234 +substr zpad(substr buf, csubstr str, size_t num_zeroes) +{ + C4_ASSERT(!buf.overlaps(str)); + size_t pos = 0; + if(str.len > 0 && str[0] == '-') + buf.str[pos++] = '-'; + if(str.len >= pos+2 && str[pos] == '0') + { + switch(str[pos+1]) + { + case 'x': case 'X': + case 'o': case 'O': + case 'b': case 'B': + memcpy(buf.str + pos, str.str + pos, 2); + pos += 2; + } + } + memset(buf.str + pos, '0', num_zeroes); + csubstr rem = str.sub(pos); + memcpy(buf.str + pos + num_zeroes, rem.str, rem.len); + return buf.first(str.len + num_zeroes); +} + +// get the front element of the type's test numbers +template<class T> +number_case<T> const& front(size_t skip=0) +{ + return *(numbers<T>::vals + skip); +} + +// get the back element of the type's test numbers +template<class T> +number_case<T> const& back(size_t skip=0) +{ + return *(numbers<T>::vals + C4_COUNTOF(numbers<T>::vals) - 1 - skip); +} + +// given an element, get the n-th element previous to that +template<class T> +number_case<T> const& prev(number_case<T> const& curr, size_t less=1) +{ + C4_ASSERT(less >= 0); + size_t num = C4_COUNTOF(numbers<T>::vals); + C4_ASSERT(&curr >= numbers<T>::vals); + C4_ASSERT(&curr < numbers<T>::vals + num); + size_t icurr = (size_t)(&curr - numbers<T>::vals); + size_t prev = (icurr + num - less) % num; + return *(numbers<T>::vals + prev); +} + +// given an element, get the n-th element after that +template<class T> +number_case<T> const& next(number_case<T> const& curr, size_t more=1) +{ + C4_ASSERT(more >= 0); + size_t num = C4_COUNTOF(numbers<T>::vals); + C4_ASSERT(&curr >= numbers<T>::vals); + C4_ASSERT(&curr < numbers<T>::vals + num); + size_t icurr = (size_t)(&curr - numbers<T>::vals); + size_t next = (icurr + more) % num; + return *(numbers<T>::vals + next); +} + +// construct a string of a value such that it overflows an original value by a given amount +template<class T> +csubstr overflow_by(substr buf, T val, T how_much, T radix) +{ + C4_STATIC_ASSERT(std::is_integral<T>::value); + C4_STATIC_ASSERT(sizeof(T) < sizeof(int64_t)); + using upcast_t = typename std::conditional<std::is_signed<T>::value, int64_t, uint64_t>::type; + upcast_t uval = (upcast_t) val; + uval += (upcast_t) how_much; + size_t len = xtoa(buf, uval, (upcast_t)radix); + REQUIRE_GE(buf.len, len); + return buf.first(len); +} + +// construct a string of a value such that it underflows an original value by a given amount +template<class T> +csubstr underflow_by(substr buf, T val, T how_much, T radix) +{ + C4_STATIC_ASSERT(std::is_integral<T>::value); + C4_STATIC_ASSERT(sizeof(T) < sizeof(int64_t)); + using upcast_t = typename std::conditional<std::is_signed<T>::value, int64_t, uint64_t>::type; + upcast_t uval = (upcast_t) val; + uval -= (upcast_t) how_much; + size_t len = xtoa(buf, uval, (upcast_t)radix); + REQUIRE_GE(buf.len, len); + return buf.first(len); +} + +} // namespace + +TEST_CASE("charconv.to_chars_format") +{ +#if C4CORE_HAVE_STD_TO_CHARS + CHECK(FTOA_FLOAT == static_cast<std::underlying_type<std::chars_format>::type>(std::chars_format::fixed)); + CHECK(FTOA_SCIENT == static_cast<std::underlying_type<std::chars_format>::type>(std::chars_format::scientific)); + CHECK(FTOA_FLEX == static_cast<std::underlying_type<std::chars_format>::type>(std::chars_format::general)); + CHECK(FTOA_HEXA == static_cast<std::underlying_type<std::chars_format>::type>(std::chars_format::hex)); +#elif !C4CORE_HAVE_FAST_FLOAT + CHECK(FTOA_FLOAT == 'f'); + CHECK(FTOA_SCIENT == 'e'); + CHECK(FTOA_FLEX == 'g'); + CHECK(FTOA_HEXA == 'a'); +#endif +} + + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("test_util.number_cases", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + CHECK_GT(number.dec.len, 0); + CHECK_GT(number.hex.len, 2); + CHECK_GT(number.oct.len, 2); + CHECK_GT(number.bin.len, 2); + CHECK_UNARY(number.hex.begins_with("0x")); + CHECK_UNARY(number.oct.begins_with("0o")); + CHECK_UNARY(number.bin.begins_with("0b")); + } + REQUIRE_GT(C4_COUNTOF(numbers<T>::vals), 2); + // + CHECK_EQ(&front<T>(), numbers<T>::vals + 0); + CHECK_EQ(&front<T>(0), numbers<T>::vals + 0); + CHECK_EQ(&front<T>(1), numbers<T>::vals + 1); + // + CHECK_EQ(&back<T>(), numbers<T>::vals + C4_COUNTOF(numbers<T>::vals) - 1); + CHECK_EQ(&back<T>(0), numbers<T>::vals + C4_COUNTOF(numbers<T>::vals) - 1); + CHECK_EQ(&back<T>(1), numbers<T>::vals + C4_COUNTOF(numbers<T>::vals) - 2); + // + CHECK_EQ(&next(front<T>() ), numbers<T>::vals + 1); + CHECK_EQ(&next(front<T>(), T(1)), numbers<T>::vals + 1); + CHECK_EQ(&next(front<T>(), T(2)), numbers<T>::vals + 2); + // + CHECK_EQ(&next(back<T>() ), numbers<T>::vals + 0); + CHECK_EQ(&next(back<T>(), T(1)), numbers<T>::vals + 0); + CHECK_EQ(&next(back<T>(), T(2)), numbers<T>::vals + 1); + CHECK_EQ(&next(back<T>(), T(3)), numbers<T>::vals + 2); + // + CHECK_EQ(&prev(front<T>()), numbers<T>::vals + C4_COUNTOF(numbers<T>::vals) - 1); + CHECK_EQ(&prev(front<T>(), T(1)), numbers<T>::vals + C4_COUNTOF(numbers<T>::vals) - 1); + CHECK_EQ(&prev(front<T>(), T(2)), numbers<T>::vals + C4_COUNTOF(numbers<T>::vals) - 2); + // + CHECK_EQ(&prev(back<T>()), numbers<T>::vals + C4_COUNTOF(numbers<T>::vals) - 2); + CHECK_EQ(&prev(back<T>(), T(1)), numbers<T>::vals + C4_COUNTOF(numbers<T>::vals) - 2); + CHECK_EQ(&prev(back<T>(), T(2)), numbers<T>::vals + C4_COUNTOF(numbers<T>::vals) - 3); +} + +TEST_CASE("test_util.overflow_by") +{ + char buf_[128]; + substr buf = buf_; + REQUIRE_EQ(overflow_by<int8_t>(buf, INT8_C(127), INT8_C(0), INT8_C(10)), "127"); + REQUIRE_EQ(overflow_by<int8_t>(buf, INT8_C(127), INT8_C(0), INT8_C(16)), "0x7f"); + REQUIRE_EQ(overflow_by<int8_t>(buf, INT8_C(127), INT8_C(1), INT8_C(10)), "128"); + REQUIRE_EQ(overflow_by<int8_t>(buf, INT8_C(127), INT8_C(1), INT8_C(16)), "0x80"); + REQUIRE_EQ(overflow_by<int8_t>(buf, INT8_C(127), INT8_C(2), INT8_C(10)), "129"); + REQUIRE_EQ(overflow_by<int8_t>(buf, INT8_C(127), INT8_C(2), INT8_C(16)), "0x81"); +} + +TEST_CASE("test_util.underflow_by") +{ + char buf_[128]; + substr buf = buf_; + REQUIRE_EQ(underflow_by<int8_t>(buf, INT8_C(-128), INT8_C(0), INT8_C(10)), "-128"); + REQUIRE_EQ(underflow_by<int8_t>(buf, INT8_C(-128), INT8_C(0), INT8_C(16)), "-0x80"); + REQUIRE_EQ(underflow_by<int8_t>(buf, INT8_C(-128), INT8_C(1), INT8_C(10)), "-129"); + REQUIRE_EQ(underflow_by<int8_t>(buf, INT8_C(-128), INT8_C(1), INT8_C(16)), "-0x81"); + REQUIRE_EQ(underflow_by<int8_t>(buf, INT8_C(-128), INT8_C(2), INT8_C(10)), "-130"); + REQUIRE_EQ(underflow_by<int8_t>(buf, INT8_C(-128), INT8_C(2), INT8_C(16)), "-0x82"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("digits_dec", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + CHECK_EQ(digits_dec(number.val), nopfx(number.dec).len); + } +} + +TEST_CASE_TEMPLATE("digits_hex", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + CHECK_EQ(digits_hex(number.val), nopfx(number.hex).len); + } +} + +TEST_CASE_TEMPLATE("digits_oct", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + CHECK_EQ(digits_oct(number.val), nopfx(number.oct).len); + } +} + + +TEST_CASE_TEMPLATE("digits_bin", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + CHECK_EQ(digits_bin(number.val), nopfx(number.bin).len); + } +} + + +//----------------------------------------------------------------------------- +TEST_CASE_TEMPLATE("write_dec_unchecked", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + unsigned digits = digits_dec(number.val); + REQUIRE_GE(buf.len, digits); + write_dec_unchecked(buf, number.val, digits); + CHECK_EQ(buf.first(digits), nopfx(number.dec)); + } +} + +TEST_CASE_TEMPLATE("write_hex_unchecked", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + unsigned digits = digits_hex(number.val); + REQUIRE_GE(buf.len, digits); + write_hex_unchecked(buf, number.val, digits); + CHECK_EQ(buf.first(digits), nopfx(number.hex)); + } +} + +TEST_CASE_TEMPLATE("write_oct_unchecked", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + unsigned digits = digits_hex(number.val); + REQUIRE_GE(buf.len, digits); + write_hex_unchecked(buf, number.val, digits); + CHECK_EQ(buf.first(digits), nopfx(number.hex)); + } +} + +TEST_CASE_TEMPLATE("write_bin_unchecked", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + unsigned digits = digits_bin(number.val); + REQUIRE_GE(buf.len, digits); + write_bin_unchecked(buf, number.val, digits); + CHECK_EQ(buf.first(digits), nopfx(number.bin)); + } +} + + +//----------------------------------------------------------------------------- +TEST_CASE_TEMPLATE("write_dec", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + REQUIRE_GE(buf.len, number.dec.len); + size_t retn = write_dec(substr{}, number.val); + CHECK_EQ(retn, number.dec.len); + size_t retb = write_dec(buf, number.val); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retb, number.dec.len); + CHECK_EQ(buf.first(retb), number.dec); + } +} + +TEST_CASE_TEMPLATE("write_hex", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + REQUIRE_GE(buf.len, number.hex.sub(2).len); + size_t retn = write_hex(substr{}, number.val); + CHECK_EQ(retn, number.hex.sub(2).len); + size_t retb = write_hex(buf, number.val); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retb, number.hex.sub(2).len); + CHECK_EQ(buf.first(retb), number.hex.sub(2)); + } +} + +TEST_CASE_TEMPLATE("write_oct", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + REQUIRE_GE(buf.len, number.oct.sub(2).len); + size_t retn = write_oct(substr{}, number.val); + CHECK_EQ(retn, number.oct.sub(2).len); + size_t retb = write_oct(buf, number.val); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retb, number.oct.sub(2).len); + CHECK_EQ(buf.first(retb), nopfx(number.oct)); + } +} + +TEST_CASE_TEMPLATE("write_bin", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + REQUIRE_GE(buf.len, number.bin.sub(2).len); + size_t retb = write_bin(substr{}, number.val); + CHECK_EQ(retb, number.bin.sub(2).len); + size_t retn = write_bin(buf, number.val); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retb, number.bin.sub(2).len); + CHECK_EQ(buf.first(retb), nopfx(number.bin)); + } +} + + +//----------------------------------------------------------------------------- +TEST_CASE_TEMPLATE("write_dec_digits", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("num digits smaller than length") + { + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + for(int less_ : {0, 1, 2, 4, 8, (int)number.dec.len}) + { + size_t less = (size_t) less_; + if(less > number.dec.len) + continue; + size_t num_digits = number.dec.len - less; + INFO("less=" << less << " num_digits=" << num_digits); + size_t retn = write_dec(substr{}, number.val, num_digits); + CHECK_EQ(retn, number.dec.len); // the number must always be written + size_t retb = write_dec(buf, number.val, num_digits); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retb, number.dec.len); + CHECK_EQ(buf.first(retb), number.dec); + } + } + } + SUBCASE("num digits larger than length") + { + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + for(int more_ : {1, 2, 4, 8}) + { + size_t more = (size_t) more_; + size_t num_digits = number.dec.len + more; + INFO("more=" << more << " num_digits=" << num_digits); + size_t retn = write_dec(substr{}, number.val, num_digits); + CHECK_EQ(retn, num_digits); + size_t retb = write_dec(buf, number.val, num_digits); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retb, num_digits); + csubstr result = buf.first(retb); + CHECK_EQ(result.last(number.dec.len), number.dec); + if(number.val) + { + CHECK_EQ(result.triml('0'), number.dec); + CHECK_EQ(result.first_not_of('0'), more); + } + else + { + CHECK(result.begins_with('0')); + CHECK_EQ(result.first_not_of('0'), csubstr::npos); + } + } + } + } +} + +TEST_CASE_TEMPLATE("write_hex_digits", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("num digits smaller than length") + { + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + for(int less_ : {0, 1, 2, 4, 8, (int)number.hex.len}) + { + const csubstr hex = nopfx(number.hex); + size_t less = (size_t) less_; + if(less > hex.len) + continue; + size_t num_digits = hex.len - less; + INFO("less=" << less << " num_digits=" << num_digits); + size_t retn = write_hex(substr{}, number.val, num_digits); + CHECK_EQ(retn, hex.len); // the number must always be written + size_t retb = write_hex(buf, number.val, num_digits); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retb, hex.len); + CHECK_EQ(buf.first(retb), hex); + } + } + } + SUBCASE("num digits larger than length") + { + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + for(int more_ : {1, 2, 4, 8}) + { + const csubstr hex = nopfx(number.hex); + size_t more = (size_t) more_; + size_t num_digits = hex.len + more; + INFO("more=" << more << " num_digits=" << num_digits); + size_t retn = write_hex(substr{}, number.val, num_digits); + CHECK_EQ(retn, num_digits); + size_t retb = write_hex(buf, number.val, num_digits); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retn, num_digits); + csubstr result = buf.first(retn); + CHECK_EQ(result.last(hex.len), hex); + if(number.val) + { + CHECK_EQ(result.triml('0'), hex); + CHECK_EQ(result.first_not_of('0'), more); + } + else + { + CHECK(result.begins_with('0')); + CHECK_EQ(result.first_not_of('0'), csubstr::npos); + } + } + } + } +} + +TEST_CASE_TEMPLATE("write_oct_digits", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("num digits smaller than length") + { + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + for(int less_ : {0, 1, 2, 4, 8, (int)number.oct.len}) + { + const csubstr oct = nopfx(number.oct); + size_t less = (size_t) less_; + if(less > oct.len) + continue; + size_t num_digits = oct.len - less; + INFO("less=" << less << " num_digits=" << num_digits); + size_t retn = write_oct(substr{}, number.val, num_digits); + CHECK_EQ(retn, oct.len); // the number must always be written + size_t retb = write_oct(buf, number.val, num_digits); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retb, oct.len); + CHECK_EQ(buf.first(retb), oct); + } + } + } + SUBCASE("num digits larger than length") + { + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + for(int more_ : {1, 2, 4, 8}) + { + const csubstr oct = nopfx(number.oct); + size_t more = (size_t) more_; + size_t num_digits = oct.len + more; + INFO("more=" << more << " num_digits=" << num_digits); + size_t retn = write_oct(substr{}, number.val, num_digits); + CHECK_EQ(retn, num_digits); + size_t retb = write_oct(buf, number.val, num_digits); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retb, num_digits); + csubstr result = buf.first(retb); + CHECK_EQ(result.last(oct.len), oct); + if(number.val) + { + CHECK_EQ(result.triml('0'), oct); + CHECK_EQ(result.first_not_of('0'), more); + } + else + { + CHECK(result.begins_with('0')); + CHECK_EQ(result.first_not_of('0'), csubstr::npos); + } + } + } + } +} + +TEST_CASE_TEMPLATE("write_bin_digits", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("num digits smaller than length") + { + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + for(int less_ : {0, 1, 2, 4, 8, (int)number.bin.len}) + { + const csubstr bin = nopfx(number.bin); + size_t less = (size_t) less_; + if(less > bin.len) + continue; + size_t num_digits = bin.len - less; + INFO("less=" << less << " num_digits=" << num_digits); + size_t retn = write_bin(substr{}, number.val, num_digits); + CHECK_EQ(retn, bin.len); // the number must always be written + size_t retb = write_bin(buf, number.val, num_digits); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retb, bin.len); + CHECK_EQ(buf.first(retb), bin); + } + } + } + SUBCASE("num digits larger than length") + { + ITER_NUMBERS(T, number) + { + if(number.val < 0) + continue; + INFO(number); + for(int more_ : {1, 2, 4, 8}) + { + const csubstr bin = nopfx(number.bin); + size_t more = (size_t) more_; + size_t num_digits = bin.len + more; + INFO("more=" << more << " num_digits=" << num_digits); + size_t retn = write_bin(substr{}, number.val, num_digits); + CHECK_EQ(retn, num_digits); + size_t retb = write_bin(buf, number.val, num_digits); + CHECK_EQ(retb, retn); + REQUIRE_EQ(retn, num_digits); + csubstr result = buf.first(retn); + CHECK_EQ(result.last(bin.len), bin); + if(number.val) + { + CHECK_EQ(result.triml('0'), bin); + CHECK_EQ(result.first_not_of('0'), more); + } + else + { + CHECK(result.begins_with('0')); + CHECK_EQ(result.first_not_of('0'), csubstr::npos); + } + } + } + } +} + + +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("xtoa", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + INFO(number); + { + buf.fill('?'); + size_t retn = xtoa(substr{}, number.val); + CHECK_EQ(retn, number.dec.len); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + CHECK_EQ(buf.first(retb), number.dec); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + } +} + + +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("xtoa_radix.dec", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + INFO(number); + { + buf.fill('?'); + size_t retn = xtoa(substr{}, number.val, T(10)); + CHECK_EQ(retn, number.dec.len); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(10)); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + CHECK_EQ(buf.first(retb), number.dec); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + const size_t adj = size_t(number.val < 0); + REQUIRE_LT(adj, number.dec.len); + const size_t dec_digits = number.dec.len - adj; + for(size_t more_digits = 0; more_digits < 6; ++more_digits) + { + buf.fill('?'); + size_t reqdigits = dec_digits + more_digits; + INFO("dec_digits=" << dec_digits << " more_digits=" << more_digits << " req_digits=" << reqdigits); + size_t retn = xtoa(substr{}, number.val, T(10), reqdigits); + CHECK_EQ(retn, reqdigits + size_t(number.val < 0)); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(10), reqdigits); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + CHECK(buf.first(retb).ends_with(number.dec.sub(number.val < 0))); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + for(size_t less_digits = 0; less_digits < dec_digits; ++less_digits) + { + buf.fill('?'); + size_t reqdigits = dec_digits - less_digits; + INFO("dec_digits=" << dec_digits << " less_digits=" << less_digits << " req_digits=" << reqdigits); + size_t retn = xtoa(substr{}, number.val, T(10), reqdigits); + CHECK_EQ(retn, number.dec.len); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(10), reqdigits); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + CHECK(buf.first(retb).ends_with(number.dec.sub(number.val < 0))); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + } +} + +TEST_CASE_TEMPLATE("xtoa_radix.hex", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + INFO(number); + { + buf.fill('?'); + size_t retn = xtoa(substr{}, number.val, T(16)); + CHECK_EQ(retn, number.hex.len); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(16)); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + CHECK_EQ(buf.first(retb), number.hex); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + const size_t adj = size_t(number.val < 0) + size_t(2); // 2 for 0x + REQUIRE_LT(adj, number.hex.len); + const size_t hex_digits = number.hex.len - adj; + for(size_t more_digits = 0; more_digits < 6; ++more_digits) + { + buf.fill('?'); + size_t reqdigits = hex_digits + more_digits; + INFO("more_digits=" << more_digits << " reqdigits=" << reqdigits); + size_t retn = xtoa(substr{}, number.val, T(16), reqdigits); + CHECK_EQ(retn, reqdigits + adj); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(16), reqdigits); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + csubstr result = buf.first(retb); + csubstr ref = number.hex.sub(adj); + INFO("result=" << result << " ref=" << ref); + if(number.val < 0) + CHECK(buf.first(retb).begins_with('-')); + CHECK(result.ends_with(ref)); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + for(size_t less_digits = 0; less_digits < hex_digits; ++less_digits) + { + buf.fill('?'); + size_t reqdigits = hex_digits - less_digits; + INFO("hex_digits=" << hex_digits << " less_digits=" << less_digits << " req_digits=" << reqdigits); + size_t retn = xtoa(substr{}, number.val, T(16), reqdigits); + CHECK_EQ(retn, number.hex.len); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(16), reqdigits); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + CHECK(buf.first(retb).ends_with(number.hex.sub(number.val < 0))); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + } +} + +TEST_CASE_TEMPLATE("xtoa_radix.oct", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + INFO(number); + { + buf.fill('?'); + size_t retn = xtoa(substr{}, number.val, T(8)); + CHECK_EQ(retn, number.oct.len); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(8)); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + CHECK_EQ(buf.first(retb), number.oct); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + const size_t adj = size_t(number.val < 0) + size_t(2); // 2 for 0o + REQUIRE_LT(adj, number.oct.len); + const size_t oct_digits = number.oct.len - adj; + for(size_t more_digits = 0; more_digits < 6; ++more_digits) + { + buf.fill('?'); + size_t reqdigits = oct_digits + more_digits; + INFO("more_digits=" << more_digits << " reqdigits=" << reqdigits); + size_t retn = xtoa(substr{}, number.val, T(8), reqdigits); + CHECK_EQ(retn, reqdigits + adj); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(8), reqdigits); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + csubstr result = buf.first(retb); + csubstr ref = number.oct.sub(adj); + INFO("result=" << result << " ref=" << ref); + if(number.val < 0) + CHECK(buf.first(retb).begins_with('-')); + CHECK(result.ends_with(ref)); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + for(size_t less_digits = 0; less_digits < oct_digits; ++less_digits) + { + buf.fill('?'); + size_t reqdigits = oct_digits - less_digits; + INFO("oct_digits=" << oct_digits << " less_digits=" << less_digits << " req_digits=" << reqdigits); + size_t retn = xtoa(substr{}, number.val, T(8), reqdigits); + CHECK_EQ(retn, number.oct.len); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(8), reqdigits); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + CHECK(buf.first(retb).ends_with(number.oct.sub(number.val < 0))); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + } +} + +TEST_CASE_TEMPLATE("xtoa_radix.bin", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + ITER_NUMBERS(T, number) + { + INFO(number); + { + buf.fill('?'); + size_t retn = xtoa(substr{}, number.val, T(2)); + CHECK_EQ(retn, number.bin.len); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(2)); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + CHECK_EQ(buf.first(retb), number.bin); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + const size_t adj = size_t(number.val < 0) + size_t(2); // 2 for 0b + REQUIRE_LT(adj, number.bin.len); + const size_t bin_digits = number.bin.len - adj; + for(size_t more_digits = 0; more_digits < 6; ++more_digits) + { + buf.fill('?'); + size_t reqdigits = bin_digits + more_digits; + INFO("more_digits=" << more_digits << " reqdigits=" << reqdigits); + size_t retn = xtoa(substr{}, number.val, T(2), reqdigits); + CHECK_EQ(retn, reqdigits + adj); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(2), reqdigits); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + csubstr result = buf.first(retb); + csubstr ref = number.bin.sub(adj); + INFO("result=" << result << " ref=" << ref); + if(number.val < 0) + CHECK(buf.first(retb).begins_with('-')); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + for(size_t less_digits = 0; less_digits < bin_digits; ++less_digits) + { + buf.fill('?'); + size_t reqdigits = bin_digits - less_digits; + INFO("bin_digits=" << bin_digits << " less_digits=" << less_digits << " req_digits=" << reqdigits); + size_t retn = xtoa(substr{}, number.val, T(2), reqdigits); + CHECK_EQ(retn, number.bin.len); + CHECK_UNARY(buf.begins_with('?') && buf.first_not_of('?') == csubstr::npos); + size_t retb = xtoa(buf, number.val, T(2), reqdigits); + CHECK_EQ(retn, retb); + REQUIRE_LE(retb, buf.len); + CHECK(buf.first(retb).ends_with(number.bin.sub(number.val < 0))); + T after_roundtrip = number.val + T(1); + CHECK(atox(buf.first(retb), &after_roundtrip)); + CHECK_EQ(after_roundtrip, number.val); + } + } +} + + +//----------------------------------------------------------------------------- + + +TEST_CASE_TEMPLATE("overflows.in_range_does_not_overflow", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("dec") + { + ITER_NUMBERS(T, number) + { + INFO(number); + CHECK_FALSE(overflows<T>(number.dec)); + CHECK_FALSE(overflows<T>(capitalize(buf, number.dec))); + for(size_t numz : {1u, 4u, 6u}) + { + substr buf2 = zpad(buf, number.dec, numz); + CHECK_FALSE(overflows<T>(buf2)); + buf2.toupper(); + CHECK_FALSE(overflows<T>(buf2)); + } + } + } + SUBCASE("hex") + { + ITER_NUMBERS(T, number) + { + INFO(number); + CHECK_FALSE(overflows<T>(number.hex)); + CHECK_FALSE(overflows<T>(capitalize(buf, number.hex))); + for(size_t numz : {1u, 4u, 6u}) + { + substr buf2 = zpad(buf, number.hex, numz); + CHECK_FALSE(overflows<T>(buf2)); + buf2.toupper(); + CHECK_FALSE(overflows<T>(buf2)); + } + } + } + SUBCASE("oct") + { + ITER_NUMBERS(T, number) + { + INFO(number); + CHECK_FALSE(overflows<T>(number.oct)); + CHECK_FALSE(overflows<T>(capitalize(buf, number.oct))); + for(size_t numz : {1u, 4u, 6u}) + { + substr buf2 = zpad(buf, number.oct, numz); + CHECK_FALSE(overflows<T>(buf2)); + buf2.toupper(); + CHECK_FALSE(overflows<T>(buf2)); + } + } + } + SUBCASE("bin") + { + ITER_NUMBERS(T, number) + { + INFO(number); + CHECK_FALSE(overflows<T>(number.bin)); + CHECK_FALSE(overflows<T>(capitalize(buf, number.bin))); + for(size_t numz : {1u, 4u, 6u}) + { + substr buf2 = zpad(buf, number.bin, numz); + CHECK_FALSE(overflows<T>(buf2)); + buf2.toupper(); + CHECK_FALSE(overflows<T>(buf2)); + } + } + } +} + + +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("read_dec", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("numbers") + { + ITER_NUMBERS(T, number) + { + if(number.val < T(0)) + continue; + INFO(number); + { + T val = number.val + T(1); + CHECK(read_dec(number.dec, &val)); + CHECK_EQ(val, number.val); + } + // capitalize + { + T val = number.val + T(1); + csubstr cbuf = capitalize(buf, number.dec); + CHECK(read_dec(cbuf, &val)); + CHECK_EQ(val, number.val); + } + // zero-prefix + for(size_t numz : {1u, 4u, 6u}) + { + T val = number.val + T(1); + substr buf2 = zpad(buf, number.dec, numz); + INFO("zprefix=" << buf2); + CHECK(read_dec(buf2, &val)); + CHECK_EQ(val, number.val); + buf2.toupper(); + CHECK(read_dec(buf2, &val)); + CHECK_EQ(val, number.val); + } + } + } + SUBCASE("fail") + { + T val = {}; + for(auto ic : invalid_cases) + { + if(ic.dec.empty()) + continue; + INFO(ic.dec); + CHECK(!read_dec(ic.dec, &val)); + } + } +} + +TEST_CASE_TEMPLATE("read_hex", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("numbers") + { + ITER_NUMBERS(T, number) + { + if(number.val < T(0)) + continue; + INFO(number); + // must not accept 0x prefix + { + T val = number.val + T(1); + CHECK(!read_hex(number.hex, &val)); + } + // must accept without prefix + csubstr hex = nopfx(number.hex); + INFO("nopfx(hex)=" << hex); + { + T val = number.val + T(1); + CHECK(read_hex(hex, &val)); + CHECK_EQ(val, number.val); + } + // capitalize + { + csubstr cbuf = capitalize(buf, hex); + INFO("capitalized=" << buf); + REQUIRE_EQ(cbuf.len, hex.len); + T val = number.val + T(1); + CHECK(read_hex(cbuf, &val)); + CHECK_EQ(val, number.val); + } + // zero-prefix + for(size_t numz : {1u, 4u, 6u}) + { + T val = number.val + T(1); + substr zprefix = zpad(buf, hex, numz); + INFO("zprefix='" << zprefix << "'"); + CHECK(read_hex(zprefix, &val)); + CHECK_EQ(val, number.val); + zprefix.toupper(); + CHECK(read_hex(zprefix, &val)); + CHECK_EQ(val, number.val); + } + } + } + SUBCASE("fail") + { + char buf2_[128] = {}; + substr buf2 = buf2_; + size_t icase = 0; + for(auto const& ic : invalid_cases) + { + csubstr cbuf = nopfx(buf, ic.hex); + csubstr cbuf2 = capitalize(buf2, cbuf); + INFO("case#=" << icase << " hex='" << ic.hex << "' nopfx(hex)='" << cbuf << "' capitalize(nopfx(hex))='" << cbuf2 << "'"); + REQUIRE_EQ(cbuf2.len, cbuf.len); + // must not accept 0x prefix + if(ic.hex.len) + { + T val = {}; + CHECK(!read_hex(ic.hex, &val)); + } + // it is invalid; must not accept even without 0x prefix + if(cbuf.len) + { + T val = {}; + CHECK(!read_hex(cbuf, &val)); + } + // capitalize + if(cbuf2.len) + { + T val = {}; + CHECK(!read_hex(cbuf2, &val)); + } + ++icase; + } + } +} + +TEST_CASE_TEMPLATE("read_oct", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("numbers") + { + ITER_NUMBERS(T, number) + { + if(number.val < T(0)) + continue; + INFO(number); + // must not accept 0x prefix + { + T val = number.val + T(1); + CHECK(!read_oct(number.oct, &val)); + } + // must accept without prefix + csubstr oct = nopfx(number.oct); + INFO("nopfx(oct)=" << oct); + { + T val = number.val + T(1); + CHECK(read_oct(oct, &val)); + CHECK_EQ(val, number.val); + } + // capitalize + { + csubstr cbuf = capitalize(buf, oct); + INFO("capitalized=" << buf); + REQUIRE_EQ(cbuf.len, oct.len); + T val = number.val + T(1); + CHECK(read_oct(cbuf, &val)); + CHECK_EQ(val, number.val); + } + // zero-prefix + for(size_t numz : {1u, 4u, 6u}) + { + T val = number.val + T(1); + substr zprefix = zpad(buf, oct, numz); + INFO("zprefix=" << zprefix); + CHECK(read_oct(zprefix, &val)); + CHECK_EQ(val, number.val); + zprefix.toupper(); + CHECK(read_oct(zprefix, &val)); + CHECK_EQ(val, number.val); + } + } + } + SUBCASE("fail") + { + char buf2_[128] = {}; + substr buf2 = buf2_; + size_t icase = 0; + for(auto const& ic : invalid_cases) + { + csubstr cbuf = nopfx(buf, ic.oct); + csubstr cbuf2 = capitalize(buf2, cbuf); + INFO("case#=" << icase << " oct='" << ic.oct << "' nopfx(oct)='" << cbuf << "' capitalize(nopfx(oct))='" << cbuf2 << "'"); + REQUIRE_EQ(cbuf2.len, cbuf.len); + // must not accept 0x prefix + if(ic.oct.len) + { + T val = {}; + CHECK(!read_oct(ic.oct, &val)); + } + // it is invalid; must not accept even without 0x prefix + if(cbuf.len) + { + T val = {}; + CHECK(!read_oct(cbuf, &val)); + } + // capitalize + if(cbuf2.len) + { + T val = {}; + CHECK(!read_oct(cbuf2, &val)); + } + ++icase; + } + } +} + +TEST_CASE_TEMPLATE("read_bin", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("numbers") + { + ITER_NUMBERS(T, number) + { + if(number.val < T(0)) + continue; + INFO(number); + // must not accept 0x prefix + { + T val = number.val + T(1); + CHECK(!read_bin(number.bin, &val)); + } + // must accept without prefix + csubstr bin = nopfx(number.bin); + INFO("nopfx(bin)=" << bin); + { + T val = number.val + T(1); + CHECK(read_bin(bin, &val)); + CHECK_EQ(val, number.val); + } + // capitalize + { + csubstr cbuf = capitalize(buf, bin); + INFO("capitalized=" << buf); + REQUIRE_EQ(cbuf.len, bin.len); + T val = number.val + T(1); + CHECK(read_bin(cbuf, &val)); + CHECK_EQ(val, number.val); + } + // zero-prefix + for(size_t numz : {1u, 4u, 6u}) + { + T val = number.val + T(1); + substr zprefix = zpad(buf, bin, numz); + INFO("zprefix=" << zprefix); + CHECK(read_bin(zprefix, &val)); + CHECK_EQ(val, number.val); + zprefix.toupper(); + CHECK(read_bin(zprefix, &val)); + CHECK_EQ(val, number.val); + } + } + } + SUBCASE("fail") + { + char buf2_[128] = {}; + substr buf2 = buf2_; + size_t icase = 0; + for(auto const& ic : invalid_cases) + { + csubstr cbuf = nopfx(buf, ic.bin); + csubstr cbuf2 = capitalize(buf2, cbuf); + INFO("case#=" << icase << " bin='" << ic.bin << "' nopfx(bin)='" << cbuf << "' capitalize(nopfx(bin))='" << cbuf2 << "'"); + REQUIRE_EQ(cbuf2.len, cbuf.len); + // must not accept 0x prefix + if(ic.bin.len) + { + T val = {}; + CHECK(!read_bin(ic.bin, &val)); + } + // it is invalid; must not accept even without 0x prefix + if(cbuf.len) + { + T val = {}; + CHECK(!read_bin(cbuf, &val)); + } + // capitalize + if(cbuf2.len) + { + T val = {}; + CHECK(!read_bin(cbuf2, &val)); + } + ++icase; + } + } +} + + +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("atox", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("dec") + { + ITER_NUMBERS(T, number) + { + INFO(number); + { + T val = number.val + T(1); + CHECK(atox(number.dec, &val)); + CHECK_EQ(val, number.val); + } + // zero-prefix + for(size_t numz : {1u, 4u, 6u}) + { + T val = number.val + T(1); + substr zprefix = zpad(buf, number.dec, numz); + INFO("zprefix=" << zprefix); + CHECK(atox(zprefix, &val)); + CHECK_EQ(val, number.val); + } + } + } + SUBCASE("hex") + { + ITER_NUMBERS(T, number) + { + INFO(number); + { + T val = number.val + T(1); + CHECK(atox(number.hex, &val)); + CHECK_EQ(val, number.val); + } + // capitalize + { + T val = number.val + T(1); + csubstr cbuf = capitalize(buf, number.hex); + CHECK(atox(cbuf, &val)); + CHECK_EQ(val, number.val); + } + // zero-prefix + for(size_t numz : {1u, 4u, 6u}) + { + T val = number.val + T(1); + substr zprefix = zpad(buf, number.hex, numz); + INFO("zprefix=" << zprefix); + CHECK(atox(zprefix, &val)); + CHECK_EQ(val, number.val); + zprefix.toupper(); + CHECK(atox(zprefix, &val)); + CHECK_EQ(val, number.val); + } + } + } + SUBCASE("oct") + { + ITER_NUMBERS(T, number) + { + INFO(number); + { + T val = number.val + T(1); + CHECK(atox(number.oct, &val)); + CHECK_EQ(val, number.val); + } + // capitalize + { + T val = number.val + T(1); + csubstr cbuf = capitalize(buf, number.oct); + CHECK(atox(cbuf, &val)); + CHECK_EQ(val, number.val); + } + // zero-prefix + for(size_t numz : {1u, 4u, 6u}) + { + T val = number.val + T(1); + substr zprefix = zpad(buf, number.oct, numz); + INFO("zprefix=" << zprefix); + CHECK(atox(zprefix, &val)); + CHECK_EQ(val, number.val); + zprefix.toupper(); + CHECK(atox(zprefix, &val)); + CHECK_EQ(val, number.val); + } + } + } + SUBCASE("bin") + { + ITER_NUMBERS(T, number) + { + INFO(number); + { + T val = number.val + T(1); + CHECK(atox(number.bin, &val)); + CHECK_EQ(val, number.val); + } + // capitalize + { + T val = number.val + T(1); + csubstr cbuf = capitalize(buf, number.bin); + CHECK(atox(cbuf, &val)); + CHECK_EQ(val, number.val); + } + // zero-prefix + for(size_t numz : {1u, 4u, 6u}) + { + T val = number.val + T(1); + substr zprefix = zpad(buf, number.oct, numz); + INFO("zprefix=" << zprefix); + CHECK(atox(zprefix, &val)); + CHECK_EQ(val, number.val); + zprefix.toupper(); + CHECK(atox(zprefix, &val)); + CHECK_EQ(val, number.val); + } + } + } +} + +TEST_CASE_TEMPLATE("atox.fail", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + SUBCASE("dec") + { + size_t icase = 0; + for(auto const& ic : invalid_cases) + { + csubstr cdec = capitalize(buf, ic.dec); + INFO("case#=" << icase << " dec='" << ic.dec << "' capitalize='" << cdec << "'"); + REQUIRE_EQ(cdec.len, ic.dec.len); + { + T val = {}; + CHECK(!atox(ic.dec, &val)); + } + { + T val = {}; + CHECK(!atox(cdec, &val)); + } + ++icase; + } + } + SUBCASE("hex") + { + size_t icase = 0; + for(auto const& ic : invalid_cases) + { + csubstr chex = capitalize(buf, ic.hex); + INFO("case#=" << icase << " hex='" << ic.hex << "' capitalize='" << chex << "'"); + REQUIRE_EQ(chex.len, ic.hex.len); + { + T val = {}; + CHECK(!atox(ic.hex, &val)); + } + { + T val = {}; + CHECK(!atox(chex, &val)); + } + ++icase; + } + } + SUBCASE("oct") + { + size_t icase = 0; + for(auto const& ic : invalid_cases) + { + csubstr coct = capitalize(buf, ic.oct); + INFO("case#=" << icase << " oct='" << ic.oct << "' capitalize='" << coct << "'"); + REQUIRE_EQ(coct.len, ic.oct.len); + { + T val = {}; + CHECK(!atox(ic.oct, &val)); + } + { + T val = {}; + CHECK(!atox(coct, &val)); + } + ++icase; + } + } + SUBCASE("bin") + { + size_t icase = 0; + for(auto const& ic : invalid_cases) + { + csubstr cbin = capitalize(buf, ic.bin); + INFO("case#=" << icase << " bin='" << ic.bin << "' capitalize='" << cbin << "'"); + REQUIRE_EQ(cbin.len, ic.bin.len); + { + T val = {}; + CHECK(!atox(ic.bin, &val)); + } + { + T val = {}; + CHECK(!atox(cbin, &val)); + } + ++icase; + } + } +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +template<class T> +void test_overflows(std::initializer_list<const char *> args) +{ + for(const char *s : args) + CHECK_MESSAGE(overflows<T>(to_csubstr(s)), "num=" << s); +} + +template<class T> +void test_no_overflows(std::initializer_list<const char *> args) +{ + for(const char *s : args) + CHECK_MESSAGE(!overflows<T>(to_csubstr(s)), "num=" << s); +} + +template<class T> +auto test_no_overflow_zeroes() + -> typename std::enable_if<std::is_signed<T>::value, void>::type +{ + test_no_overflows<T>({ "-", "-0", "-000", "-0b0", "-0B0", "-0x0", "-0X0", "-0o0", "-0O0" }); + test_no_overflows<T>({ "", "0", "000", "0b0", "0B0", "0x0", "0X0", "0o0", "0O0" }); +} + +template<class T> +auto test_no_overflow_zeroes() + -> typename std::enable_if<std::is_unsigned<T>::value, void>::type +{ + test_no_overflows<T>({ "", "0", "000", "0b0", "0B0", "0x0", "0X0", "0o0", "0O0" }); +} + + +// test overflow in sizes smaller than 64 bit by upcasting +TEST_CASE_TEMPLATE("atox.overflow", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t) +{ + char buf_[128]; + substr buf = buf_; + auto do_test = [](bool is_overflow, number_case<T> const& num, csubstr exceeded, number_case<T> const& wrapped){ + char buf2_[128] = {}; + substr buf2 = buf2_; + INFO("exceeded=" << exceeded << " is_overflow=" << is_overflow); + INFO("num=" << num); + INFO("wrapped=" << wrapped); + CHECK_EQ(is_overflow, overflows<T>(exceeded)); + if(is_overflow) + CHECK_NE(&num, &wrapped); + else + CHECK_EQ(&num, &wrapped); + { + T val = num.val + T(1); + CHECK(atox(exceeded, &val)); + CHECK_EQ(val, wrapped.val); + } + // capitalize + buf2 = capitalize(buf2_, exceeded); + INFO(buf2); + CHECK_EQ(is_overflow, overflows<T>(buf2)); + { + T val = num.val + T(1); + CHECK(atox(buf2, &val)); + CHECK_EQ(val, wrapped.val); + } + // zero-pad on the left + for(size_t numz : {1u, 4u, 6u}) + { + buf2 = zpad(buf2_, exceeded, numz); + CHECK_EQ(is_overflow, overflows<T>(buf2)); + { + T val = num.val + T(1); + CHECK(atox(buf2, &val)); + CHECK_EQ(val, wrapped.val); + } + buf2.toupper(); + CHECK_EQ(is_overflow, overflows<T>(buf2)); + { + T val = num.val + T(1); + CHECK(atox(buf2, &val)); + CHECK_EQ(val, wrapped.val); + } + } + }; + auto do_test_overflow = [&](T exceed_how_much, T radix){ + REQUIRE(exceed_how_much >= 0); + number_case<T> const& backelm = back<T>(); + number_case<T> const& wrapelm = next(backelm, (size_t)exceed_how_much); + csubstr exceeded = overflow_by(buf, backelm.val, exceed_how_much, radix); + do_test(exceed_how_much > 0, backelm, exceeded, wrapelm); + }; + auto do_test_underflow = [&](T exceed_how_much, T radix){ + REQUIRE(exceed_how_much >= 0); + number_case<T> const& frntelm = front<T>(); + number_case<T> const& wrapelm = prev(frntelm, (size_t)exceed_how_much); + csubstr exceeded = underflow_by(buf, frntelm.val, exceed_how_much, radix); + do_test(exceed_how_much > 0, frntelm, exceeded, wrapelm); + }; + SUBCASE("zeroes") + { + test_no_overflow_zeroes<T>(); + } + SUBCASE("dec") + { + do_test_underflow(T(0), T(10)); + do_test_underflow(T(1), T(10)); + do_test_underflow(T(2), T(10)); + do_test_underflow(T(3), T(10)); + do_test_underflow(T(4), T(10)); + do_test_underflow(T(5), T(10)); + do_test_overflow(T(0), T(10)); + do_test_overflow(T(1), T(10)); + do_test_overflow(T(2), T(10)); + do_test_overflow(T(3), T(10)); + do_test_overflow(T(4), T(10)); + do_test_overflow(T(5), T(10)); + } + SUBCASE("hex") + { + do_test_underflow(T(0), T(16)); + do_test_underflow(T(1), T(16)); + do_test_underflow(T(2), T(16)); + do_test_underflow(T(3), T(16)); + do_test_underflow(T(4), T(16)); + do_test_underflow(T(5), T(16)); + do_test_overflow(T(0), T(16)); + do_test_overflow(T(1), T(16)); + do_test_overflow(T(2), T(16)); + do_test_overflow(T(3), T(16)); + do_test_overflow(T(4), T(16)); + do_test_overflow(T(5), T(16)); + } + SUBCASE("oct") + { + do_test_underflow(T(0), T(8)); + do_test_underflow(T(1), T(8)); + do_test_underflow(T(2), T(8)); + do_test_underflow(T(3), T(8)); + do_test_underflow(T(4), T(8)); + do_test_underflow(T(5), T(8)); + do_test_overflow(T(0), T(8)); + do_test_overflow(T(1), T(8)); + do_test_overflow(T(2), T(8)); + do_test_overflow(T(3), T(8)); + do_test_overflow(T(4), T(8)); + do_test_overflow(T(5), T(8)); + } + SUBCASE("bin") + { + do_test_underflow(T(0), T(2)); + do_test_underflow(T(1), T(2)); + do_test_underflow(T(2), T(2)); + do_test_underflow(T(3), T(2)); + do_test_underflow(T(4), T(2)); + do_test_underflow(T(5), T(2)); + do_test_overflow(T(0), T(2)); + do_test_overflow(T(1), T(2)); + do_test_overflow(T(2), T(2)); + do_test_overflow(T(3), T(2)); + do_test_overflow(T(4), T(2)); + do_test_overflow(T(5), T(2)); + } +} + +TEST_CASE_TEMPLATE("atox.overflow64", T, int64_t, uint64_t) +{ + char buf_[128] = {}; + substr buf = buf_; + auto test_atox = [](csubstr s, overflow64case<T> const& c){ + INFO("s=" << s); + T val = c.wrapped + T(1); + if(std::is_signed<T>::value || !s.begins_with('-')) + { + CHECK(atox(s, &val)); + CHECK_EQ(val, c.wrapped); + } + else + { + CHECK(!atox(s, &val)); + } + }; + SUBCASE("zeroes") + { + test_no_overflow_zeroes<T>(); + } + SUBCASE("dec") + { + for(auto c : overflow64cases<T>::values) + { + INFO(c.dec); + CHECK_EQ(c.is_overflow, overflows<T>(c.dec)); + test_atox(c.dec, c); + csubstr capitalized = capitalize(buf, c.dec); + CHECK_EQ(c.is_overflow, overflows<T>(capitalized)); + test_atox(capitalized, c); + for(size_t numz : {1u, 4u, 6u}) + { + substr buf2 = zpad(buf, c.dec, numz); + CHECK_EQ(c.is_overflow, overflows<T>(buf2)); + test_atox(buf2, c); + buf2.toupper(); + CHECK_EQ(c.is_overflow, overflows<T>(buf2)); + test_atox(buf2, c); + } + } + } + SUBCASE("hex") + { + for(auto c : overflow64cases<T>::values) + { + INFO(c.hex); + CHECK_EQ(c.is_overflow, overflows<T>(c.hex)); + test_atox(c.hex, c); + csubstr capitalized = capitalize(buf, c.hex); + CHECK_EQ(c.is_overflow, overflows<T>(capitalized)); + test_atox(capitalized, c); + for(size_t numz : {1u, 4u, 6u}) + { + substr buf2 = zpad(buf, c.hex, numz); + CHECK_EQ(c.is_overflow, overflows<T>(buf2)); + test_atox(buf2, c); + buf2.toupper(); + CHECK_EQ(c.is_overflow, overflows<T>(buf2)); + test_atox(buf2, c); + } + } + } + SUBCASE("oct") + { + for(auto c : overflow64cases<T>::values) + { + INFO(c.oct); + CHECK_EQ(c.is_overflow, overflows<T>(c.oct)); + test_atox(c.oct, c); + csubstr capitalized = capitalize(buf, c.oct); + CHECK_EQ(c.is_overflow, overflows<T>(capitalized)); + test_atox(capitalized, c); + for(size_t numz : {1u, 4u, 6u}) + { + substr buf2 = zpad(buf, c.oct, numz); + CHECK_EQ(c.is_overflow, overflows<T>(buf2)); + test_atox(buf2, c); + buf2.toupper(); + CHECK_EQ(c.is_overflow, overflows<T>(buf2)); + test_atox(buf2, c); + } + } + } + SUBCASE("bin") + { + for(auto c : overflow64cases<T>::values) + { + INFO(c.bin); + CHECK_EQ(c.is_overflow, overflows<T>(c.bin)); + test_atox(c.bin, c); + csubstr capitalized = capitalize(buf, c.bin); + CHECK_EQ(c.is_overflow, overflows<T>(capitalized)); + test_atox(capitalized, c); + for(size_t numz : {1u, 4u, 6u}) + { + substr buf2 = zpad(buf, c.bin, numz); + CHECK_EQ(c.is_overflow, overflows<T>(buf2)); + test_atox(buf2, c); + buf2.toupper(); + CHECK_EQ(c.is_overflow, overflows<T>(buf2)); + test_atox(buf2, c); + } + } + } +} + + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +template<class T> +void test_overflows_hex() +{ + T x = {}; + std::string str; + if (std::is_unsigned<T>::value) + { + /* with leading zeroes */ + str = "0x0" + std::string(sizeof (T) * 2, 'F'); + CHECK_MESSAGE(!overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<T>::max(), x); + + str = "0x01" + std::string(sizeof (T) * 2, '0'); + CHECK_MESSAGE(overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<T>::min(), x); + } + else + { + /* with leading zeroes */ + str = "0x07" + std::string(sizeof (T) * 2 - 1, 'F'); + CHECK_MESSAGE(!overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<T>::max(), x); + + str = "0x0" + std::string(sizeof (T) * 2, 'F'); + CHECK_MESSAGE(overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(-1, x); + + str = "-0x08" + std::string(sizeof (T) * 2 - 1, '0'); + CHECK_MESSAGE(!overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<T>::min(), x); + + str = "-0x08" + std::string(sizeof (T) * 2 - 2, '0') + "1"; + CHECK_MESSAGE(overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<T>::max(), x); + } +} + +template<class T> +void test_overflows_bin() +{ + T x = {}; + std::string str; + if (std::is_unsigned<T>::value) + { + /* with leading zeroes */ + str = "0b0" + std::string(sizeof (T) * 8, '1'); + CHECK_MESSAGE(!overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<T>::max(), x); + + str = "0b01" + std::string(sizeof (T) * 8, '0'); + CHECK_MESSAGE(overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<T>::min(), x); + } + else + { + /* with leading zeroes */ + str = "0b0" + std::string(sizeof (T) * 8 - 1, '1'); + CHECK_MESSAGE(!overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<T>::max(), x); + + str = "0b0" + std::string(sizeof (T) * 8, '1'); + CHECK_MESSAGE(overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(-1, x); + + str = "-0b01" + std::string(sizeof (T) * 8 - 1, '0'); + CHECK_MESSAGE(!overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<T>::min(), x); + + str = "-0b01" + std::string(sizeof (T) * 8 - 2, '0') + "1"; + CHECK_MESSAGE(overflows<T>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<T>::max(), x); + } +} + +// TODO: test_overflows_oct + +template<class T> +typename std::enable_if<std::is_unsigned<T>::value, void>::type +test_overflows() +{ + for(int radix : { 2, 8, 10, 16 }) + { + char bufc[100] = {0}; + substr s(bufc); + INFO("radix=" << radix << " num=" << s); + + uint64_t max = (uint64_t) std::numeric_limits<T>::max(); + size_t sz = utoa<uint64_t>(s, max, (uint64_t)radix); + REQUIRE_LE(sz, s.size()); + CHECK(!overflows<T>(s.first(sz))); + memset(s.str, 0, s.len); + sz = utoa<uint64_t>(s, max + 1, (uint64_t)radix); + REQUIRE_LE(sz, s.size()); + CHECK(overflows<T>(s.first(sz))); + } + + test_overflows_hex<T>(); + test_overflows_bin<T>(); + // TODO: octal +} + +template<class T> +typename std::enable_if<std::is_signed<T>::value, void>::type +test_overflows() +{ + for(int radix : { 2, 8, 10, 16 }) + { + char bufc[100] = {0}; + substr s(bufc); + INFO("radix=" << radix << " num=" << s); + + int64_t max = (int64_t) std::numeric_limits<T>::max(); + size_t sz = itoa<int64_t>(s, max, (int64_t)radix); + REQUIRE_LE(sz, s.size()); + CHECK(!overflows<T>(s.first(sz))); + memset(s.str, 0, s.len); + sz = itoa<int64_t>(s, max + 1, (int64_t)radix); + REQUIRE_LE(sz, s.size()); + CHECK(overflows<T>(s.first(sz))); + + int64_t min = (int64_t) std::numeric_limits<T>::min(); + sz = itoa<int64_t>(s, min, (int64_t)radix); + REQUIRE_LE(sz, s.size()); + CHECK(!overflows<T>(s.first(sz))); + memset(s.str, 0, s.len); + sz = itoa<int64_t>(s, min - 1, (int64_t)radix); + REQUIRE_LE(sz, s.size()); + CHECK(overflows<T>(s.first(sz))); + } + + test_overflows_hex<T>(); + test_overflows_bin<T>(); + // TODO: octal +} + +TEST_CASE_TEMPLATE("overflows.8bit_32bit", T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t) +{ + test_overflows<T>(); +} + +TEST_CASE("overflows.u64") +{ + CHECK(!overflows<uint64_t>("18446744073709551614")); + CHECK(!overflows<uint64_t>("18446744073709551615")); + CHECK(overflows<uint64_t>("18446744073709551616")); + + // more chars but leading zeroes + CHECK(!overflows<uint64_t>("0018446744073709551615")); + + { /* with leading zeroes */ + std::string str; + uint64_t x = {}; + str = "0o01" + std::string(21, '7'); + CHECK_MESSAGE(!overflows<uint64_t>(to_csubstr(str)), "num=" << str); + str = "0o02" + std::string(21, '0'); + CHECK_MESSAGE(overflows<uint64_t>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(0, x); + } + + test_overflows_hex<uint64_t>(); + test_overflows_bin<uint64_t>(); +} + +TEST_CASE("overflows.i64") +{ + CHECK(!overflows<int64_t>("9223372036854775806")); + CHECK(!overflows<int64_t>("9223372036854775807")); + CHECK(overflows<int64_t>("9223372036854775808")); + CHECK(!overflows<int64_t>("-9223372036854775808")); + CHECK(overflows<int64_t>("-9223372036854775809")); + + // more chars, but leading zeroes + CHECK(!overflows<int64_t>("0009223372036854775807")); + CHECK(!overflows<int64_t>("-0009223372036854775807")); + + { /* with leading zeroes */ + std::string str; + int64_t x = {}; + str = "0o0" + std::string(21, '7'); + CHECK_MESSAGE(!overflows<int64_t>(to_csubstr(str)), "num=" << str); + str = "0o01" + std::string(21, '0'); + CHECK_MESSAGE(overflows<int64_t>(to_csubstr(str)), "num=" << str); + CHECK(atox(to_csubstr(str), &x)); + CHECK_EQ(std::numeric_limits<int64_t>::min(), x); + } + + test_overflows_hex<int64_t>(); + test_overflows_bin<int64_t>(); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +/** remove trailing digits after precision */ +template<class T> +T remprec10(T val, int precision) +{ + T fprec = T(1); + for(int i = 0; i < precision; ++i) + fprec *= T(10); + T rval = val * fprec; + return ((T)((int64_t)rval)) / fprec; +} + +template<class T> +T test_ator(csubstr s, T ref) +{ + INFO("str=" << s << " ref=" << ref); + T rval; + CHECK(atox(s, &rval)); + INFO("rval=" << rval); + CHECK_EQ(memcmp(&rval, &ref, sizeof(T)), 0); + return rval; +} + +template<class Real> +void test_rtoa(substr buf, Real f, int precision, const char *scient, const char *flt, const char* flex, const char *hexa, const char *hexa_alternative=nullptr) +{ + size_t ret; + Real pf = remprec10(f, precision); + + { + INFO("num=" << f << " precision=" << precision << " scient=" << scient); + memset(buf.str, 0, buf.len); + ret = xtoa(buf, f, precision, FTOA_SCIENT); + REQUIRE_LE(ret, buf.len); + CHECK_EQ(buf.first(ret), to_csubstr(scient)); + test_ator(buf.first(ret), pf); + } + + { + INFO("num=" << f << " precision=" << precision << " flt=" << flt); + memset(buf.str, 0, ret); + ret = xtoa(buf, f, precision, FTOA_FLOAT); + REQUIRE_LE(ret, buf.len); + CHECK_EQ(buf.first(ret), to_csubstr(flt)); + test_ator(buf.first(ret), pf); + } + + { + INFO("num=" << f << " precision=" << precision << " flex=" << flex); + memset(buf.str, 0, ret); + ret = xtoa(buf, f, precision+1, FTOA_FLEX); + REQUIRE_LE(ret, buf.len); + CHECK_EQ(buf.first(ret), to_csubstr(flex)); + test_ator(buf.first(ret), pf); + } + + { + if(!hexa_alternative) + hexa_alternative = hexa; + INFO("num=" << f << " precision=" << precision << " hexa=" << hexa << " hexa_alternative=" << hexa_alternative); + memset(buf.str, 0, ret); + ret = xtoa(buf, f, precision, FTOA_HEXA); + REQUIRE_LE(ret, buf.len); + INFO("buf='" << buf.first(ret) << "'"); + + CHECK((buf.first(ret) == to_csubstr(hexa) || buf.first(ret) == to_csubstr(hexa_alternative))); + Real readback = {}; + CHECK(atox(buf.first(ret), &readback)); + INFO("readback=" << readback); + REQUIRE_EQ(xtoa(buf, readback, precision, FTOA_HEXA), ret); + Real readback2 = {}; + CHECK(atox(buf.first(ret), &readback2)); + INFO("readback2=" << readback2); + CHECK_EQ(memcmp(&readback2, &readback, sizeof(Real)), 0); + } +} + + +TEST_CASE("ftoa.basic") +{ + char bufc[128]; + substr buf(bufc); + C4_ASSERT(buf.len == sizeof(bufc)-1); + + // earlier versions of emscripten's sprintf() do not respect some + // precision values when printing in hexadecimal format. + // + // @see https://github.com/biojppm/c4core/pull/52 + #if defined(__EMSCRIPTEN__) && __EMSCRIPTEN_major__ < 3 + #define _c4emscripten_alt(alt) , alt + #define _c4emscripten_alt2(alt1, alt2) , alt2 + #else + #define _c4emscripten_alt(alt) + #define _c4emscripten_alt2(alt1, alt2) , alt1 + #endif + + float f = 1.1234123f; + double d = 1.1234123; + + test_rtoa(buf, f, 0, /*scient*/"1e+00", /*flt*/"1", /*flex*/"1", /*hexa*/"0x1p+0"); + test_rtoa(buf, d, 0, /*scient*/"1e+00", /*flt*/"1", /*flex*/"1", /*hexa*/"0x1p+0"); + + test_rtoa(buf, f, 1, /*scient*/"1.1e+00", /*flt*/"1.1", /*flex*/"1.1", /*hexa*/"0x1.2p+0"); + test_rtoa(buf, d, 1, /*scient*/"1.1e+00", /*flt*/"1.1", /*flex*/"1.1", /*hexa*/"0x1.2p+0"); + + test_rtoa(buf, f, 2, /*scient*/"1.12e+00", /*flt*/"1.12", /*flex*/"1.12", /*hexa*/"0x1.20p+0" _c4emscripten_alt("0x1.1f8p+0")); + test_rtoa(buf, d, 2, /*scient*/"1.12e+00", /*flt*/"1.12", /*flex*/"1.12", /*hexa*/"0x1.20p+0" _c4emscripten_alt("0x1.1f8p+0")); + + test_rtoa(buf, f, 3, /*scient*/"1.123e+00", /*flt*/"1.123", /*flex*/"1.123", /*hexa*/"0x1.1f9p+0" _c4emscripten_alt("0x1.1f98p+0")); + test_rtoa(buf, d, 3, /*scient*/"1.123e+00", /*flt*/"1.123", /*flex*/"1.123", /*hexa*/"0x1.1f9p+0" _c4emscripten_alt("0x1.1f98p+0")); + + test_rtoa(buf, f, 4, /*scient*/"1.1234e+00", /*flt*/"1.1234", /*flex*/"1.1234", /*hexa*/"0x1.1f98p+0"); + test_rtoa(buf, d, 4, /*scient*/"1.1234e+00", /*flt*/"1.1234", /*flex*/"1.1234", /*hexa*/"0x1.1f98p+0"); + + f = 1.01234123f; + d = 1.01234123; + + test_rtoa(buf, f, 0, /*scient*/"1e+00", /*flt*/"1", /*flex*/"1", /*hexa*/"0x1p+0"); + test_rtoa(buf, d, 0, /*scient*/"1e+00", /*flt*/"1", /*flex*/"1", /*hexa*/"0x1p+0"); + + test_rtoa(buf, f, 1, /*scient*/"1.0e+00", /*flt*/"1.0", /*flex*/"1", /*hexa*/"0x1.0p+0"); + test_rtoa(buf, d, 1, /*scient*/"1.0e+00", /*flt*/"1.0", /*flex*/"1", /*hexa*/"0x1.0p+0"); + + test_rtoa(buf, f, 2, /*scient*/"1.01e+00", /*flt*/"1.01", /*flex*/"1.01", /*hexa*/"0x1.03p+0"); + test_rtoa(buf, d, 2, /*scient*/"1.01e+00", /*flt*/"1.01", /*flex*/"1.01", /*hexa*/"0x1.03p+0"); + + test_rtoa(buf, f, 3, /*scient*/"1.012e+00", /*flt*/"1.012", /*flex*/"1.012", /*hexa*/"0x1.033p+0" _c4emscripten_alt2("0x1.032p+0", "0x1.0328p+0")); + test_rtoa(buf, d, 3, /*scient*/"1.012e+00", /*flt*/"1.012", /*flex*/"1.012", /*hexa*/"0x1.033p+0" _c4emscripten_alt2("0x1.032p+0", "0x1.0328p+0")); + + test_rtoa(buf, f, 4, /*scient*/"1.0123e+00", /*flt*/"1.0123", /*flex*/"1.0123", /*hexa*/"0x1.0329p+0"); + test_rtoa(buf, d, 4, /*scient*/"1.0123e+00", /*flt*/"1.0123", /*flex*/"1.0123", /*hexa*/"0x1.0329p+0"); + + f = 0.f; + d = 0.; + + test_rtoa(buf, f, 0, /*scient*/"0e+00", /*flt*/"0", /*flex*/"0", /*hexa*/"0x0p+0"); + test_rtoa(buf, d, 0, /*scient*/"0e+00", /*flt*/"0", /*flex*/"0", /*hexa*/"0x0p+0"); + + test_rtoa(buf, f, 1, /*scient*/"0.0e+00", /*flt*/"0.0", /*flex*/"0", /*hexa*/"0x0.0p+0"); + test_rtoa(buf, d, 1, /*scient*/"0.0e+00", /*flt*/"0.0", /*flex*/"0", /*hexa*/"0x0.0p+0"); + + test_rtoa(buf, f, 2, /*scient*/"0.00e+00", /*flt*/"0.00", /*flex*/"0", /*hexa*/"0x0.00p+0"); + test_rtoa(buf, d, 2, /*scient*/"0.00e+00", /*flt*/"0.00", /*flex*/"0", /*hexa*/"0x0.00p+0"); + + test_rtoa(buf, f, 3, /*scient*/"0.000e+00", /*flt*/"0.000", /*flex*/"0", /*hexa*/"0x0.000p+0" _c4emscripten_alt2("0x0.000p+0", "0x0.000p+0")); + test_rtoa(buf, d, 3, /*scient*/"0.000e+00", /*flt*/"0.000", /*flex*/"0", /*hexa*/"0x0.000p+0" _c4emscripten_alt2("0x0.000p+0", "0x0.000p+0")); + + test_rtoa(buf, f, 4, /*scient*/"0.0000e+00", /*flt*/"0.0000", /*flex*/"0", /*hexa*/"0x0.0000p+0"); + test_rtoa(buf, d, 4, /*scient*/"0.0000e+00", /*flt*/"0.0000", /*flex*/"0", /*hexa*/"0x0.0000p+0"); + + f = 1.f; + d = 1.; + + test_rtoa(buf, f, 0, /*scient*/"1e+00", /*flt*/"1", /*flex*/"1", /*hexa*/"0x1p+0"); + test_rtoa(buf, d, 0, /*scient*/"1e+00", /*flt*/"1", /*flex*/"1", /*hexa*/"0x1p+0"); + + test_rtoa(buf, f, 1, /*scient*/"1.0e+00", /*flt*/"1.0", /*flex*/"1", /*hexa*/"0x1.0p+0"); + test_rtoa(buf, d, 1, /*scient*/"1.0e+00", /*flt*/"1.0", /*flex*/"1", /*hexa*/"0x1.0p+0"); + + test_rtoa(buf, f, 2, /*scient*/"1.00e+00", /*flt*/"1.00", /*flex*/"1", /*hexa*/"0x1.00p+0"); + test_rtoa(buf, d, 2, /*scient*/"1.00e+00", /*flt*/"1.00", /*flex*/"1", /*hexa*/"0x1.00p+0"); + + test_rtoa(buf, f, 3, /*scient*/"1.000e+00", /*flt*/"1.000", /*flex*/"1", /*hexa*/"0x1.000p+0" _c4emscripten_alt2("0x1.000p+0", "0x1.000p+0")); + test_rtoa(buf, d, 3, /*scient*/"1.000e+00", /*flt*/"1.000", /*flex*/"1", /*hexa*/"0x1.000p+0" _c4emscripten_alt2("0x1.000p+0", "0x1.000p+0")); + + test_rtoa(buf, f, 4, /*scient*/"1.0000e+00", /*flt*/"1.0000", /*flex*/"1", /*hexa*/"0x1.0000p+0"); + test_rtoa(buf, d, 4, /*scient*/"1.0000e+00", /*flt*/"1.0000", /*flex*/"1", /*hexa*/"0x1.0000p+0"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +TEST_CASE_TEMPLATE("atof.integral", T, float, double) +{ + auto t_ = [](csubstr str, int val){ + T rval = (T)10 * (T)val; + INFO("str=" << str); + bool ret = atox(str, &rval); + CHECK_EQ(ret, true); + CHECK_EQ(static_cast<int>(rval), val); + CHECK_EQ(rval, (T)val); + }; + + csubstr s = "12345678"; + t_(s, 12345678); + t_(s.first(8), 12345678); + t_(s.first(7), 1234567); + t_(s.first(6), 123456); + t_(s.first(5), 12345); + t_(s.first(4), 1234); + t_(s.first(3), 123); + t_(s.first(2), 12); + t_(s.first(1), 1); +} + +TEST_CASE_TEMPLATE("atof.hexa", T, float, double) +{ + auto t_ = [](csubstr str, bool isok){ + T rval = {}; + INFO("str=" << str); + CHECK_EQ(atox(str, &rval), isok); + }; + #if C4CORE_NO_FAST_FLOAT + #define _scanf_accepts(expected) !expected + #else + #define _scanf_accepts(expected) expected + #endif + t_("0x1.p+0", true); + t_("0x1.p", _scanf_accepts(false)); + t_("0x1.p+", _scanf_accepts(false)); + t_("0x12p+0", true); + t_("0x12p", _scanf_accepts(false)); + t_("0xabcdef.abcdefp+0", true); + t_("0xABCDEF.ABCDEFp+0", true); + t_("0x1g", _scanf_accepts(false)); + t_("0x1.2", true); + t_("0x1.", true); + t_("0x1.0329p+0", true); + t_("0x1.0329P+0", true); + t_("0x1.aAaAaAp+0", true); + t_("0x1.agA+0", _scanf_accepts(false)); +} + +TEST_CASE_TEMPLATE("atof.infnan", T, float, double) +{ + T pinf = std::numeric_limits<T>::infinity(); + T ninf = -std::numeric_limits<T>::infinity(); + T nan = std::numeric_limits<T>::quiet_NaN(); + T rval = {}; + test_ator("infinity", pinf); + test_ator("inf", pinf); + test_ator("-infinity", ninf); + test_ator("-inf", ninf); + test_ator("nan", nan); +} + +TEST_CASE_TEMPLATE("atof.fail_parse", T, float, double) +{ + auto t_ = [](csubstr str){ + T rval; + INFO("str=" << str << " rval=" << rval); + CHECK_EQ(atox(str, &rval), false); + }; + t_(".inf"); + t_("-.inf"); + t_(".nan"); + t_("-.nan"); + t_("not a float!"); + #ifndef C4CORE_NO_FAST_FLOAT + t_("0xfonix!"); + #endif + //t_("123.45not a float!"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +TEST_CASE_TEMPLATE("to_chars.empty_buffer", T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, void*) +{ + char buf_[100]; + substr buf = buf_; + CHECK_EQ(to_chars({}, T(101)), to_chars(buf_, T(101))); + CHECK_EQ(to_chars({}, T(101)), to_chars(buf , T(101))); +} +// due to an implementation quirk with sprintf, for floats the empty is GE +TEST_CASE_TEMPLATE("to_chars.empty_buffer", T, float, double) +{ + char buf_[100]; + substr buf = buf_; + CHECK_GE(to_chars({}, T(101)), to_chars(buf_, T(101))); + CHECK_GE(to_chars({}, T(101)), to_chars(buf , T(101))); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TEST_CASE("to_chars.std_string") +{ + std::string foo("foo"); + char buf_[32]; + substr buf(buf_); + size_t result = to_chars(buf, foo); + CHECK_EQ(result, 3); + CHECK_EQ(buf.first(3), "foo"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TEST_CASE("to_chars.bool") +{ + char buf_[32]; + substr buf(buf_); + csubstr result = to_chars_sub(buf, true); + CHECK_EQ(result, "1"); + result = to_chars_sub(buf, false); + CHECK_EQ(result, "0"); +} + +TEST_CASE("from_chars.bool") +{ + bool result = false; + for(const char *s : {"1", "true", "True", "TRUE"}) + { + INFO("s='" << s << "'"); + bool ok = from_chars(to_csubstr(s), &result); + CHECK_UNARY(ok); + CHECK_UNARY(result); + } + for(const char *s : {"0", "false", "False", "FALSE"}) + { + INFO("s='" << s << "'"); + bool ok = from_chars(to_csubstr(s), &result); + CHECK_UNARY(ok); + CHECK_UNARY_FALSE(result); + } +} + +TEST_CASE("from_chars_first.bool") +{ + bool result = false; + for(const char *s : {"1", "10000", "2", "3", "10", "010", "001", "0001", "true", "True", "TRUE"}) + { + INFO("s='" << s << "'"); + bool ok = from_chars(to_csubstr(s), &result); + CHECK_UNARY(ok); + CHECK_UNARY(result); + } + for(const char *s : {"0", "00", "000", "0000", "false", "False", "FALSE"}) + { + INFO("s='" << s << "'"); + bool ok = from_chars(to_csubstr(s), &result); + CHECK_UNARY(ok); + CHECK_UNARY_FALSE(result); + } +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +// test that no characters are trimmed at the end of +// the number due to printf-based implementations +// needing space for the \0 +template<class T> +void test_trimmed_fit(T v, csubstr expected) +{ + char buf_[128] = {}; + char buf2_[128] = {}; + substr buf(buf_); + substr buf2(buf_); + REQUIRE_GE(buf.len, expected.len); + REQUIRE_GE(buf2.len, expected.len); + csubstr result = to_chars_sub(buf, v); + CHECK_EQ(result, expected); + csubstr result2 = to_chars_sub(buf2.sub(result.len), v); + CHECK_EQ(result2, result); + std::string str; + catrs(&str, v); + CHECK_EQ(expected, to_csubstr(str)); + CHECK_EQ(result, to_csubstr(str)); +} + +TEST_CASE("to_chars.trimmed_fit_int") +{ + test_trimmed_fit(12345678, "12345678"); +} + +TEST_CASE("to_chars.trimmed_fit_float") +{ + test_trimmed_fit(0.374f, "0.374"); + test_trimmed_fit(12.374f, "12.374"); +} + +TEST_CASE("to_chars.trimmed_fit_double") +{ + test_trimmed_fit(0.374, "0.374"); + test_trimmed_fit(12.374, "12.374"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +template<class T> +void to_chars_roundtrip(substr buf, T const& val, csubstr expected) +{ + T cp = {}; + INFO("val=" << val); + csubstr res = to_chars_sub(buf, val); + CHECK_EQ(res, expected); + bool ok = from_chars(res, &cp); + CHECK_UNARY(ok); + CHECK_EQ(cp, val); +} + +template<size_t N> +void to_chars_roundtrip(char (&buf)[N], csubstr val) +{ + char cp_[N] = {}; + substr cp = cp_; + INFO("val=" << val); + REQUIRE_LE(val.len, N); + csubstr res = to_chars_sub(buf, val); + CHECK_EQ(res.len, val.len); + CHECK_EQ(res, val); + bool ok = from_chars(res, &cp); + CHECK_UNARY(ok); + CHECK_EQ(cp, val); +} + + +TEST_CASE("to_chars.roundtrip_bool") +{ + char buf[128]; + to_chars_roundtrip<bool>(buf, false, "0"); + to_chars_roundtrip<bool>(buf, true, "1"); +} + + +TEST_CASE("to_chars.roundtrip_char") +{ + char buf[128]; + to_chars_roundtrip<char>(buf, 'a', "a"); + to_chars_roundtrip<char>(buf, 'b', "b"); + to_chars_roundtrip<char>(buf, 'c', "c"); + to_chars_roundtrip<char>(buf, 'd', "d"); +} + +#define C4_TEST_ROUNDTRIP_INT(ty) \ +TEST_CASE("to_chars.roundtrip_" #ty)\ +{\ + char buf[128];\ + to_chars_roundtrip<ty>(buf, 0, "0");\ + to_chars_roundtrip<ty>(buf, 1, "1");\ + to_chars_roundtrip<ty>(buf, 2, "2");\ + to_chars_roundtrip<ty>(buf, 3, "3");\ + to_chars_roundtrip<ty>(buf, 4, "4");\ +} +C4_TEST_ROUNDTRIP_INT(int8_t) +C4_TEST_ROUNDTRIP_INT(int16_t) +C4_TEST_ROUNDTRIP_INT(int32_t) +C4_TEST_ROUNDTRIP_INT(int64_t) +C4_TEST_ROUNDTRIP_INT(uint8_t) +C4_TEST_ROUNDTRIP_INT(uint16_t) +C4_TEST_ROUNDTRIP_INT(uint32_t) +C4_TEST_ROUNDTRIP_INT(uint64_t) +// some of the following types are not the same as above: +using ulong = unsigned long; +using uint = unsigned int; +C4_TEST_ROUNDTRIP_INT(int) +C4_TEST_ROUNDTRIP_INT(uint) +C4_TEST_ROUNDTRIP_INT(long) +C4_TEST_ROUNDTRIP_INT(ulong) +C4_TEST_ROUNDTRIP_INT(size_t) +C4_TEST_ROUNDTRIP_INT(intptr_t) +C4_TEST_ROUNDTRIP_INT(uintptr_t) + +#define C4_TEST_ROUNDTRIP_REAL(ty) \ +TEST_CASE("to_chars.roundtrip_" #ty)\ +{\ + char buf[128];\ + to_chars_roundtrip<ty>(buf, ty(0.0), "0");\ + to_chars_roundtrip<ty>(buf, ty(1.0), "1");\ + to_chars_roundtrip<ty>(buf, ty(2.0), "2");\ + to_chars_roundtrip<ty>(buf, ty(3.0), "3");\ + to_chars_roundtrip<ty>(buf, ty(4.0), "4");\ +} +C4_TEST_ROUNDTRIP_REAL(float) +C4_TEST_ROUNDTRIP_REAL(double) + +TEST_CASE("to_chars.roundtrip_substr") +{ + char buf[128]; + to_chars_roundtrip(buf, ""); + to_chars_roundtrip(buf, "0"); + to_chars_roundtrip(buf, "1"); + to_chars_roundtrip(buf, "2"); + to_chars_roundtrip(buf, "3"); + to_chars_roundtrip(buf, "4"); + to_chars_roundtrip(buf, "zhis iz a test"); +} + +TEST_CASE("to_chars.substr_enough_size") +{ + char orig_[] = "0123456789"; + substr orig = orig_; + char result_[20]; + substr result = result_; + size_t len = to_chars(result, orig); + CHECK_EQ(len, orig.len); + CHECK_NE(result.str, orig.str); + CHECK_EQ(result.first(10), orig); +} + +TEST_CASE("to_chars.substr_insufficient_size") +{ + char orig_[] = "0123456789"; + substr orig = orig_; + char result_[11] = {}; + substr result = result_; + result.len = 5; + size_t len = to_chars(result, orig); + CHECK_EQ(len, orig.len); + CHECK_NE(result.str, orig.str); + CHECK_EQ(result.first(5), "01234"); + CHECK_EQ(substr(result_).last(5), "\0\0\0\0\0"); +} + +TEST_CASE("from_chars.csubstr") +{ + csubstr orig = "0123456789"; + csubstr result; + CHECK_NE(result.str, orig.str); + CHECK_NE(result.len, orig.len); + bool ok = from_chars(orig, &result); + CHECK(ok); + CHECK_EQ(result.str, orig.str); + CHECK_EQ(result.len, orig.len); +} + +TEST_CASE("from_chars.substr_enough_size") +{ + char buf_[128] = {}; + substr result = buf_; + for(char r : result) + { + CHECK_EQ(r, '\0'); + } + bool ok = from_chars("0123456789", &result); + CHECK(ok); + CHECK_EQ(result.len, 10); + CHECK_EQ(result.str, buf_); + CHECK_EQ(result, "0123456789"); +} + +TEST_CASE("from_chars.substr_insufficient_size") +{ + char buf_[128] = {}; + substr buf = buf_; + buf.len = 0; + bool ok = from_chars("0123456789", &buf); + CHECK_FALSE(ok); + for(size_t i = 0; i < 10; ++i) + { + CHECK_EQ(buf_[i], '\0'); + } +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +struct ptr_expected { void *ptr; c4::csubstr str; }; +const ptr_expected ptr_cases[] = { + {(void*)0x0, c4::csubstr("0x0")}, + {(void*)0x1234, c4::csubstr("0x1234")}, + {(void*)-0x1234, c4::csubstr("-0x1234")}, +}; + +template<class T> +void test_xtoa_ptr(const char *type_name) +{ + INFO("type=" << type_name); + char buf_[128] = {}; + c4::substr buf(buf_); + for(auto &pe : ptr_cases) + { + INFO("val=" << pe.str); + size_t ret = xtoa(buf, (T const*)pe.ptr); + CHECK_EQ(ret, pe.str.len); + CHECK_EQ(buf.first(ret), pe.str); + } +} + +template<class T> +void test_to_chars_ptr(const char *type_name) +{ + INFO("type=" << type_name); + char buf_[128] = {}; + c4::substr buf(buf_); + for(auto &pe : ptr_cases) + { + INFO("val=" << pe.str); + size_t ret = to_chars(buf, (T const*)pe.ptr); + CHECK_EQ(ret, pe.str.len); + CHECK_EQ(buf.first(ret), pe.str); + } +} + +template<class T> +void test_atox_ptr(const char *type_name) +{ + INFO("type=" << type_name); + for(auto &pe : ptr_cases) + { + T *ptr = nullptr; + INFO("val=" << pe.str); + bool ret = atox(pe.str, &ptr); + CHECK(ret); + CHECK_EQ((void*)ptr, pe.ptr); + } +} + +template<class T> +void test_from_chars_ptr(const char *type_name) +{ + INFO("type=" << type_name); + for(auto &pe : ptr_cases) + { + T *ptr = nullptr; + INFO("val=" << pe.str); + bool ret = from_chars(pe.str, &ptr); + CHECK(ret); + CHECK_EQ((void*)ptr, pe.ptr); + } +} + +template<class T> +void test_from_chars_first_ptr(const char *type_name) +{ + INFO("type=" << type_name); + for(auto &pe : ptr_cases) + { + T *ptr = nullptr; + INFO("val=" << pe.str); + bool ret = from_chars(pe.str, &ptr); + CHECK(ret); + CHECK_EQ((void*)ptr, pe.ptr); + } +} + + +TEST_CASE("xtoa.ptr") +{ + test_xtoa_ptr<void>("void"); + test_xtoa_ptr<int>("int"); + test_xtoa_ptr<std::vector<int>>("std::vector<int>"); +} + +TEST_CASE("atox.ptr") +{ + test_atox_ptr<void>("void"); + test_atox_ptr<int>("int"); + test_atox_ptr<std::vector<int>>("std::vector<int>"); +} + +TEST_CASE("to_chars.ptr") +{ + test_to_chars_ptr<void>("void"); + test_to_chars_ptr<int>("int"); + test_to_chars_ptr<std::vector<int>>("std::vector<int>"); +} + +TEST_CASE("from_chars.ptr") +{ + test_from_chars_ptr<void>("void"); + test_from_chars_ptr<int>("int"); + test_from_chars_ptr<std::vector<int>>("std::vector<int>"); +} + +TEST_CASE("from_chars_first.ptr") +{ + test_from_chars_first_ptr<void>("void"); + test_from_chars_first_ptr<int>("int"); + test_from_chars_first_ptr<std::vector<int>>("std::vector<int>"); +} + +} // namespace c4 + + +C4_SUPPRESS_WARNING_GCC_POP +C4_SUPPRESS_WARNING_CLANG_POP + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_ctor_dtor.cpp b/thirdparty/ryml/ext/c4core/test/test_ctor_dtor.cpp new file mode 100644 index 000000000..f655fb17c --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_ctor_dtor.cpp @@ -0,0 +1,306 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/ctor_dtor.hpp" +#endif + +#include "c4/libtest/supprwarn_push.hpp" + +#include <c4/test.hpp> +#include <string> +#include <vector> + +namespace c4 { + +namespace { +struct subject +{ + static size_t ct_cp, ct_mv, cp, mv; + static void clear() { ct_cp = ct_mv = cp = mv = 0; } + subject(Counting<std::string> const&) + { + ++ct_cp; + } + subject(Counting<std::string> &&) + { + ++ct_mv; + } + subject(subject const&) + { + ++cp; + } + subject(subject &&) + { + ++mv; + } +}; +size_t subject::ct_cp = 0; +size_t subject::ct_mv = 0; +size_t subject::cp = 0; +size_t subject::mv = 0; +} // empty namespace + + +TEST_CASE("ctor_dtor.construct_n") +{ + using T = Counting<subject>; + C4_STATIC_ASSERT(sizeof(T) % alignof(T) == 0); + alignas(T) char buf1[100 * sizeof(T)]; + T* mem1 = reinterpret_cast<T*>(buf1); + + using cs = Counting<std::string>; + + decltype(subject::ct_cp) num = 10; + + { + auto chc = T::check_num_ctors_dtors(num, 0); + auto ch = cs::check_num_ctors_dtors(1, 1); + cs s("bla"); + construct_n(mem1, num, s); + CHECK_EQ(subject::ct_cp, num); + subject::clear(); + } + + { + auto chc = T::check_num_ctors_dtors(num, 0); + auto ch = cs::check_num_ctors_dtors(1, 1); + construct_n(mem1, num, cs("bla")); // BAD!!! will call 10 moves + CHECK_EQ(subject::ct_cp, num); + subject::clear(); + } +} + + +//----------------------------------------------------------------------------- +template<class T> +void create_make_room_buffer(std::vector<T> &orig) +{ + C4_STATIC_ASSERT(std::is_integral<T>::value); + for(int i = 0, e = (int)orig.size(); i < e; ++i) + { + orig[static_cast<size_t>(i)] = (T)(33 + i % (122 - 33)); // assign characters + } +} +template<> +void create_make_room_buffer<std::string>(std::vector<std::string> &orig) +{ + for(int i = 0, e = (int)orig.size(); i < e; ++i) + { + char c = (char)(33 + i % (122 - 33)); + orig[static_cast<size_t>(i)].assign(10, c); + } +} + +template<class T> +void do_make_room_inplace(std::vector<T> const& orig, std::vector<T> & buf, + size_t bufsz, size_t room, size_t pos) +{ + buf = orig; + make_room(buf.data() + pos, bufsz, room); +} + +template<class T> +void do_make_room_srcdst(std::vector<T> const& orig, std::vector<T> & buf, + size_t bufsz, size_t room, size_t pos) +{ + buf.resize(orig.size()); + for(auto &t : buf) + { + t = T(); + } + make_room(buf.data(), orig.data(), bufsz, room, pos); +} + +template<class T> +void do_make_room_check(std::vector<T> const& orig, std::vector<T> & buf, + size_t bufsz, size_t room, size_t pos) +{ + for(size_t i = 0, e = orig.size(); i < e; ++i) + { + INFO("i=" << (int)i); + if(i < pos) + { + // memory before the move, must be untouched + CHECK_EQ(buf[i], orig[i]); + } + else + { + if(i >= pos && i < pos + room) + { + // this is the memory that was moved (at its origin) + //CHECK_EQ(buf[i], orig[i]) << "i=" << (int)i; + } + else if(i >= pos + room && i < pos + room + bufsz) + { + // this is the memory that was moved (at its destination) + CHECK_EQ(buf[i], orig[i - room]); + } + else + { + // this is memory at the end, must be untouched + CHECK_EQ(buf[i], orig[i]); + } + } + } +}; + +template<class T> +void do_make_room_inplace_test(std::vector<T> const& orig, std::vector<T> & buf, + size_t bufsz, size_t room, size_t pos) +{ + do_make_room_inplace(orig, buf, bufsz, room, pos); + do_make_room_check(orig, buf, bufsz, room, pos); +} + +template<class T> +void do_make_room_srcdst_test(std::vector<T> const& orig, std::vector<T> & buf, + size_t /*bufsz*/, size_t room, size_t pos) +{ + do_make_room_srcdst(orig, buf, buf.size() - room, room, pos); + do_make_room_check(orig, buf, buf.size() - room, room, pos); +} + +template<class T, class Func> +void test_make_room(Func test_func) +{ + std::vector<T> orig(100), buf(100); + + create_make_room_buffer(orig); + + { + INFO("in the beginning without overlap"); + test_func(orig, buf, /*bufsz*/10, /*room*/10, /*pos*/0); + } + + { + INFO("in the beginning with overlap"); + test_func(orig, buf, /*bufsz*/10, /*room*/15, /*pos*/0); + } + + { + INFO("in the middle without overlap"); + test_func(orig, buf, /*bufsz*/10, /*room*/10, /*pos*/10); + } + + { + INFO("in the middle with overlap"); + test_func(orig, buf, /*bufsz*/10, /*room*/15, /*pos*/10); + } +} + +TEST_CASE_TEMPLATE("ctor_dtor.make_room_inplace", T, uint8_t, uint64_t, std::string) +{ + test_make_room<T>(do_make_room_inplace_test<T>); +} + +TEST_CASE_TEMPLATE("ctor_dtor.make_room_srcdst", T, uint8_t, uint64_t, std::string) +{ + test_make_room<T>(&do_make_room_srcdst_test<T>); +} + + +//----------------------------------------------------------------------------- + +template<class T> +void do_destroy_room_inplace(std::vector<T> const& orig, std::vector<T> & buf, + size_t bufsz, size_t room, size_t pos) +{ + buf = orig; + destroy_room(buf.data() + pos, bufsz - pos, room); +} + +template<class T> +void do_destroy_room_srcdst(std::vector<T> const& orig, std::vector<T> & buf, + size_t bufsz, size_t room, size_t pos) +{ + buf = orig; + destroy_room(buf.data(), orig.data(), bufsz, room, pos); +} + +template<class T> +void do_destroy_room_check(std::vector<T> const& orig, std::vector<T> & buf, + size_t bufsz, size_t room, size_t pos) +{ + for(size_t i = 0, e = orig.size(); i < e; ++i) + { + INFO("i=" << (int)i << " room=" << room << " pos=" << pos); + if(i < pos) + { + // memory before the destroy, should be untouched + CHECK_EQ(buf[i], orig[i]); + } + else + { + if(i >= pos && i < pos + room) + { + // this is the memory that was destroyed (at its origin) + } + else if(i >= pos + room && i < pos + room + bufsz) + { + // this is the memory that was moved (at its destination) + CHECK_EQ(buf[i - room], orig[i]); + } + else + { + // this is memory at the end, should be untouched + CHECK_EQ(buf[i], orig[i]); + } + } + } +}; + +template<class T> +void do_destroy_room_inplace_test(std::vector<T> const& orig, std::vector<T> & buf, + size_t room, size_t pos) +{ + do_destroy_room_inplace(orig, buf, buf.size(), room, pos); + do_destroy_room_check(orig, buf, buf.size(), room, pos); +} + +template<class T> +void do_destroy_room_srcdst_test(std::vector<T> const& orig, std::vector<T> & buf, + size_t room, size_t pos) +{ + do_destroy_room_srcdst(orig, buf, buf.size(), room, pos); + do_destroy_room_check(orig, buf, buf.size(), room, pos); +} + +template<class T, class Func> +void test_destroy_room(Func test_func) +{ + std::vector<T> orig(100), buf(100); + + create_make_room_buffer(orig); + + { + INFO("in the beginning, room=10"); + test_func(orig, buf, /*room*/10, /*pos*/0); + } + + { + INFO("in the beginning, room=20"); + test_func(orig, buf, /*room*/20, /*pos*/0); + } + + { + INFO("in the middle, room=10"); + test_func(orig, buf, /*room*/10, /*pos*/10); + } + + { + INFO("in the middle, room=20"); + test_func(orig, buf, /*room*/20, /*pos*/10); + } +} + +TEST_CASE_TEMPLATE("ctor_dtor.destroy_room_inplace", T, uint8_t, uint64_t, std::string) +{ + test_destroy_room<T>(do_destroy_room_inplace_test<T>); +} + +TEST_CASE_TEMPLATE("ctor_dtor.destroy_room_srcdst", T, uint8_t, uint64_t, std::string) +{ + test_destroy_room<T>(&do_destroy_room_srcdst_test<T>); +} + +} // namespace c4 + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_dump.cpp b/thirdparty/ryml/ext/c4core/test/test_dump.cpp new file mode 100644 index 000000000..cfa7d991c --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_dump.cpp @@ -0,0 +1,1220 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/substr.hpp" +#include "c4/std/std.hpp" +#include "c4/dump.hpp" +#include "c4/format.hpp" +#endif + +#include <c4/test.hpp> +#include "c4/libtest/supprwarn_push.hpp" + +#ifdef __clang__ +# pragma clang diagnostic push +#elif defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wuseless-cast" +#endif + +namespace c4 { + + +namespace example { + +std::string test_dumper_target = {}; +void test_dumper(csubstr str) +{ + test_dumper_target.append(str.str, str.len); +} + +template<class ...Args> +void printf(csubstr fmt, Args&& ...args) +{ + static thread_local std::string writebuf(16, '\0'); + DumpResults results = format_dump_resume<&test_dumper>(c4::to_substr(writebuf), fmt, std::forward<Args>(args)...); + if(C4_UNLIKELY(results.bufsize > writebuf.size())) // bufsize will be that of the largest element serialized. Eg int(1), will require 1 byte. + { + size_t dup = 2 * writebuf.size(); + writebuf.resize(dup > results.bufsize ? dup : results.bufsize); + format_dump_resume<&test_dumper>(results, c4::to_substr(writebuf), fmt, std::forward<Args>(args)...); + } +} +} // namespace example + +TEST_CASE("printf_example") +{ + example::test_dumper_target.clear(); + SUBCASE("1") + { + example::printf("{} coffees per day.\n", 3); + CHECK_EQ(example::test_dumper_target, "3 coffees per day.\n"); + } + SUBCASE("2") + { + example::printf("{} would be {}.", "brecky", "nice"); + CHECK_EQ(example::test_dumper_target, "brecky would be nice."); + } + SUBCASE("resize writebuf") + { + // printed strings will not use the writebuf, so we write a zero-padded integer + size_t dim = 128; // pad with 128 zeroes + std::string s1(dim, '0'); + std::string s2(dim, '0'); + s1.back() = '1'; + s2.back() = '2'; + example::printf("{} cannot be {}", fmt::zpad(1, dim), fmt::zpad(2, dim)); + CHECK_EQ(example::test_dumper_target, s1 + " cannot be " + s2); + } +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TEST_CASE("DumpResults") +{ + DumpResults dr = {}; + CHECK_EQ(dr.bufsize, 0u); + CHECK_EQ(dr.lastok, DumpResults::noarg); + CHECK_UNARY(dr.write_arg(0)); + CHECK_FALSE(dr.success_until(0)); + CHECK_EQ(dr.argfail(), 0); +} + +struct DumpChecker +{ + static size_t s_num_calls; + static char s_workspace[100]; + static size_t s_accum_pos; + static char s_accum[100]; + static void s_reset() + { + s_num_calls = 0; + s_accum_pos = 0; + for(size_t i = 0; i < sizeof(s_workspace); ++i) + s_workspace[i] = '+'; + for(size_t i = 0; i < sizeof(s_accum); ++i) + s_accum[i] = '.'; + } + static void s_dump(csubstr buf) + { + REQUIRE_LT(buf.len, sizeof(s_workspace)); + REQUIRE_LT(s_accum_pos + buf.len, sizeof(s_accum)); + ++s_num_calls; + memcpy(s_accum + s_accum_pos, buf.str, buf.len); + s_accum_pos += buf.len; + } +}; +size_t DumpChecker::s_num_calls = 0; +char DumpChecker::s_workspace[100] = {}; +size_t DumpChecker::s_accum_pos = {}; +char DumpChecker::s_accum[100] = {}; + +struct CatDumpTplArg +{ + template<class ...Args> + static size_t call_cat_dump(Args&& ...args) + { + return cat_dump<&DumpChecker::s_dump>(std::forward<Args>(args)...); + } + template<class ...Args> + static DumpResults call_cat_dump_resume(Args&& ...args) + { + return cat_dump_resume<&DumpChecker::s_dump>(std::forward<Args>(args)...); + } + template<class ...Args> + static size_t call_catsep_dump(Args&& ...args) + { + return catsep_dump<&DumpChecker::s_dump>(std::forward<Args>(args)...); + } + template<class ...Args> + static DumpResults call_catsep_dump_resume(Args&& ...args) + { + return catsep_dump_resume<&DumpChecker::s_dump>(std::forward<Args>(args)...); + } + template<class ...Args> + static size_t call_format_dump(Args&& ...args) + { + return format_dump<&DumpChecker::s_dump>(std::forward<Args>(args)...); + } + template<class ...Args> + static DumpResults call_format_dump_resume(Args&& ...args) + { + return format_dump_resume<&DumpChecker::s_dump>(std::forward<Args>(args)...); + } +}; + +struct CatDumpFnArg +{ + template<class ...Args> + static size_t call_cat_dump(Args&& ...args) + { + return cat_dump(&DumpChecker::s_dump, std::forward<Args>(args)...); + } + template<class ...Args> + static DumpResults call_cat_dump_resume(Args&& ...args) + { + return cat_dump_resume(&DumpChecker::s_dump, std::forward<Args>(args)...); + } + template<class ...Args> + static size_t call_catsep_dump(Args&& ...args) + { + return catsep_dump(&DumpChecker::s_dump, std::forward<Args>(args)...); + } + template<class ...Args> + static DumpResults call_catsep_dump_resume(Args&& ...args) + { + return catsep_dump_resume(&DumpChecker::s_dump, std::forward<Args>(args)...); + } + template<class ...Args> + static size_t call_format_dump(Args&& ...args) + { + return format_dump(&DumpChecker::s_dump, std::forward<Args>(args)...); + } + template<class ...Args> + static DumpResults call_format_dump_resume(Args&& ...args) + { + return format_dump_resume(&DumpChecker::s_dump, std::forward<Args>(args)...); + } +}; + +namespace buffers { +int b1 = 1; +int b2 = 22; +int b3 = 333; +int b4 = 4444; +int sep = 90009; +size_t seplen = 5; +} + +TEST_CASE_TEMPLATE("cat_dump", T, CatDumpTplArg, CatDumpFnArg) +{ + using namespace buffers; + substr buf = DumpChecker::s_workspace; + auto accum = [&]{ return csubstr(DumpChecker::s_accum).first(DumpChecker::s_accum_pos); }; + SUBCASE("dont use the buffer with strings") + { + DumpChecker::s_reset(); + size_t needed_size = T::call_cat_dump(buf.first(0), b1); + CHECK_EQ(needed_size, 1); + CHECK_EQ(accum(), csubstr("")); + needed_size = T::call_cat_dump(buf.first(0), b1, b2); + CHECK_EQ(needed_size, 2); + CHECK_EQ(accum(), csubstr("")); + needed_size = T::call_cat_dump(buf.first(0), b1, b2, b3); + CHECK_EQ(needed_size, 3); + CHECK_EQ(accum(), csubstr("")); + needed_size = T::call_cat_dump(buf.first(0), b1, b2, b3, b4); + CHECK_EQ(needed_size, 4); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(0), ("1")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("")); + needed_size = T::call_cat_dump(buf.first(0), ("1"), ("22")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("")); + needed_size = T::call_cat_dump(buf.first(0), ("1"), ("22"), ("333")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("")); + needed_size = T::call_cat_dump(buf.first(0), ("1"), ("22"), ("333"), ("4444")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(0), csubstr("1")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("")); + needed_size = T::call_cat_dump(buf.first(0), csubstr("1"), csubstr("22")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("")); + needed_size = T::call_cat_dump(buf.first(0), csubstr("1"), csubstr("22"), csubstr("333")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("")); + needed_size = T::call_cat_dump(buf.first(0), csubstr("1"), csubstr("22"), csubstr("333"), csubstr("4444")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(1), b1); + CHECK_EQ(needed_size, 1); + CHECK_EQ(accum(), csubstr("1")); + needed_size = T::call_cat_dump(buf.first(1), b1, b2); + CHECK_EQ(needed_size, 2); + CHECK_EQ(accum(), csubstr("11")); + needed_size = T::call_cat_dump(buf.first(1), b1, b2, b3); + CHECK_EQ(needed_size, 3); + CHECK_EQ(accum(), csubstr("111")); + needed_size = T::call_cat_dump(buf.first(1), b1, b2, b3, b4); + CHECK_EQ(needed_size, 4); + CHECK_EQ(accum(), csubstr("1111")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(1), ("1")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("1")); + needed_size = T::call_cat_dump(buf.first(1), ("1"), ("22")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("1122")); + needed_size = T::call_cat_dump(buf.first(1), ("1"), ("22"), ("333")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("1122122333")); + needed_size = T::call_cat_dump(buf.first(1), ("1"), ("22"), ("333"), ("4444")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("11221223331223334444")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(1), csubstr("1")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("1")); + needed_size = T::call_cat_dump(buf.first(1), csubstr("1"), csubstr("22")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("1122")); + needed_size = T::call_cat_dump(buf.first(1), csubstr("1"), csubstr("22"), csubstr("333")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("1122122333")); + needed_size = T::call_cat_dump(buf.first(1), csubstr("1"), csubstr("22"), csubstr("333"), csubstr("4444")); + CHECK_EQ(needed_size, 0); + CHECK_EQ(accum(), csubstr("11221223331223334444")); + } + SUBCASE("1") + { + DumpChecker::s_reset(); + size_t needed_size = T::call_cat_dump(buf.first(0), b1); + CHECK_EQ(needed_size, 1u); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(1), csubstr("+")); // nothing was written + CHECK_EQ(accum(), csubstr("")); // nothing was written + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf, b1); + CHECK_EQ(needed_size, 1u); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(1), csubstr("1")); + CHECK_EQ(accum(), csubstr("1")); + } + SUBCASE("1 2") + { + DumpChecker::s_reset(); + size_t needed_size = T::call_cat_dump(buf.first(0), b1, b2); + CHECK_EQ(needed_size, 2); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(2), csubstr("++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(1), b1, b2); + CHECK_EQ(needed_size, 2); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(2), csubstr("1+")); // only the first character of b2 was written + CHECK_EQ(accum(), csubstr("1")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf, b1, b2); + CHECK_EQ(needed_size, 2); + CHECK_EQ(DumpChecker::s_num_calls, 2); + CHECK_EQ(buf.first(2), csubstr("22")); + CHECK_EQ(accum(), csubstr("122")); + } + SUBCASE("2 1") + { + DumpChecker::s_reset(); + size_t needed_size = T::call_cat_dump(buf, b2, b1); + CHECK_EQ(needed_size, 2); + CHECK_EQ(DumpChecker::s_num_calls, 2); + CHECK_EQ(buf.first(2), csubstr("12")); // wrote 2 then 1 + CHECK_EQ(accum(), csubstr("221")); + } + SUBCASE("1 2 3 4") + { + DumpChecker::s_reset(); + size_t needed_size = T::call_cat_dump(buf.first(0), b1, b2, b3, b4); + CHECK_EQ(needed_size, 4); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(1), b1, b2, b3, b4); + CHECK_EQ(needed_size, 4); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(4), csubstr("1+++")); + CHECK_EQ(accum(), csubstr("1")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(2), b1, b2, b3, b4); + CHECK_EQ(needed_size, 4); + CHECK_EQ(DumpChecker::s_num_calls, 2); + CHECK_EQ(buf.first(4), csubstr("22++")); + CHECK_EQ(accum(), csubstr("122")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(3), b1, b2, b3, b4); + CHECK_EQ(needed_size, 4); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(4), csubstr("333+")); + CHECK_EQ(accum(), csubstr("122333")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf, b1, b2, b3, b4); + CHECK_EQ(needed_size, 4); + CHECK_EQ(DumpChecker::s_num_calls, 4); + CHECK_EQ(buf.first(4), csubstr("4444")); + CHECK_EQ(accum(), csubstr("1223334444")); + } + SUBCASE("4 3 2 1") + { + DumpChecker::s_reset(); + size_t needed_size = T::call_cat_dump(buf.first(0), b4, b3, b2, b1); + CHECK_EQ(needed_size, 4); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(1), b4, b3, b2, b1); + CHECK_EQ(needed_size, 4); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(2), b4, b3, b2, b1); + CHECK_EQ(needed_size, 4); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf.first(3), b4, b3, b2, b1); + CHECK_EQ(needed_size, 4); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_cat_dump(buf, b4, b3, b2, b1); + CHECK_EQ(needed_size, 4); + CHECK_EQ(DumpChecker::s_num_calls, 4); + CHECK_EQ(buf.first(4), csubstr("1234")); + CHECK_EQ(accum(), csubstr("4444333221")); + } +} + +TEST_CASE_TEMPLATE("cat_dump_resume", T, CatDumpTplArg, CatDumpFnArg) +{ + using namespace buffers; + substr buf = DumpChecker::s_workspace; + auto accum = [&]{ return csubstr(DumpChecker::s_accum).first(DumpChecker::s_accum_pos); }; + SUBCASE("1") + { + DumpChecker::s_reset(); + DumpResults ret = T::call_cat_dump_resume(buf.first(0), b1); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_EQ(ret.bufsize, 1); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(1), csubstr("+")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + DumpResults retry = T::call_cat_dump_resume(ret, buf.first(1), b1); + CHECK_UNARY(retry.success_until(0)); + CHECK_UNARY(!retry.success_until(1)); + CHECK_UNARY(!retry.success_until(2)); + CHECK_EQ(retry.bufsize, 1); + CHECK_EQ(retry.lastok, 0); + CHECK_EQ(retry.argfail(), 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(1), csubstr("1")); + CHECK_EQ(accum(), csubstr("1")); + } + SUBCASE("1 2") + { + DumpChecker::s_reset(); + DumpResults ret = T::call_cat_dump_resume(buf.first(0), b1, b2); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_EQ(ret.bufsize, 2); // finds the buf size at once + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(2), csubstr("++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_cat_dump_resume(ret, buf.first(1), b1, b2); + CHECK_UNARY(!ret.success_until(0)); // ret.bufsize signals buffer is at least 2 + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_EQ(ret.bufsize, 2); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(2), csubstr("++")); + CHECK_EQ(accum(), csubstr("")); + ret = T::call_cat_dump_resume(ret, buf.first(2), b1, b2); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_EQ(ret.bufsize, 2); + CHECK_EQ(ret.lastok, 1); + CHECK_EQ(ret.argfail(), 2); + CHECK_EQ(DumpChecker::s_num_calls, 2); + CHECK_EQ(buf.first(2), csubstr("22")); + CHECK_EQ(accum(), csubstr("122")); + } + SUBCASE("1 2 3 4") + { + DumpChecker::s_reset(); + DumpResults ret = T::call_cat_dump_resume(buf.first(0), b1, b2, b3, b4); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_UNARY(!ret.success_until(3)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(4), csubstr("++++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_cat_dump_resume(ret, buf.first(1), b1, b2, b3, b4); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_UNARY(!ret.success_until(3)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + ret = T::call_cat_dump_resume(ret, buf.first(2), b1, b2, b3, b4); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_UNARY(!ret.success_until(3)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + ret = T::call_cat_dump_resume(ret, buf.first(3), b1, b2, b3, b4); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_UNARY(!ret.success_until(3)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + ret = T::call_cat_dump_resume(ret, buf.first(4), b1, b2, b3, b4); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(ret.success_until(2)); + CHECK_UNARY(ret.success_until(3)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, 3); + CHECK_EQ(ret.argfail(), 4); + CHECK_EQ(DumpChecker::s_num_calls, 4); + CHECK_EQ(buf.first(4), csubstr("4444")); + CHECK_EQ(accum(), csubstr("1223334444")); + } + SUBCASE("4 3 2 1") + { + DumpChecker::s_reset(); + DumpResults ret = T::call_cat_dump_resume(buf.first(0), b4, b3, b2, b1); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_UNARY(!ret.success_until(3)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(4), csubstr("++++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_cat_dump_resume(ret, buf.first(1), b4, b3, b2, b1); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_UNARY(!ret.success_until(3)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + ret = T::call_cat_dump_resume(ret, buf.first(2), b4, b3, b2, b1); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_UNARY(!ret.success_until(3)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + ret = T::call_cat_dump_resume(ret, buf.first(3), b4, b3, b2, b1); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_UNARY(!ret.success_until(3)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + ret = T::call_cat_dump_resume(ret, buf.first(4), b4, b3, b2, b1); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(ret.success_until(2)); + CHECK_UNARY(ret.success_until(3)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, 3); + CHECK_EQ(ret.argfail(), 4); + CHECK_EQ(DumpChecker::s_num_calls, 4); + CHECK_EQ(buf.first(4), csubstr("1234")); + CHECK_EQ(accum(), csubstr("4444333221")); + } +} + + + +TEST_CASE_TEMPLATE("catsep_dump", T, CatDumpTplArg, CatDumpFnArg) +{ + using namespace buffers; + size_t needed_size; + substr buf = DumpChecker::s_workspace; + auto accum = [&]{ return csubstr(DumpChecker::s_accum).first(DumpChecker::s_accum_pos); }; + SUBCASE("1") + { + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(0), sep, b1); + CHECK_EQ(needed_size, 1); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(1), csubstr("+")); // nothing was written + CHECK_EQ(accum(), csubstr("")); // nothing was written + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(1), sep, b1); + CHECK_EQ(needed_size, 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(1), csubstr("1")); + CHECK_EQ(accum(), csubstr("1")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(1 + seplen), sep, b1); + CHECK_EQ(needed_size, 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); // sep was not written + CHECK_EQ(buf.first(1), csubstr("1")); + CHECK_EQ(accum(), csubstr("1")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf, sep, b1); + CHECK_EQ(needed_size, 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); // sep was not written + CHECK_EQ(buf.first(1), csubstr("1")); + CHECK_EQ(accum(), csubstr("1")); + } + SUBCASE("1 2") + { + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(0), sep, b1, b2); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(2), csubstr("++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(1), sep, b1, b2); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(2), csubstr("1+")); + CHECK_EQ(accum(), csubstr("1")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(seplen), sep, b1, b2); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("22")); + CHECK_EQ(accum(), csubstr("19000922")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf, sep, b1, b2); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("22")); + CHECK_EQ(accum(), csubstr("19000922")); + } + SUBCASE("2 1") + { + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(0), sep, b2, b1); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(2), csubstr("++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(1), sep, b2, b1); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(2), csubstr("++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(seplen), sep, b2, b1); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("10")); + CHECK_EQ(accum(), csubstr("22900091")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf, sep, b2, b1); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("10")); + CHECK_EQ(accum(), csubstr("22900091")); + } + SUBCASE("1 2 3 4") + { + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(0), sep, b1, b2, b3, b4); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(1), sep, b1, b2, b3, b4); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(4), csubstr("1+++")); + CHECK_EQ(accum(), csubstr("1")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(2), sep, b1, b2, b3, b4); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(4), csubstr("1+++")); + CHECK_EQ(accum(), csubstr("1")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(3), sep, b1, b2, b3, b4); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(4), csubstr("1+++")); + CHECK_EQ(accum(), csubstr("1")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf, sep, b1, b2, b3, b4); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 7); + CHECK_EQ(buf.first(4), csubstr("4444")); + CHECK_EQ(accum(), csubstr("1900092290009333900094444")); + } + SUBCASE("4 3 2 1") + { + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(0), sep, b4, b3, b2, b1); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(1), sep, b4, b3, b2, b1); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(2), sep, b4, b3, b2, b1); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf.first(3), sep, b4, b3, b2, b1); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + needed_size = T::call_catsep_dump(buf, sep, b4, b3, b2, b1); + CHECK_EQ(needed_size, seplen); + CHECK_EQ(DumpChecker::s_num_calls, 7); + CHECK_EQ(buf.first(4), csubstr("1000")); + CHECK_EQ(accum(), csubstr("4444900093339000922900091")); + } +} + + +TEST_CASE_TEMPLATE("catsep_dump_resume", T, CatDumpTplArg, CatDumpFnArg) +{ + using namespace buffers; + substr buf = DumpChecker::s_workspace; + auto accum = [&]{ return csubstr(DumpChecker::s_accum).first(DumpChecker::s_accum_pos); }; + SUBCASE("1") + { + DumpChecker::s_reset(); + DumpResults ret = T::call_catsep_dump_resume(buf.first(0), sep, b1); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_EQ(ret.bufsize, 1); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(1), csubstr("+")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_catsep_dump_resume(ret, buf.first(1), sep, b1); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_EQ(ret.bufsize, 1); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(1), csubstr("1")); + CHECK_EQ(accum(), csubstr("1")); + ret = T::call_catsep_dump_resume(ret, buf, sep, b1); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_EQ(ret.bufsize, 1); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(1), csubstr("1")); + CHECK_EQ(accum(), csubstr("1")); + } + SUBCASE("1 2") + { + DumpChecker::s_reset(); + DumpResults ret = T::call_catsep_dump_resume(buf.first(0), sep, b1, b2); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_EQ(ret.bufsize, seplen); // finds the buf size at once + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(2), csubstr("++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_catsep_dump_resume(ret, buf.first(1), sep, b1, b2); + CHECK_UNARY(ret.success_until(0)); // b1 + CHECK_UNARY(!ret.success_until(1)); // sep + CHECK_UNARY(!ret.success_until(2)); // b2 + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); // sep + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(2), csubstr("1+")); + CHECK_EQ(accum(), csubstr("1")); + ret = T::call_catsep_dump_resume(ret, buf.first(2), sep, b1, b2); + CHECK_UNARY(ret.success_until(0)); // b1 + CHECK_UNARY(!ret.success_until(1)); // sep + CHECK_UNARY(!ret.success_until(2)); // b2 + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); // sep + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(2), csubstr("1+")); + CHECK_EQ(accum(), csubstr("1")); + ret = T::call_catsep_dump_resume(ret, buf.first(seplen), sep, b1, b2); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(ret.success_until(2)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, 2); + CHECK_EQ(ret.argfail(), 3); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("22")); + CHECK_EQ(accum(), csubstr("19000922")); + } + SUBCASE("1 2 3 4") + { + DumpChecker::s_reset(); + DumpResults ret = T::call_catsep_dump_resume(buf.first(0), sep, b1, b2, b3, b4); + CHECK_UNARY(!ret.success_until(0)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(4), csubstr("++++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_catsep_dump_resume(ret, buf.first(1), sep, b1, b2, b3, b4); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(4), csubstr("1+++")); // failed while writing sep + CHECK_EQ(accum(), csubstr("1")); + ret = T::call_catsep_dump_resume(ret, buf.first(2), sep, b1, b2, b3, b4); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(4), csubstr("1+++")); // failed while writing sep + CHECK_EQ(accum(), csubstr("1")); + ret = T::call_catsep_dump_resume(ret, buf.first(3), sep, b1, b2, b3, b4); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(4), csubstr("1+++")); + CHECK_EQ(accum(), csubstr("1")); + ret = T::call_catsep_dump_resume(ret, buf.first(4), sep, b1, b2, b3, b4); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(4), csubstr("1+++")); + CHECK_EQ(accum(), csubstr("1")); + ret = T::call_catsep_dump_resume(ret, buf.first(seplen), sep, b1, b2, b3, b4); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(ret.success_until(2)); + CHECK_UNARY(ret.success_until(3)); + CHECK_UNARY(ret.success_until(4)); + CHECK_UNARY(ret.success_until(5)); + CHECK_UNARY(ret.success_until(6)); + CHECK_UNARY(!ret.success_until(7)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, 6); + CHECK_EQ(ret.argfail(), 7); + CHECK_EQ(DumpChecker::s_num_calls, 7); + CHECK_EQ(buf.first(seplen), csubstr("44449")); + CHECK_EQ(accum(), csubstr("1900092290009333900094444")); + } + SUBCASE("4 3 2 1") + { + DumpChecker::s_reset(); + DumpResults ret = T::call_catsep_dump_resume(buf.first(0), sep, b4, b3, b2, b1); + CHECK_UNARY(!ret.success_until(0)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(4), csubstr("++++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_catsep_dump_resume(ret, buf.first(1), sep, b4, b3, b2, b1); + CHECK_UNARY(!ret.success_until(0)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + ret = T::call_catsep_dump_resume(ret, buf.first(2), sep, b4, b3, b2, b1); + CHECK_UNARY(!ret.success_until(0)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(4), csubstr("++++")); + CHECK_EQ(accum(), csubstr("")); + ret = T::call_catsep_dump_resume(ret, buf.first(seplen), sep, b4, b3, b2, b1); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(ret.success_until(2)); + CHECK_UNARY(ret.success_until(3)); + CHECK_UNARY(ret.success_until(4)); + CHECK_UNARY(ret.success_until(5)); + CHECK_UNARY(ret.success_until(6)); + CHECK_UNARY(!ret.success_until(7)); + CHECK_EQ(ret.bufsize, seplen); + CHECK_EQ(ret.lastok, 6); + CHECK_EQ(ret.argfail(), 7); + CHECK_EQ(DumpChecker::s_num_calls, 7); + CHECK_EQ(buf.first(seplen), csubstr("10009")); + CHECK_EQ(accum(), csubstr("4444900093339000922900091")); + } + SUBCASE("1 2 3 4 with seplen==3") + { + int s = 999; + DumpChecker::s_reset(); + DumpResults ret = T::call_catsep_dump_resume(buf.first(0), s, b1, b2, b3, b4); + CHECK_UNARY(!ret.success_until(0)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(4), csubstr("++++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_catsep_dump_resume(ret, buf.first(1), s, b1, b2, b3, b4); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(4), csubstr("1+++")); // failed while writing sep + CHECK_EQ(accum(), csubstr("1")); + ret = T::call_catsep_dump_resume(ret, buf.first(2), s, b1, b2, b3, b4); + CHECK_UNARY(ret.success_until(0)); // b1 + CHECK_UNARY(!ret.success_until(1)); // s + CHECK_UNARY(!ret.success_until(2)); // b2 + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(4), csubstr("1+++")); // failed while writing sep + CHECK_EQ(accum(), csubstr("1")); + ret = T::call_catsep_dump_resume(ret, buf.first(3), s, b1, b2, b3, b4); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(ret.success_until(2)); + CHECK_UNARY(ret.success_until(3)); + CHECK_UNARY(ret.success_until(4)); + CHECK_UNARY(ret.success_until(5)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, 5); + CHECK_EQ(ret.argfail(), 6); + CHECK_EQ(DumpChecker::s_num_calls, 6); + CHECK_EQ(buf.first(4), csubstr("999+")); // failed while writing b4 + CHECK_EQ(accum(), csubstr("199922999333999")); + ret = T::call_catsep_dump_resume(ret, buf.first(4), s, b1, b2, b3, b4); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(ret.success_until(2)); + CHECK_UNARY(ret.success_until(3)); + CHECK_UNARY(ret.success_until(4)); + CHECK_UNARY(ret.success_until(5)); + CHECK_UNARY(ret.success_until(6)); + CHECK_UNARY(!ret.success_until(7)); + CHECK_EQ(ret.bufsize, 4); + CHECK_EQ(ret.lastok, 6); + CHECK_EQ(ret.argfail(), 7); + CHECK_EQ(DumpChecker::s_num_calls, 7); + CHECK_EQ(buf.first(5), csubstr("4444+")); + CHECK_EQ(accum(), csubstr("1999229993339994444")); + } +} + + +TEST_CASE_TEMPLATE("format_dump", T, CatDumpTplArg, CatDumpFnArg) +{ + using namespace buffers; + size_t needed_size; + substr buf = DumpChecker::s_workspace; + auto accum = [&]{ return csubstr(DumpChecker::s_accum).first(DumpChecker::s_accum_pos); }; + SUBCASE("no buffer is needed for strings") + { + csubstr fmt = "{}-{}-{}-{}"; + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(0), fmt, "1", "22", "333", "4444"); // no buffer! + CHECK_EQ(needed_size, 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(1), csubstr("+")); + CHECK_EQ(accum(), csubstr("")); + DumpChecker::s_reset(); + CHECK_EQ(DumpChecker::s_num_calls, 0); + needed_size = T::call_format_dump(buf.first(1), fmt, "1", "22", "333", "4444"); // 1-len buffer, unused + CHECK_EQ(needed_size, 0); // no intermediate serialization is needed, since these are strings + CHECK_EQ(DumpChecker::s_num_calls, 7); // calls everything even when the buffer is empty + CHECK_EQ(accum(), csubstr("1-22-333-4444")); // dumped the full format string + } + SUBCASE("0") + { + csubstr fmt = "01234567890123456789"; + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(0), fmt, b1, b2, b3, b4); + CHECK_EQ(needed_size, 0); // the longest sized argument format argument + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls when the buffer is empty + CHECK_EQ(buf.first(needed_size), csubstr("")); // nothing was written + CHECK_EQ(accum(), csubstr("")); // dumped the full format string + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf, fmt, b1, b2, b3, b4); + CHECK_EQ(needed_size, 0); // the longest sized argument format argument + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(needed_size), csubstr("")); // nothing was written + CHECK_EQ(accum(), fmt); // dumped the full format string + } + SUBCASE("1") + { + // ____1____ 2 __3__ + csubstr fmt = "012345678_{}_34567"; + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(0), fmt, b1); + CHECK_EQ(needed_size, 1); // the longest sized argument format argument + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(2), csubstr("++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); // dumped first part of the format string + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(1), fmt, b1); + CHECK_EQ(needed_size, 1); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("1+")); + CHECK_EQ(accum(), csubstr("012345678_1_34567")); + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(1), fmt, b1, b2, b3, b4); // check that extra arguments are ignored + CHECK_EQ(needed_size, 1); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("1+")); + CHECK_EQ(accum(), csubstr("012345678_1_34567")); + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(1), fmt); // check that missing arguments are skipped + CHECK_EQ(needed_size, 0u); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(2), csubstr("++")); + CHECK_EQ(accum(), csubstr("012345678_{}_34567")); + } + SUBCASE("1 2") + { + // ____1____ 2 __3__ 4 _5_ + csubstr fmt = "012345678_{}_34567_{}_aaa"; + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(0), fmt, b1, b2); + CHECK_EQ(needed_size, 2); // the longest sized argument format argument + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(2), csubstr("++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); // dumped first part of the format string + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(1), fmt, b1, b2); + CHECK_EQ(needed_size, 2); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("1+")); + CHECK_EQ(accum(), csubstr("012345678_1_34567_")); + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(2), fmt, b1, b2); + CHECK_EQ(needed_size, 2); + CHECK_EQ(DumpChecker::s_num_calls, 5); + CHECK_EQ(buf.first(2), csubstr("22")); + CHECK_EQ(accum(), csubstr("012345678_1_34567_22_aaa")); + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(1), fmt); // check that missing arguments are skipped + CHECK_EQ(needed_size, 0u); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(2), csubstr("++")); + CHECK_EQ(accum(), csubstr("012345678_{}_34567_{}_aaa")); + } + SUBCASE("1 2 3") + { + // 1 2 3 4 5 6 + csubstr fmt = "012345678_{}_34567_{}_aaa___{}"; + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(0), fmt, b1, b2, b3); + CHECK_EQ(needed_size, 3); // the longest sized argument format argument + CHECK_EQ(DumpChecker::s_num_calls, 0); + CHECK_EQ(buf.first(2), csubstr("++")); // nothing was written + CHECK_EQ(accum(), csubstr("")); // dumped first part of the format string + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(1), fmt, b1, b2, b3); + CHECK_EQ(needed_size, 3); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("1+")); + CHECK_EQ(accum(), csubstr("012345678_1_34567_")); + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(2), fmt, b1, b2, b3); + CHECK_EQ(needed_size, 3); + CHECK_EQ(DumpChecker::s_num_calls, 5); + CHECK_EQ(buf.first(2), csubstr("22")); + CHECK_EQ(accum(), csubstr("012345678_1_34567_22_aaa___")); + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf.first(3), fmt, b1, b2, b3); + CHECK_EQ(needed_size, 3); + CHECK_EQ(DumpChecker::s_num_calls, 6); + CHECK_EQ(buf.first(2), csubstr("33")); + CHECK_EQ(accum(), csubstr("012345678_1_34567_22_aaa___333")); + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf, fmt); // check that missing arguments are skipped + CHECK_EQ(needed_size, 0u); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(2), csubstr("++")); + CHECK_EQ(accum(), csubstr("012345678_{}_34567_{}_aaa___{}")); + DumpChecker::s_reset(); + needed_size = T::call_format_dump(buf, fmt, b1); // check that missing arguments are skipped + CHECK_EQ(needed_size, 1); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("1+")); + CHECK_EQ(accum(), csubstr("012345678_1_34567_{}_aaa___{}")); + } +} + + +TEST_CASE_TEMPLATE("format_dump_resume", T, CatDumpTplArg, CatDumpFnArg) +{ + using namespace buffers; + substr buf = DumpChecker::s_workspace; + auto accum = [&]{ return csubstr(DumpChecker::s_accum).first(DumpChecker::s_accum_pos); }; + SUBCASE("1") + { + csubstr fmt = "aaa_then_{}_then_bbb"; + DumpChecker::s_reset(); + DumpResults ret = T::call_format_dump_resume(buf.first(0), fmt, b1); + CHECK_UNARY(!ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_UNARY(!ret.success_until(2)); + CHECK_EQ(ret.bufsize, 1); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(1), csubstr("+")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_format_dump_resume(ret, buf.first(1), fmt, b1); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(ret.success_until(2)); + CHECK_EQ(ret.bufsize, 1); + CHECK_EQ(ret.lastok, 2); + CHECK_EQ(ret.argfail(), 3); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("1+")); + CHECK_EQ(accum(), csubstr("aaa_then_1_then_bbb")); + } + SUBCASE("2") + { + csubstr fmt = "aaa_then_{}_then_bbb_then_{}__then_epilogue"; + DumpChecker::s_reset(); + DumpResults ret = T::call_format_dump_resume(buf.first(0), fmt, b1, b2); + CHECK_UNARY(!ret.success_until(0)); + CHECK_EQ(ret.bufsize, 2); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(1), csubstr("+")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_format_dump_resume(ret, buf.first(1), fmt, b1, b2); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(ret.success_until(2)); + CHECK_UNARY(!ret.success_until(3)); + CHECK_EQ(ret.bufsize, 2); + CHECK_EQ(ret.lastok, 2); + CHECK_EQ(ret.argfail(), 3); + CHECK_EQ(DumpChecker::s_num_calls, 3); + CHECK_EQ(buf.first(2), csubstr("1+")); + CHECK_EQ(accum(), csubstr("aaa_then_1_then_bbb_then_")); + ret = T::call_format_dump_resume(ret, buf.first(2), fmt, b1, b2); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(ret.success_until(1)); + CHECK_UNARY(ret.success_until(2)); + CHECK_UNARY(ret.success_until(3)); + CHECK_UNARY(ret.success_until(4)); + CHECK_EQ(ret.bufsize, 2); + CHECK_EQ(ret.lastok, 4); + CHECK_EQ(ret.argfail(), 5); + CHECK_EQ(DumpChecker::s_num_calls, 5); + CHECK_EQ(buf.first(2), csubstr("22")); + CHECK_EQ(accum(), csubstr("aaa_then_1_then_bbb_then_22__then_epilogue")); + } + SUBCASE("no args") + { + csubstr fmt = "no args { -- }"; + DumpChecker::s_reset(); + DumpResults ret = T::call_format_dump_resume(buf.first(0), fmt, b1, b2); + CHECK_UNARY(!ret.success_until(0)); + CHECK_EQ(ret.bufsize, 0); + CHECK_EQ(ret.lastok, DumpResults::noarg); + CHECK_EQ(ret.argfail(), 0); + CHECK_EQ(DumpChecker::s_num_calls, 0); // no calls to dump + CHECK_EQ(buf.first(1), csubstr("+")); // nothing was written + CHECK_EQ(accum(), csubstr("")); + ret = T::call_format_dump_resume(ret, buf.first(1), fmt, b1, b2); + CHECK_UNARY(ret.success_until(0)); + CHECK_UNARY(!ret.success_until(1)); + CHECK_EQ(ret.bufsize, 0); + CHECK_EQ(ret.lastok, 0); + CHECK_EQ(ret.argfail(), 1); + CHECK_EQ(DumpChecker::s_num_calls, 1); + CHECK_EQ(buf.first(2), "++"); + CHECK_EQ(accum(), fmt); + } +} + +} // namespace c4 + +#ifdef __clang__ +# pragma clang diagnostic pop +#elif defined(__GNUC__) +# pragma GCC diagnostic pop +#endif + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_enum.cpp b/thirdparty/ryml/ext/c4core/test/test_enum.cpp new file mode 100644 index 000000000..b2dad0bbd --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_enum.cpp @@ -0,0 +1,158 @@ +#ifndef C4CORE_SINGLE_HEADER +#include <c4/std/std.hpp> +#include <c4/substr.hpp> +#include <c4/enum.hpp> +#endif + +#include <c4/test.hpp> + +#include "./test_enum_common.hpp" +#include "c4/libtest/supprwarn_push.hpp" +#include <vector> + + +TEST_CASE("eoffs.simple_enum") +{ + using namespace c4; + CHECK_EQ(eoffs_cls<MyEnum>(), 0); + CHECK_EQ(eoffs_pfx<MyEnum>(), 0); +} + +TEST_CASE("eoffs.scoped_enum") +{ + using namespace c4; + CHECK_EQ(eoffs_cls<MyEnumClass>(), strlen("MyEnumClass::")); + CHECK_EQ(eoffs_pfx<MyEnumClass>(), 0); +} + +TEST_CASE("eoffs.simple_bitmask") +{ + using namespace c4; + CHECK_EQ(eoffs_cls<MyBitmask>(), 0); + CHECK_EQ(eoffs_pfx<MyBitmask>(), strlen("BM_")); +} + +TEST_CASE("eoffs.scoped_bitmask") +{ + using namespace c4; + CHECK_EQ(eoffs_cls<MyBitmaskClass>(), strlen("MyBitmaskClass::")); + CHECK_EQ(eoffs_pfx<MyBitmaskClass>(), strlen("MyBitmaskClass::BM_")); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +#ifdef __clang__ +# pragma clang diagnostic push +#elif defined(__GNUC__) +# pragma GCC diagnostic push +# if __GNUC__ >= 6 +# pragma GCC diagnostic ignored "-Wnull-dereference" +# endif +#endif + +template<typename Enum> +void cmp_enum(Enum lhs, Enum rhs) +{ + using I = typename std::underlying_type<Enum>::type; + CHECK_EQ(static_cast<I>(lhs), static_cast<I>(rhs)); +} + +template<class Enum> +void test_esyms() +{ + auto ss = c4::esyms<Enum>(); + CHECK_NE(ss.size(), 0); + CHECK_FALSE(ss.empty()); + for(auto s : ss) + { + REQUIRE_NE(ss.find(s.name), nullptr); + REQUIRE_NE(ss.find(s.value), nullptr); + CHECK_STREQ(ss.find(s.name)->name, s.name); + CHECK_STREQ(ss.find(s.value)->name, s.name); + cmp_enum(ss.find(s.name)->value, s.value); + cmp_enum(ss.find(s.value)->value, s.value); + } +} + +#ifdef __clang__ +# pragma clang diagnostic pop +#elif defined(__GNUC__) +# pragma GCC diagnostic pop +#endif + + +TEST_CASE("esyms.simple_enum") +{ + test_esyms<MyEnum>(); +} + +TEST_CASE("esyms.scoped_enum") +{ + test_esyms<MyEnumClass>(); +} + +TEST_CASE("esyms.simple_bitmask") +{ + test_esyms<MyBitmask>(); +} + +TEST_CASE("esyms.scoped_bitmask") +{ + test_esyms<MyBitmaskClass>(); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + + +template<typename Enum> +void test_e2str() +{ + using namespace c4; + using I = typename std::underlying_type<Enum>::type; + auto ss = esyms<Enum>(); + CHECK_NE(ss.size(), 0); + CHECK_FALSE(ss.empty()); + for(auto const& p : ss) + { + // test round trips + cmp_enum(str2e<Enum>(e2str(p.value)), p.value); + CHECK_STREQ(e2str(str2e<Enum>(p.name)), p.name); + } +} + + +TEST_CASE("e2str.simple_enum") +{ + test_e2str<MyEnum>(); +} + +TEST_CASE("e2str.scoped_enum") +{ + test_e2str<MyEnumClass>(); + cmp_enum(c4::str2e<MyEnumClass>("MyEnumClass::FOO"), MyEnumClass::FOO); + cmp_enum(c4::str2e<MyEnumClass>("FOO"), MyEnumClass::FOO); +} + +TEST_CASE("e2str.simple_bitmask") +{ + test_e2str<MyBitmask>(); + cmp_enum(c4::str2e<MyBitmask>("BM_FOO"), BM_FOO); + cmp_enum(c4::str2e<MyBitmask>("FOO"), BM_FOO); +} + +TEST_CASE("e2str.scoped_bitmask") +{ + using I = typename std::underlying_type<MyBitmaskClass>::type; + test_e2str<MyBitmaskClass>(); + cmp_enum(c4::str2e<MyBitmaskClass>("MyBitmaskClass::BM_FOO"), MyBitmaskClass::BM_FOO); + cmp_enum(c4::str2e<MyBitmaskClass>("BM_FOO"), MyBitmaskClass::BM_FOO); + cmp_enum(c4::str2e<MyBitmaskClass>("FOO"), MyBitmaskClass::BM_FOO); +} + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_enum_common.hpp b/thirdparty/ryml/ext/c4core/test/test_enum_common.hpp new file mode 100644 index 000000000..9acd621cf --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_enum_common.hpp @@ -0,0 +1,213 @@ +#ifndef _C4_ENUM_COMMON_HPP_ +#define _C4_ENUM_COMMON_HPP_ + +#ifndef C4CORE_SINGLE_HEADER +#include <c4/enum.hpp> +#endif + +typedef enum { + FOO = 0, + BAR, + BAZ, +} MyEnum; + +namespace c4 { +template<> +inline const EnumSymbols<MyEnum> esyms<MyEnum>() +{ + static const EnumSymbols<MyEnum>::Sym rs[] = + { + {FOO, "FOO"}, + {BAR, "BAR"}, + {BAZ, "BAZ"}, + }; + EnumSymbols<MyEnum> r(rs); + return r; +} +} // namespace c4 + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +enum class MyEnumClass { + FOO = 0, + BAR, + BAZ, +}; + + +namespace c4 { +template<> +inline const EnumSymbols<MyEnumClass> esyms<MyEnumClass>() +{ + static const EnumSymbols<MyEnumClass>::Sym rs[] = + { + {MyEnumClass::FOO, "MyEnumClass::FOO"}, + {MyEnumClass::BAR, "MyEnumClass::BAR"}, + {MyEnumClass::BAZ, "MyEnumClass::BAZ"}, + }; + EnumSymbols<MyEnumClass> r(rs); + return r; +} + + +template<> +inline size_t eoffs_cls<MyEnumClass>() +{ + return 13; // same as strlen("MyEnumClass::") +} +} // namespace c4 + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +typedef enum { + BM_NONE = 0, + BM_FOO = 1 << 0, + BM_BAR = 1 << 1, + BM_BAZ = 1 << 2, + BM_FOO_BAR = BM_FOO|BM_BAR, + BM_FOO_BAR_BAZ = BM_FOO|BM_BAR|BM_BAZ, +} MyBitmask; + +namespace c4 { +template<> +inline const EnumSymbols<MyBitmask> esyms<MyBitmask>() +{ + static const EnumSymbols<MyBitmask>::Sym rs[] = + { + {BM_NONE, "BM_NONE"}, + {BM_FOO, "BM_FOO"}, + {BM_BAR, "BM_BAR"}, + {BM_BAZ, "BM_BAZ"}, + {BM_FOO_BAR, "BM_FOO_BAR"}, + {BM_FOO_BAR_BAZ, "BM_FOO_BAR_BAZ"}, + }; + EnumSymbols<MyBitmask> r(rs); + return r; +} + +template<> +inline size_t eoffs_pfx<MyBitmask>() +{ + return 3; // same as strlen("BM_") +} +} // namespace c4 + + + +typedef enum { + // no null value + BM_KABOOM = 1, + BM_PAFF = 2, + BM_PEW = 4, + BM_POW = 7, +} BmWithoutNull; + + +namespace c4 { +template<> +inline const c4::EnumSymbols<BmWithoutNull> esyms<BmWithoutNull>() +{ + static const EnumSymbols<BmWithoutNull>::Sym rs[] = + { + {BM_KABOOM, "KABOOM"}, + {BM_PAFF , "PAFF"}, + {BM_PEW , "PEW"}, + {BM_POW , "POW"}, + }; + EnumSymbols<BmWithoutNull> r(rs); + return r; +} + +template<> +inline size_t eoffs_pfx<BmWithoutNull>() +{ + return 3; // same as strlen("BM_") +} +} // namespace c4 + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +enum class MyBitmaskClass { + BM_NONE = 0, + BM_FOO = 1 << 0, + BM_BAR = 1 << 1, + BM_BAZ = 1 << 2, + BM_FOO_BAR = BM_FOO|BM_BAR, + BM_FOO_BAR_BAZ = BM_FOO|BM_BAR|BM_BAZ, +}; + +namespace c4 { + +template<> +inline const EnumSymbols<MyBitmaskClass> esyms<MyBitmaskClass>() +{ + static const EnumSymbols<MyBitmaskClass>::Sym rs[] = + { + {MyBitmaskClass::BM_NONE, "MyBitmaskClass::BM_NONE"}, + {MyBitmaskClass::BM_FOO, "MyBitmaskClass::BM_FOO"}, + {MyBitmaskClass::BM_BAR, "MyBitmaskClass::BM_BAR"}, + {MyBitmaskClass::BM_BAZ, "MyBitmaskClass::BM_BAZ"}, + {MyBitmaskClass::BM_FOO_BAR, "MyBitmaskClass::BM_FOO_BAR"}, + {MyBitmaskClass::BM_FOO_BAR_BAZ, "MyBitmaskClass::BM_FOO_BAR_BAZ"}, + }; + EnumSymbols<MyBitmaskClass> r(rs); + return r; +} + +template<> inline size_t eoffs_cls< MyBitmaskClass >() +{ + return 16; // same as strlen("MyBitmaskClass::") +} +template<> inline size_t eoffs_pfx< MyBitmaskClass >() +{ + return 19; // same as strlen("MyBitmaskClass::BM_") +} + +} // namespace c4 + + +enum class BmClassWithoutNull { + // no null value + BM_KABOOM = 1, + BM_PAFF = 2, + BM_PEW = 4, + BM_POW = 7, +}; + + +namespace c4 { +template<> +inline const c4::EnumSymbols<BmClassWithoutNull> esyms<BmClassWithoutNull>() +{ + static const EnumSymbols<BmClassWithoutNull>::Sym rs[] = + { + {BmClassWithoutNull::BM_KABOOM, "BmClassWithoutNull::BM_KABOOM"}, + {BmClassWithoutNull::BM_PAFF , "BmClassWithoutNull::BM_PAFF"}, + {BmClassWithoutNull::BM_PEW , "BmClassWithoutNull::BM_PEW"}, + {BmClassWithoutNull::BM_POW , "BmClassWithoutNull::BM_POW"}, + }; + EnumSymbols<BmClassWithoutNull> r(rs); + return r; +} + +template<> inline size_t eoffs_cls<BmClassWithoutNull>() +{ + return strlen("BmClassWithoutNull::"); +} +template<> inline size_t eoffs_pfx<BmClassWithoutNull>() +{ + return strlen("BmClassWithoutNull::BM_"); +} +} // namespace c4 + + +#endif /* _C4_ENUM_COMMON_HPP_ */ diff --git a/thirdparty/ryml/ext/c4core/test/test_error.cpp b/thirdparty/ryml/ext/c4core/test/test_error.cpp new file mode 100644 index 000000000..96584ab92 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_error.cpp @@ -0,0 +1,635 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/error.hpp" +#endif + +#include "c4/test.hpp" +#include "c4/libtest/supprwarn_push.hpp" + +C4_BEGIN_HIDDEN_NAMESPACE +bool got_an_error = false; +void error_callback(const char *msg, size_t msg_sz) +{ + CHECK_EQ(strncmp(msg, "bla bla", msg_sz), 0); + CHECK_EQ(msg_sz, 7); + got_an_error = true; +} +inline c4::ScopedErrorSettings tmp_err() +{ + got_an_error = false; + return c4::ScopedErrorSettings(c4::ON_ERROR_CALLBACK, error_callback); +} +C4_END_HIDDEN_NAMESPACE + +namespace c4 { + +TEST_CASE("Error.scoped_callback") +{ + auto orig = get_error_callback(); + { + auto tmp = tmp_err(); + CHECK_EQ(get_error_callback() == error_callback, true); + C4_ERROR("bla bla"); + CHECK_EQ(got_an_error, true); + } + CHECK_EQ(get_error_callback() == orig, true); +} + +} // namespace c4 + +TEST_CASE("Error.outside_of_c4_namespace") +{ + auto orig = c4::get_error_callback(); + { + auto tmp = tmp_err(); + CHECK_EQ(c4::get_error_callback() == error_callback, true); + C4_ERROR("bla bla"); + CHECK_EQ(got_an_error, true); + } + CHECK_EQ(c4::get_error_callback() == orig, true); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// WIP: new error handling code + + +#include <string> // temporary; just for the exception example +#include <iostream> // temporary; just for the exception example + +namespace c4 { + +#define C4_ERR_FMT_BUFFER_SIZE 256 + +using locref = c4::srcloc const& C4_RESTRICT; + +using pfn_err = void (*)(locref loc, void *data); +using pfn_warn = void (*)(locref loc, void *data); +using pfn_msg_begin = void (*)(locref loc, void *data); +using pfn_msg_part = void (*)(const char* msg, size_t size, void *data); +using pfn_msg_end = void (*)(void *data); + +struct ErrorCallbacks +{ + void *user_data; + + pfn_err err; + pfn_warn warn; + pfn_msg_begin msg_begin; + pfn_msg_part msg_part; + pfn_msg_end msg_end; + + bool msg_enabled() const { return msg_begin != nullptr; } + + template<size_t N> + void msg(const char (&s)[N]) + { + msg_part(s, N-1, user_data); + } + void msg(const char *msg, size_t sz) + { + msg_part(msg, sz, user_data); + } + void msg(char c) + { + msg_part(&c, 1, user_data); + } +}; + +#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 && __GNUC__ < 5 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif +TEST_CASE("ErrorCallbacks.default_obj") +{ + ErrorCallbacks cb {}; + CHECK_EQ(cb.user_data, nullptr); + CHECK_EQ(cb.err, nullptr); + CHECK_EQ(cb.warn, nullptr); + CHECK_EQ(cb.msg_begin, nullptr); + CHECK_EQ(cb.msg_part, nullptr); + CHECK_EQ(cb.msg_end, nullptr); +} +#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 && __GNUC__ < 5 +#pragma GCC diagnostic pop +#endif + +template<class ErrBhv> +struct ErrorCallbacksBridgeFull +{ + ErrorCallbacks callbacks() const + { + return { + (ErrBhv*)this, + ErrorCallbacksBridgeFull<ErrBhv>::on_err, + ErrorCallbacksBridgeFull<ErrBhv>::on_warn, + ErrorCallbacksBridgeFull<ErrBhv>::on_msg_begin, + ErrorCallbacksBridgeFull<ErrBhv>::on_msg_part, + ErrorCallbacksBridgeFull<ErrBhv>::on_msg_end, + }; + } + static void on_err(locref loc, void *data) + { + ((ErrBhv*)data)->err(loc); + } + static void on_warn(locref loc, void *data) + { + ((ErrBhv*)data)->warn(loc); + } + static void on_msg_begin(locref loc, void *data) + { + ((ErrBhv*)data)->msg_begin(loc); + } + static void on_msg_part(const char *part, size_t size, void *data) + { + ((ErrBhv*)data)->msg_part(part, size); + } + static void on_msg_end(void *data) + { + ((ErrBhv*)data)->msg_end(); + } +}; + +template<class ErrBhv> +struct ErrorCallbacksBridge +{ + ErrorCallbacks callbacks() const + { + return { + (ErrBhv*)this, + ErrorCallbacksBridge<ErrBhv>::on_err, + ErrorCallbacksBridge<ErrBhv>::on_warn, + (pfn_msg_begin)nullptr, + (pfn_msg_part)nullptr, + (pfn_msg_end)nullptr + }; + } + static void on_err(locref loc, void *data) + { + ((ErrBhv*)data)->err(loc); + } + static void on_warn(locref loc, void *data) + { + ((ErrBhv*)data)->warn(loc); + } +}; + + +void fputi(int val, FILE *f); + +void _errmsg(locref loc) +{ + fputs(loc.file, stderr); + fputc(':', stderr); + fputi(loc.line, stderr); + fputs(": ", stderr); + fflush(stderr); +} + +void _errmsg(const char *part, size_t part_size) +{ + fwrite(part, 1u, part_size, stderr); + fflush(stderr); +} + +/** example implementation using old-style abort */ +struct ErrorBehaviorAbort : public ErrorCallbacksBridgeFull<ErrorBehaviorAbort> +{ + static void msg_begin(locref loc) + { + fputc('\n', stderr); + _errmsg(loc); + } + static void msg_part(const char *part, size_t part_size) + { + _errmsg(part, part_size); + } + static void msg_end() + { + fputc('\n', stderr); + fflush(stderr); + } + static void err(locref) + { + abort(); + } + static void warn(locref) + { + // nothing to do + } +}; + + +TEST_CASE("ErrorBehaviorAbort.default_obj") +{ + ErrorBehaviorAbort bhv; + auto cb = bhv.callbacks(); + CHECK_NE(cb.user_data, nullptr); + CHECK_NE(cb.err, nullptr); + CHECK_NE(cb.warn, nullptr); + CHECK_NE(cb.msg_begin, nullptr); + CHECK_NE(cb.msg_part, nullptr); + CHECK_NE(cb.msg_end, nullptr); +} + + +void fputi(int val, FILE *f); +void _append(std::string *s, int line); + +/** example implementation using vanilla c++ std::runtime_error */ +struct ErrorBehaviorRuntimeError : public ErrorCallbacksBridgeFull<ErrorBehaviorRuntimeError> +{ + std::string exc_msg{}; + + void msg_begin(locref loc) + { + exc_msg.reserve(strlen(loc.file) + 16); + exc_msg = '\n'; + exc_msg += loc.file; + exc_msg += ':'; + _append(&exc_msg, loc.line); + exc_msg += ": "; + } + void msg_part(const char *part, size_t part_size) + { + exc_msg.append(part, part_size); + } + void msg_end() + { + std::cerr << exc_msg << "\n"; + } + void err(locref) + { + throw std::runtime_error(exc_msg); + } + void warn(locref) + { + } +}; + + + +TEST_CASE("ErrorBehaviorRuntimeError.default_obj") +{ + ErrorBehaviorRuntimeError bhv; + auto cb = bhv.callbacks(); + CHECK_NE(cb.user_data, nullptr); + CHECK_NE(cb.err, nullptr); + CHECK_NE(cb.warn, nullptr); + CHECK_NE(cb.msg_begin, nullptr); + CHECK_NE(cb.msg_part, nullptr); + CHECK_NE(cb.msg_end, nullptr); +} + + + + +ErrorBehaviorAbort s_err_abort = ErrorBehaviorAbort(); +ErrorCallbacks s_err_callbacks = s_err_abort.callbacks(); + + +void new_handle_error(locref loc, size_t msg_size, const char *msg) +{ + if(s_err_callbacks.msg_enabled()) + { + s_err_callbacks.msg_begin(loc, s_err_callbacks.user_data); + s_err_callbacks.msg("ERROR: "); + s_err_callbacks.msg(msg, msg_size); + s_err_callbacks.msg_end(s_err_callbacks.user_data); + } + s_err_callbacks.err(loc, s_err_callbacks.user_data); +} + +void new_handle_warning(locref loc, size_t msg_size, const char *msg) +{ + if(s_err_callbacks.msg_enabled()) + { + s_err_callbacks.msg_begin(loc, s_err_callbacks.user_data); + s_err_callbacks.msg("WARNING: "); + s_err_callbacks.msg(msg, msg_size); + s_err_callbacks.msg_end(s_err_callbacks.user_data); + } + s_err_callbacks.warn(loc, s_err_callbacks.user_data); +} + +template<size_t N> +C4_ALWAYS_INLINE void new_handle_error(locref loc, const char (&msg)[N]) +{ + new_handle_error(loc, N-1, msg); +} + +template<size_t N> +C4_ALWAYS_INLINE void new_handle_warning(locref loc, const char (&msg)[N]) +{ + new_handle_warning(loc, N-1, msg); +} + + +#define C4_ERROR_NEW(msg) c4::new_handle_error(C4_SRCLOC(), msg) +#define C4_WARNING_NEW(msg) c4::new_handle_warning(C4_SRCLOC(), msg) + +#define C4_ERROR_NEW_SZ(msg, msglen) c4::new_handle_error(C4_SRCLOC(), msglen, msg) +#define C4_WARNING_NEW_SZ(msg, msglen) c4::new_handle_warning(C4_SRCLOC(), msglen, msg) + +} // namespace c4 + +#ifndef C4CORE_SINGLE_HEADER +#include <c4/substr.hpp> +#include <c4/charconv.hpp> +#endif + +namespace c4 { + +void fputi(int val, FILE *f) +{ + char buf[16]; + size_t ret = c4::itoa(buf, val); + ret = ret < sizeof(buf) ? ret : sizeof(buf); + fwrite(buf, 1u, ret, f); +} + +// to avoid using std::to_string() +void _append(std::string *s, int line) +{ + auto sz = s->size(); + s->resize(sz + 16); + auto ret = itoa(substr(&((*s)[0]) + sz, 16u), line); + s->resize(sz + ret); + if(ret >= sz) + { + itoa(substr(&((*s)[0]) + sz, 16u), line); + } +} + +} // namespace c4 +template<class ErrorBehavior> +struct ScopedErrorBehavior +{ + c4::ErrorCallbacks m_prev; + ErrorBehavior m_tmp; + const char *m_name; + ScopedErrorBehavior(const char* name) : m_prev(c4::s_err_callbacks), m_tmp(), m_name(name) + { + c4::s_err_callbacks = m_tmp.callbacks(); + } + ~ScopedErrorBehavior() + { + c4::s_err_callbacks = m_prev; + } +}; +#define C4_TMP_ERR_BHV(bhv_ty) ScopedErrorBehavior<c4::bhv_ty>(#bhv_ty) + +template<size_t N> +void test_error_exception(const char (&msg)[N]) +{ + INFO(msg); + { + auto tmp1 = C4_TMP_ERR_BHV(ErrorBehaviorAbort); + + { + auto tmp2 = C4_TMP_ERR_BHV(ErrorBehaviorRuntimeError); + + bool got_exc = false; + try { + C4_ERROR_NEW(msg); + } + catch(std::exception const& e) { + // check that the error terminates with the given message + auto what = c4::to_csubstr(e.what()).last(N-1); + CHECK_EQ(what, msg); + got_exc = (what == msg); + } + CHECK(got_exc); + + got_exc = false; + try { + C4_ERROR_NEW_SZ(msg, N-1); + } + catch(std::exception const& e) { + // check that the error terminates with the given message + auto what = c4::to_csubstr(e.what()).last(N-1); + CHECK_EQ(what, msg); + got_exc = (what == msg); + } + CHECK(got_exc); + } + } +} + +template<size_t N> +void test_warning_exception(const char (&msg)[N]) +{ + auto tmp = C4_TMP_ERR_BHV(ErrorBehaviorRuntimeError); + C4_WARNING_NEW(msg); + auto const& wmsg = tmp.m_tmp.exc_msg; + REQUIRE_FALSE(wmsg.empty()); + REQUIRE_GT(wmsg.size(), N); + auto what = c4::to_csubstr(wmsg.c_str()).last(N-1); + CHECK_EQ(what, msg); + + C4_WARNING_NEW_SZ(msg, N-1); + REQUIRE_FALSE(wmsg.empty()); + REQUIRE_GT(wmsg.size(), N); + what = c4::to_csubstr(wmsg.c_str()).last(N-1); + CHECK_EQ(what, msg); +} + +TEST_CASE("error.exception") +{ + test_error_exception("some error with some message"); + test_error_exception("some error with another message"); +} + +TEST_CASE("warning.exception") +{ + test_warning_exception("some warning"); + test_warning_exception("some other warning"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +#ifndef C4CORE_SINGLE_HEADER +#include <c4/substr.hpp> +#include <c4/charconv.hpp> +#endif + +namespace c4 { + +template<class T> +void _err_send(T const& arg) +{ + char buf[C4_ERR_FMT_BUFFER_SIZE]; + size_t num = to_chars(buf, arg); + num = num < C4_ERR_FMT_BUFFER_SIZE ? num : C4_ERR_FMT_BUFFER_SIZE; + s_err_callbacks.msg_part(buf, num, s_err_callbacks.user_data); +} + + +size_t _find_fmt(const char *C4_RESTRICT fmt, size_t len) +{ + for(size_t i = 0; i < len; ++i) + { + if(fmt[i] != '{') + { + continue; + } + if(i + 1 == len) + { + break; + } + if(fmt[i+1] == '}') + { + return i; + } + } + return (size_t)-1; +} + +void _err_fmt(size_t fmt_size, const char *C4_RESTRICT fmt) +{ + s_err_callbacks.msg_part(fmt, fmt_size, s_err_callbacks.user_data); +} + +template<class Arg, class ...Args> +void _err_fmt(size_t fmt_size, const char *C4_RESTRICT fmt, Arg const& C4_RESTRICT arg, Args const& C4_RESTRICT ...args) +{ + size_t pos = _find_fmt(fmt, fmt_size); + if(pos == (size_t)-1) + { + s_err_callbacks.msg_part(fmt, fmt_size, s_err_callbacks.user_data); + return; + } + s_err_callbacks.msg_part(fmt, pos, s_err_callbacks.user_data); + _err_send(arg); + pos += 2; + _err_fmt(fmt_size - pos, fmt + pos, args...); +} + +template<class ...Args> +void err_fmt(locref loc, size_t fmt_size, const char *fmt, Args const& C4_RESTRICT ...args) +{ + s_err_callbacks.msg_begin(loc, s_err_callbacks.user_data); + s_err_callbacks.msg("ERROR: "); + _err_fmt(fmt_size, fmt, args...); + s_err_callbacks.msg_end(s_err_callbacks.user_data); + s_err_callbacks.err(loc, s_err_callbacks.user_data); +} + +template<class ...Args> +void warn_fmt(locref loc, size_t fmt_size, const char *fmt, Args const& C4_RESTRICT ...args) +{ + s_err_callbacks.msg_begin(loc, s_err_callbacks.user_data); + s_err_callbacks.msg("WARNING: "); + _err_fmt(fmt_size, fmt, args...); + s_err_callbacks.msg_end(s_err_callbacks.user_data); + s_err_callbacks.warn(loc, s_err_callbacks.user_data); +} + +template<size_t N, class ...Args> +void err_fmt(locref loc, const char (&fmt)[N], Args const& C4_RESTRICT ...args) +{ + err_fmt(loc, N-1, fmt, args...); +} + +template<size_t N, class ...Args> +void warn_fmt(locref loc, const char (&fmt)[N], Args const& C4_RESTRICT ...args) +{ + warn_fmt(loc, N-1, fmt, args...); +} + +#define C4_ERROR_FMT_NEW(fmt, ...) c4::err_fmt(C4_SRCLOC(), fmt, __VA_ARGS__) +#define C4_WARNING_FMT_NEW(msg, ...) c4::warn_fmt(C4_SRCLOC(), fmt, __VA_ARGS__) + +#define C4_ERROR_FMT_NEW_SZ(fmt, fmtlen, ...) c4::err_fmt(C4_SRCLOC(), fmtlen, fmt, __VA_ARGS__) +#define C4_WARNING_FMT_NEW_SZ(fmt, fmtlen, ...) c4::warn_fmt(C4_SRCLOC(), fmtlen, fmt, __VA_ARGS__) + +} // namespace c4 + +template<size_t N, size_t M, class... Args> +void test_error_fmt_exception(const char (&expected)[M], const char (&fmt)[N], Args const& ...args) +{ + INFO(expected); + { + auto tmp1 = C4_TMP_ERR_BHV(ErrorBehaviorAbort); + + { + auto tmp2 = C4_TMP_ERR_BHV(ErrorBehaviorRuntimeError); + + bool got_exc = false; + try { + C4_ERROR_FMT_NEW(fmt, args...); + } + catch(std::exception const& e) { + // check that the error terminates with the given message + auto what = c4::to_csubstr(e.what()).last(M-1); + CHECK_EQ(what, expected); + got_exc = (what == expected); + } + CHECK(got_exc); + + got_exc = false; + try { + C4_ERROR_FMT_NEW_SZ(fmt, N-1, args...); + } + catch(std::exception const& e) { + // check that the error terminates with the given message + auto what = c4::to_csubstr(e.what()).last(M-1); + CHECK_EQ(what, expected); + got_exc = (what == expected); + } + CHECK(got_exc); + } + } +} + +template<size_t N, size_t M, class... Args> +void test_warning_fmt_exception(const char (&expected)[M], const char (&fmt)[N], Args const& ...args) +{ + INFO(expected); + + auto tmp = C4_TMP_ERR_BHV(ErrorBehaviorRuntimeError); + auto const& wmsg = tmp.m_tmp.exc_msg; + C4_WARNING_FMT_NEW(fmt, args...); + REQUIRE_FALSE(wmsg.empty()); + REQUIRE_GT(wmsg.size(), M); + auto what = c4::to_csubstr(wmsg.c_str()).last(M-1); + CHECK_EQ(what, expected); + + C4_WARNING_FMT_NEW_SZ(fmt, N-1, args...); + REQUIRE_FALSE(wmsg.empty()); + REQUIRE_GT(wmsg.size(), M); + what = c4::to_csubstr(wmsg.c_str()).last(M-1); + CHECK_EQ(what, expected); +} + + +TEST_CASE("error.fmt") +{ + test_error_fmt_exception("aaa is 2 is it not?", + "{} is {} is it not?", "aaa", 2); + test_error_fmt_exception("aaa is bbb is it not?", + "{} is {} is it not?", "aaa", "bbb"); + test_error_fmt_exception("aaa is {} is it not?", + "{} is {} is it not?", "aaa"); + test_error_fmt_exception("aaa is {} is it not?", + "{} is {} is it not?", "aaa"); +} + +TEST_CASE("warning.fmt") +{ + test_warning_fmt_exception("aaa is 2 is it not?", + "{} is {} is it not?", "aaa", 2); + test_warning_fmt_exception("aaa is bbb is it not?", + "{} is {} is it not?", "aaa", "bbb"); + test_warning_fmt_exception("aaa is {} is it not?", + "{} is {} is it not?", "aaa"); + test_warning_fmt_exception("aaa is {} is it not?", + "{} is {} is it not?", "aaa"); +} + + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_error_exception.cpp b/thirdparty/ryml/ext/c4core/test/test_error_exception.cpp new file mode 100644 index 000000000..fae0020b8 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_error_exception.cpp @@ -0,0 +1,108 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/error.hpp" +#endif + +#include "c4/test.hpp" +#include <string> +#include <stdexcept> + + +C4_BEGIN_HIDDEN_NAMESPACE +bool got_an_error = false; +bool got_an_exception = false; +C4_END_HIDDEN_NAMESPACE + +void error_callback_throwing_exception(const char *msg_, size_t msg_sz) +{ + got_an_error = true; + c4::csubstr s(msg_, msg_sz); + if (s == "err1") throw 1; + else if(s == "err2") throw 2; + else if(s == "err3") throw 3; + else if(s == "err4") throw 4; + else throw std::runtime_error({msg_, msg_+msg_sz}); +} + +inline c4::ScopedErrorSettings tmp_err() +{ + got_an_error = false; + return c4::ScopedErrorSettings(c4::ON_ERROR_CALLBACK, error_callback_throwing_exception); +} + + +void test_exception(int which) +{ + if(which == 0) return; + CHECK_FALSE(got_an_exception); + CHECK_EQ(c4::get_error_callback() == error_callback_throwing_exception, false); + { + auto tmp = tmp_err(); + CHECK_EQ(got_an_error, false); + CHECK_EQ(c4::get_error_callback() == error_callback_throwing_exception, true); + try + { + if (which == 1) { C4_ERROR("err1"); } + else if(which == 2) { C4_ERROR("err2"); } + else if(which == 3) { C4_ERROR("err3"); } + else if(which == 4) { C4_ERROR("err4"); } + else { C4_ERROR("unknown error"); } + } + catch(int i) + { + got_an_exception = true; + CHECK_EQ(got_an_error, true); + CHECK_EQ(i, which); + throw; + } + catch(std::runtime_error const& e) + { + got_an_exception = true; + CHECK_EQ(got_an_error, true); + CHECK_STREQ(e.what(), "unknown error"); + throw; + } + // if we get here it means no exception was thrown + // so the test failed + FAIL("an exception was thrown"); + } + CHECK_EQ(c4::get_error_callback() == error_callback_throwing_exception, false); +} + + +// Although c4core does not use exceptions by default (*), you can have your +// error callback throw an exception which you can then catch on your code. +// This test covers that possibility. +// +// (*) Note that you can also configure c4core to throw an exception on error. + +TEST_CASE("error.exception_from_callback") +{ + // works! + got_an_exception = false; + CHECK_THROWS_AS(test_exception(-1), std::runtime_error); + CHECK(got_an_exception); + + got_an_exception = false; + CHECK_NOTHROW(test_exception(0)); + CHECK_FALSE(got_an_exception); + + got_an_exception = false; + CHECK_THROWS_AS(test_exception(1), int); + CHECK(got_an_exception); + + got_an_exception = false; + CHECK_THROWS_AS(test_exception(2), int); + CHECK(got_an_exception); + + got_an_exception = false; + CHECK_THROWS_AS(test_exception(3), int); + CHECK(got_an_exception); + + got_an_exception = false; + CHECK_THROWS_AS(test_exception(4), int); + CHECK(got_an_exception); + + got_an_exception = false; + CHECK_THROWS_AS(test_exception(6), std::runtime_error); + CHECK(got_an_exception); +} diff --git a/thirdparty/ryml/ext/c4core/test/test_format.cpp b/thirdparty/ryml/ext/c4core/test/test_format.cpp new file mode 100644 index 000000000..42a50dc75 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_format.cpp @@ -0,0 +1,1054 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/substr.hpp" +#include "c4/std/std.hpp" +#include "c4/format.hpp" +#endif + +#include <c4/test.hpp> +#include "c4/libtest/supprwarn_push.hpp" + +#ifdef __clang__ +# pragma clang diagnostic push +#elif defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wuseless-cast" +#endif + +namespace c4 { + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + + +TEST_CASE_TEMPLATE("to_chars.fmt.bin", T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t) +{ + char bufc[128]; + substr buf(bufc); + + CHECK_EQ(to_chars_sub(buf, fmt::integral(T(21), T(2))), "0b10101"); + CHECK_EQ(to_chars_sub(buf, fmt::integral((T*)21, T(2))), "0b10101"); + CHECK_EQ(to_chars_sub(buf, fmt::integral((T const*)21, T(2))), "0b10101"); + CHECK_EQ(to_chars_sub(buf, fmt::integral(nullptr, T(2))), "0b0"); + CHECK_EQ(to_chars_sub(buf, fmt::bin(T(21))), "0b10101"); + CHECK_EQ(to_chars_sub(buf, fmt::bin((T*)21)), "0b10101"); + CHECK_EQ(to_chars_sub(buf, fmt::bin((T const*)21)), "0b10101"); + CHECK_EQ(to_chars_sub(buf, fmt::bin(nullptr)), "0b0"); +} + +TEST_CASE_TEMPLATE("to_chars.fmt.zpad.bin", T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t) +{ + char bufc[128]; + substr buf(bufc); + using namespace fmt; + CHECK_EQ(to_chars_sub(buf, zpad(integral(T(21), T(2)), 8u)), "0b00010101"); + CHECK_EQ(to_chars_sub(buf, zpad(integral((T*)21, T(2)), 8u)), "0b00010101"); + CHECK_EQ(to_chars_sub(buf, zpad(integral((T const*)21, T(2)), 8u)), "0b00010101"); + CHECK_EQ(to_chars_sub(buf, zpad(bin(T(21)), 8u)), "0b00010101"); + CHECK_EQ(to_chars_sub(buf, zpad(bin((T*)21), 8u)), "0b00010101"); + CHECK_EQ(to_chars_sub(buf, zpad(bin((T const*)21), 8u)), "0b00010101"); +} + +TEST_CASE_TEMPLATE("to_chars.fmt.oct", T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t) +{ + char bufc[128]; + substr buf(bufc); + + CHECK_EQ(to_chars_sub(buf, fmt::integral(T(65), T(8))), "0o101"); + CHECK_EQ(to_chars_sub(buf, fmt::integral((T*)65, T(8))), "0o101"); + CHECK_EQ(to_chars_sub(buf, fmt::integral((T const*)65, T(8))), "0o101"); + CHECK_EQ(to_chars_sub(buf, fmt::integral(nullptr, T(8))), "0o0"); + CHECK_EQ(to_chars_sub(buf, fmt::oct(T(65))), "0o101"); + CHECK_EQ(to_chars_sub(buf, fmt::oct((T*)65)), "0o101"); + CHECK_EQ(to_chars_sub(buf, fmt::oct((T const*)65)), "0o101"); + CHECK_EQ(to_chars_sub(buf, fmt::oct(nullptr)), "0o0"); +} + +TEST_CASE_TEMPLATE("to_chars.fmt.zpad.oct", T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t) +{ + char bufc[128]; + substr buf(bufc); + using namespace fmt; + CHECK_EQ(to_chars_sub(buf, zpad(integral(T(65), T(8)), 5u)), "0o00101"); + CHECK_EQ(to_chars_sub(buf, zpad(integral((T*)65, T(8)), 5u)), "0o00101"); + CHECK_EQ(to_chars_sub(buf, zpad(integral((T const*)65, T(8)), 5u)), "0o00101"); + CHECK_EQ(to_chars_sub(buf, zpad(oct(T(65)), 5u)), "0o00101"); + CHECK_EQ(to_chars_sub(buf, zpad(oct((T*)65), 5u)), "0o00101"); + CHECK_EQ(to_chars_sub(buf, zpad(oct((T const*)65), 5u)), "0o00101"); +} + +TEST_CASE_TEMPLATE("to_chars.fmt.hex", T, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t) +{ + char bufc[128]; + substr buf(bufc); + CHECK_EQ(to_chars_sub(buf, fmt::integral(T(0x7f), T(16))), "0x7f"); + CHECK_EQ(to_chars_sub(buf, fmt::integral((T*)0x7f, T(16))), "0x7f"); + CHECK_EQ(to_chars_sub(buf, fmt::integral((T const*)0x7f, T(16))), "0x7f"); + CHECK_EQ(to_chars_sub(buf, fmt::integral(nullptr, T(16))), "0x0"); + CHECK_EQ(to_chars_sub(buf, fmt::hex(T(0x7f))), "0x7f"); + CHECK_EQ(to_chars_sub(buf, fmt::hex((T*)0x7f)), "0x7f"); + CHECK_EQ(to_chars_sub(buf, fmt::hex((T const*)0x7f)), "0x7f"); + CHECK_EQ(to_chars_sub(buf, fmt::hex(nullptr)), "0x0"); +} + +TEST_CASE_TEMPLATE("to_chars.fmt.zpad.hex", T, uint8_t, int8_t) +{ + char bufc[128]; + substr buf(bufc); + using namespace fmt; + buf.fill('?'); + CHECK_EQ(to_chars_sub(buf, zpad(integral(T(0x7f), T(16)), 5u)), "0x0007f"); + CHECK_EQ(to_chars_sub(buf, zpad(integral((T*)0x7f, T(16)), 5u)), "0x0007f"); + CHECK_EQ(to_chars_sub(buf, zpad(integral((T const*)0x7f, T(16)), 5u)), "0x0007f"); + CHECK_EQ(to_chars_sub(buf, zpad(hex(T(0x7f)), 5u)), "0x0007f"); + CHECK_EQ(to_chars_sub(buf, zpad(hex((T*)0x7f), 5u)), "0x0007f"); + CHECK_EQ(to_chars_sub(buf, zpad(hex((T const*)0x7f), 5u)), "0x0007f"); +} + + +TEST_CASE_TEMPLATE("to_chars.fmt.zpad", T, uint8_t, int8_t) +{ + char bufc[128]; + substr buf(bufc); + using namespace fmt; + CHECK_EQ(to_chars_sub(buf, zpad(T(10), 0)), "10"); + CHECK_EQ(to_chars_sub(buf, zpad(T(10), 1)), "10"); + CHECK_EQ(to_chars_sub(buf, zpad(T(10), 2)), "10"); + CHECK_EQ(to_chars_sub(buf, zpad(T(10), 3)), "010"); + CHECK_EQ(to_chars_sub(buf, zpad(T(10), 4)), "0010"); + CHECK_EQ(to_chars_sub(buf, zpad((T const*)17, 0)), "0x11"); + CHECK_EQ(to_chars_sub(buf, zpad((T const*)17, 1)), "0x11"); + CHECK_EQ(to_chars_sub(buf, zpad((T const*)17, 2)), "0x11"); + CHECK_EQ(to_chars_sub(buf, zpad((T const*)17, 3)), "0x011"); + CHECK_EQ(to_chars_sub(buf, zpad((T const*)17, 4)), "0x0011"); + CHECK_EQ(to_chars_sub(buf, zpad((T *)17, 0)), "0x11"); + CHECK_EQ(to_chars_sub(buf, zpad((T *)17, 1)), "0x11"); + CHECK_EQ(to_chars_sub(buf, zpad((T *)17, 2)), "0x11"); + CHECK_EQ(to_chars_sub(buf, zpad((T *)17, 3)), "0x011"); + CHECK_EQ(to_chars_sub(buf, zpad((T *)17, 4)), "0x0011"); + CHECK_EQ(to_chars_sub(buf, zpad(nullptr, 0)), "0x0"); + CHECK_EQ(to_chars_sub(buf, zpad(nullptr, 1)), "0x0"); + CHECK_EQ(to_chars_sub(buf, zpad(nullptr, 2)), "0x00"); + CHECK_EQ(to_chars_sub(buf, zpad(nullptr, 3)), "0x000"); + CHECK_EQ(to_chars_sub(buf, zpad(nullptr, 4)), "0x0000"); + CHECK_EQ(to_chars_sub(buf, zpad(integral(nullptr, T(10)), 0u)), "0"); + CHECK_EQ(to_chars_sub(buf, zpad(integral(nullptr, T(16)), 0u)), "0x0"); + CHECK_EQ(to_chars_sub(buf, zpad(integral(nullptr, T(2)), 0u)), "0b0"); + CHECK_EQ(to_chars_sub(buf, zpad(integral(nullptr, T(8)), 0u)), "0o0"); + CHECK_EQ(to_chars_sub(buf, zpad(hex(nullptr), 0u)), "0x0"); + CHECK_EQ(to_chars_sub(buf, zpad(bin(nullptr), 0u)), "0b0"); + CHECK_EQ(to_chars_sub(buf, zpad(oct(nullptr), 0u)), "0o0"); + CHECK_EQ(to_chars_sub(buf, zpad(integral(nullptr, T(10)), 5u)), "00000"); + CHECK_EQ(to_chars_sub(buf, zpad(integral(nullptr, T(16)), 5u)), "0x00000"); + CHECK_EQ(to_chars_sub(buf, zpad(integral(nullptr, T(2)), 5u)), "0b00000"); + CHECK_EQ(to_chars_sub(buf, zpad(integral(nullptr, T(8)), 5u)), "0o00000"); + CHECK_EQ(to_chars_sub(buf, zpad(hex(nullptr), 5u)), "0x00000"); + CHECK_EQ(to_chars_sub(buf, zpad(bin(nullptr), 5u)), "0b00000"); + CHECK_EQ(to_chars_sub(buf, zpad(oct(nullptr), 5u)), "0o00000"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +template<class T> +void test_to_chars_real(T f, int precision, const char* flt, T fltv, const char *scient, T scientv) +{ + char bufc[64]; + substr buf(bufc); + substr r; + T copy; + + INFO("num=" << f); + + r = to_chars_sub(buf, fmt::real(f, precision)); + CHECK_EQ(r, to_csubstr(flt)); + from_chars(r, ©); + if(sizeof(T) == sizeof(float)) + { + CHECK_FLOAT_EQ((float)fltv, (float)copy); + } + else + { + CHECK_FLOAT_EQ(fltv, copy); + } + + r = to_chars_sub(buf, fmt::real(f, precision, FTOA_SCIENT)); + CHECK_EQ(r, to_csubstr(scient)); + from_chars(r, ©); + if(sizeof(T) == sizeof(float)) + { + CHECK_FLOAT_EQ((float)scientv, (float)copy); + } + else + { + CHECK_FLOAT_EQ(scientv, copy); + } +} + +TEST_CASE_TEMPLATE("to_chars.fmt.real", T, float, double) +{ + char bufc[128]; + substr buf(bufc); + + T f = static_cast<T>(256.064); + test_to_chars_real<T>(f, 0, "256", T(256.), "3e+02", T(300.)); + test_to_chars_real<T>(f, 1, "256.1", T(256.1), "2.6e+02", T(260.)); + test_to_chars_real<T>(f, 2, "256.06", T(256.06), "2.56e+02", T(256.)); + test_to_chars_real<T>(f, 3, "256.064", T(256.064), "2.561e+02", T(256.1)); + test_to_chars_real<T>(f, 4, "256.0640", T(256.0640), "2.5606e+02", T(256.06)); + test_to_chars_real<T>(f, 5, "256.06400", T(256.06400), "2.56064e+02", T(256.064)); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TEST_CASE("to_chars.fmt.boolalpha") +{ + char bufc[128]; + substr buf(bufc); + + CHECK_EQ(to_chars_sub(buf, true), "1"); + CHECK_EQ(to_chars_sub(buf, false), "0"); + CHECK_EQ(to_chars_sub(buf, fmt::boolalpha(true)), "true"); + CHECK_EQ(to_chars_sub(buf, 1), "1"); + CHECK_EQ(to_chars_sub(buf, fmt::boolalpha(1)), "true"); + CHECK_EQ(to_chars_sub(buf, fmt::boolalpha(10)), "true"); + CHECK_EQ(to_chars_sub(buf, fmt::boolalpha(false)), "false"); + CHECK_EQ(to_chars_sub(buf, fmt::boolalpha(0)), "false"); + CHECK_EQ(to_chars_sub(buf, fmt::boolalpha(0u)), "false"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TEST_CASE("align.left.overflow") +{ + CHECK_EQ(to_chars(substr(), fmt::left(' ', 91u)), 91u); + CHECK_EQ(to_chars(substr(), fmt::left("0123456789.123456789.123456789.123456789", 91u)), 91u); + CHECK_EQ(to_chars(substr(), fmt::left("0123456789.123456789.123456789.123456789", 30u)), 40u); +} + +TEST_CASE("align.right.overflow") +{ + CHECK_EQ(to_chars(substr(), fmt::right(' ', 91u)), 91u); + CHECK_EQ(to_chars(substr(), fmt::right("0123456789.123456789.123456789.123456789", 91u)), 91u); + CHECK_EQ(to_chars(substr(), fmt::right("0123456789.123456789.123456789.123456789", 30u)), 40u); +} + +TEST_CASE("align.left") +{ + char buf[128] = {}; + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 1)), "1"); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 2)), "1 "); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 3)), "1 "); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 4)), "1 "); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 5)), "1 "); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 6)), "1 "); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 7)), "1 "); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 8)), "1 "); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 9)), "1 "); + + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 1, '+')), "1"); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 2, '+')), "1+"); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 3, '+')), "1++"); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 4, '+')), "1+++"); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 5, '+')), "1++++"); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 6, '+')), "1+++++"); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 7, '+')), "1++++++"); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 8, '+')), "1+++++++"); + CHECK_EQ(to_chars_sub(buf, fmt::left("1", 9, '+')), "1++++++++"); + + CHECK_EQ(to_chars_sub(buf, fmt::left("01234", 0)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::left("01234", 1)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::left("01234", 2)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::left("01234", 3)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::left("01234", 4)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::left("01234", 5)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::left("01234", 6)), "01234 "); + CHECK_EQ(to_chars_sub(buf, fmt::left("01234", 7)), "01234 "); + CHECK_EQ(to_chars_sub(buf, fmt::left("01234", 8)), "01234 "); + CHECK_EQ(to_chars_sub(buf, fmt::left("01234", 9)), "01234 "); + + CHECK_EQ(to_chars_sub(buf, fmt::left(1234, 0)), "1234"); + CHECK_EQ(to_chars_sub(buf, fmt::left(1234, 1)), "1234"); + CHECK_EQ(to_chars_sub(buf, fmt::left(1234, 2)), "1234"); + CHECK_EQ(to_chars_sub(buf, fmt::left(1234, 3)), "1234"); + CHECK_EQ(to_chars_sub(buf, fmt::left(1234, 4)), "1234"); + CHECK_EQ(to_chars_sub(buf, fmt::left(1234, 5)), "1234 "); + CHECK_EQ(to_chars_sub(buf, fmt::left(1234, 6)), "1234 "); + CHECK_EQ(to_chars_sub(buf, fmt::left(1234, 7)), "1234 "); + CHECK_EQ(to_chars_sub(buf, fmt::left(1234, 8)), "1234 "); + CHECK_EQ(to_chars_sub(buf, fmt::left(1234, 9)), "1234 "); +} + + +TEST_CASE("align.right") +{ + char buf[128] = {}; + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 1)), "1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 2)), " 1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 3)), " 1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 4)), " 1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 5)), " 1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 6)), " 1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 7)), " 1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 8)), " 1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 9)), " 1"); + + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 1, '+')), "1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 2, '+')), "+1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 3, '+')), "++1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 4, '+')), "+++1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 5, '+')), "++++1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 6, '+')), "+++++1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 7, '+')), "++++++1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 8, '+')), "+++++++1"); + CHECK_EQ(to_chars_sub(buf, fmt::right("1", 9, '+')), "++++++++1"); + + CHECK_EQ(to_chars_sub(buf, fmt::right("01234", 0)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::right("01234", 1)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::right("01234", 2)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::right("01234", 3)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::right("01234", 4)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::right("01234", 5)), "01234"); + CHECK_EQ(to_chars_sub(buf, fmt::right("01234", 6)), " 01234"); + CHECK_EQ(to_chars_sub(buf, fmt::right("01234", 7)), " 01234"); + CHECK_EQ(to_chars_sub(buf, fmt::right("01234", 8)), " 01234"); + CHECK_EQ(to_chars_sub(buf, fmt::right("01234", 9)), " 01234"); + + CHECK_EQ(to_chars_sub(buf, fmt::right(1234, 0)), "1234"); + CHECK_EQ(to_chars_sub(buf, fmt::right(1234, 1)), "1234"); + CHECK_EQ(to_chars_sub(buf, fmt::right(1234, 2)), "1234"); + CHECK_EQ(to_chars_sub(buf, fmt::right(1234, 3)), "1234"); + CHECK_EQ(to_chars_sub(buf, fmt::right(1234, 4)), "1234"); + CHECK_EQ(to_chars_sub(buf, fmt::right(1234, 5)), " 1234"); + CHECK_EQ(to_chars_sub(buf, fmt::right(1234, 6)), " 1234"); + CHECK_EQ(to_chars_sub(buf, fmt::right(1234, 7)), " 1234"); + CHECK_EQ(to_chars_sub(buf, fmt::right(1234, 8)), " 1234"); + CHECK_EQ(to_chars_sub(buf, fmt::right(1234, 9)), " 1234"); + + CHECK_EQ(to_chars_sub(buf, fmt::real(0.124, 1)), "0.1"); // we assume this in what follows + CHECK_EQ(to_chars_sub(buf, fmt::real(0.124, 2)), "0.12"); + CHECK_EQ(to_chars_sub(buf, fmt::real(0.124, 3)), "0.124"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 1), 0)), "0.1"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 1), 1)), "0.1"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 1), 2)), "0.1"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 1), 3)), "0.1"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 1), 4)), " 0.1"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 1), 5)), " 0.1"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 1), 6)), " 0.1"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 1), 7)), " 0.1"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 2), 0)), "0.12"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 2), 1)), "0.12"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 2), 2)), "0.12"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 2), 3)), "0.12"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 2), 4)), "0.12"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 2), 5)), " 0.12"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 2), 6)), " 0.12"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 2), 7)), " 0.12"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 3), 0)), "0.124"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 3), 1)), "0.124"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 3), 2)), "0.124"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 3), 3)), "0.124"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 3), 4)), "0.124"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 3), 5)), "0.124"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 3), 6)), " 0.124"); + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(0.124, 3), 7)), " 0.124"); + + CHECK_EQ(to_chars_sub(buf, fmt::right(fmt::real(1234.5222, 1), 7)), " 1234.5"); + auto r = [](double val, size_t width) { return fmt::right(fmt::real(val, 1), width); }; + CHECK_EQ(to_chars_sub(buf, r(1234.5, 7)), " 1234.5"); + c4::format(buf, "freq={}Hz\0", r(1234.5, 7)); + CHECK_EQ(to_csubstr(buf).len, to_csubstr("freq= 1234.5Hz").len); + CHECK_EQ(to_csubstr(buf), "freq= 1234.5Hz"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TEST_CASE("cat.vars") +{ + char buf[256]; + substr sp(buf); + csubstr result; + size_t sz; + + sz = cat(buf, 1, ' ', 2, ' ', 3, ' ', 4); + result = sp.left_of(sz); + CHECK_EQ(result, "1 2 3 4"); +} + +#ifdef C4_TUPLE_TO_STR +TEST_CASE("cat.tuple") +{ + char buf[256]; + substr sp(buf); + csubstr result; + size_t sz; + + sz = cat(buf, std::forward_as_tuple(1, ' ', 2, ' ', 3, ' ', 4)); + result = sp.left_of(sz); + CHECK_EQ(result, "1 2 3 4"); +} +#endif // C4_TUPLE_TO_STR + +TEST_CASE("uncat.vars") +{ + size_t sz; + size_t npos = csubstr::npos; + int v1 = 0, v2 = 0, v3 = 0, v4 = 0; + + sz = uncat("1 2 3 4", v1, v2, v3, v4); + CHECK_NE(sz, npos); + CHECK_EQ(sz, 7); + CHECK_EQ(v1, 1); + CHECK_EQ(v2, 2); + CHECK_EQ(v3, 3); + CHECK_EQ(v4, 4); +} + +#ifdef C4_TUPLE_TO_STR +TEST_CASE("uncat.tuple") +{ + size_t sz; + int v1 = 0, v2 = 0, v3 = 0, v4 = 0; + + auto tp = std::forward_as_tuple(v1, v2, v3, v4); + sz = uncat("1 2 3 4", tp); + CHECK_NE(sz, csubstr::npos); + CHECK_EQ(sz, 7); + CHECK_EQ(v1, 1); + CHECK_EQ(v2, 2); + CHECK_EQ(v3, 3); + CHECK_EQ(v4, 4); +} +#endif // C4_TUPLE_TO_STR + + +TEST_CASE("catsep.vars") +{ + char buf[256]; + substr sp(buf); + csubstr result; + size_t sz; + + sz = catsep(buf, ' ', 1, 2); + CHECK_EQ(sz, 3); + result = sp.left_of(sz); + CHECK_EQ(result, "1 2"); + + sz = catsep(buf, '/', 1, 2); + CHECK_EQ(sz, 3); + result = sp.left_of(sz); + CHECK_EQ(result, "1/2"); + + sz = catsep(buf, ' ', 1, 2, 3, 4); + CHECK_EQ(sz, 7); + result = sp.left_of(sz); + CHECK_EQ(result, "1 2 3 4"); + + sz = catsep(buf, '/', 1, 2, 3, 4); + CHECK_EQ(sz, 7); + result = sp.left_of(sz); + CHECK_EQ(result, "1/2/3/4"); +} + +#ifdef C4_TUPLE_TO_STR +TEST_CASE("catsep.tuple") +{ + char buf[256]; + substr sp(buf); + csubstr result; + size_t sz; + + sz = catsep(buf, ' ', std::forward_as_tuple(1, 2)); + CHECK_EQ(sz, 3); + result = sp.left_of(sz); + CHECK_EQ(result, "1 2"); + + sz = catsep(buf, '/', std::forward_as_tuple(1, 2)); + CHECK_EQ(sz, 3); + result = sp.left_of(sz); + CHECK_EQ(result, "1/2"); + + sz = catsep(buf, ' ', std::forward_as_tuple(1, 2, 3, 4)); + CHECK_EQ(sz, 7); + result = sp.left_of(sz); + CHECK_EQ(result, "1 2 3 4"); + + sz = catsep(buf, '/', std::forward_as_tuple(1, 2, 3, 4)); + CHECK_EQ(sz, 7); + result = sp.left_of(sz); + CHECK_EQ(result, "1/2/3/4"); +} +#endif // C4_TUPLE_TO_STR + +TEST_CASE("uncatsep.vars") +{ + size_t sz; + int v1 = 0, v2 = 0, v3 = 0, v4 = 0; + char sep; + + sz = uncatsep("1 2 3 4", sep, v1, v2, v3, v4); + CHECK_EQ(sz, 7); + CHECK_EQ(v1, 1); + CHECK_EQ(v2, 2); + CHECK_EQ(v3, 3); + CHECK_EQ(v4, 4); +} + +#ifdef C4_TUPLE_TO_STR +TEST_CASE("uncatsep.tuple") +{ + size_t sz; + int v1 = 0, v2 = 0, v3 = 0, v4 = 0; + char sep; + + auto tp = std::forward_as_tuple(v1, v2, v3, v4); + sz = uncatsep("1 2 3 4", sep, tp); + CHECK_EQ(sz, 7); + CHECK_EQ(v1, 1); + CHECK_EQ(v2, 2); + CHECK_EQ(v3, 3); + CHECK_EQ(v4, 4); +} +#endif // C4_TUPLE_TO_STR + +TEST_CASE("format.vars") +{ + char buf[256]; + substr sp(buf); + csubstr result; + size_t sz; + + sz = format(buf, "{} and {} and {} and {}", 1, 2, 3, 4); + CHECK_EQ(sz, strlen("1 and 2 and 3 and 4")); + result = sp.left_of(sz); + CHECK_EQ(result, "1 and 2 and 3 and 4"); + + sz = format(buf, "{} and {} and {} and {}", 1, 2, 3, 4, 5, 6, 7); + CHECK_EQ(sz, 19); + result = sp.left_of(sz); + CHECK_EQ(result, "1 and 2 and 3 and 4"); + + sz = format(buf, "{} and {} and {} and {}", 1, 2, 3); + CHECK_EQ(sz, 20); + result = sp.left_of(sz); + CHECK_EQ(result, "1 and 2 and 3 and {}"); + + sz = format(buf, "{} and {} and {} and {}", 1, 2); + CHECK_EQ(sz, 21); + result = sp.left_of(sz); + CHECK_EQ(result, "1 and 2 and {} and {}"); + + sz = format(buf, "{} and {} and {} and {}", 1); + CHECK_EQ(sz, 22); + result = sp.left_of(sz); + CHECK_EQ(result, "1 and {} and {} and {}"); + + sz = format(buf, "{} and {} and {} and {}"); + CHECK_EQ(sz, 23); + result = sp.left_of(sz); + CHECK_EQ(result, "{} and {} and {} and {}"); + + sz = format(buf, "{} args only at the begin", 1); + CHECK_EQ(sz, csubstr("1 args only at the begin").len); + result = sp.left_of(sz); + CHECK_EQ(result, csubstr("1 args only at the begin")); +} + +TEST_CASE("format.empty_buffer") +{ + size_t sz = format({}, "{} and {} and {} and {}", 1, 2, 3, 4); + CHECK_EQ(sz, strlen("1 and 2 and 3 and 4")); + char buf_[128]; + substr buf = buf_; + sz = format(buf, "{} and {} and {} and {}", 1, 2, 3, 4); + CHECK_EQ(sz, strlen("1 and 2 and 3 and 4")); + CHECK_EQ(format(buf, "{} and {} and {} and {}", 1, 2, 3, 4), + format({} , "{} and {} and {} and {}", 1, 2, 3, 4)); + CHECK_EQ(to_chars({}, 101), to_chars(buf, 101)); // eq for all integers + CHECK_GE(to_chars({}, 0.1f), to_chars(buf, 0.1f)); // ge for all floats, due to a sprintf quirk + CHECK_EQ(format(buf, "a={} foo {} {} bar {}", 101, 10, 11, 12), + format({} , "a={} foo {} {} bar {}", 101, 10, 11, 12)); +} + +#ifdef C4_TUPLE_TO_STR +TEST_CASE("format.tuple") +{ + char buf[256]; + substr sp(buf); + csubstr result; + size_t sz; + + sz = format(buf, "{} and {} and {} and {}", std::forward_as_tuple(1, 2, 3, 4)); + CHECK_EQ(sz, 19); + result = sp.left_of(sz); + CHECK_EQ(result, "1 and 2 and 3 and 4"); + + sz = format(buf, "{} and {} and {} and {}", std::forward_as_tuple(1, 2, 3, 4, 5, 6, 7)); + CHECK_EQ(sz, 19); + result = sp.left_of(sz); + CHECK_EQ(result, "1 and 2 and 3 and 4"); + + sz = format(buf, "{} and {} and {} and {}", std::forward_as_tuple(1, 2, 3)); + CHECK_EQ(sz, 20); + result = sp.left_of(sz); + CHECK_EQ(result, "1 and 2 and 3 and {}"); + + sz = format(buf, "{} and {} and {} and {}", std::forward_as_tuple(1, 2)); + CHECK_EQ(sz, 21); + result = sp.left_of(sz); + CHECK_EQ(result, "1 and 2 and {} and {}"); + + sz = format(buf, "{} and {} and {} and {}", std::forward_as_tuple(1)); + CHECK_EQ(sz, 22); + result = sp.left_of(sz); + CHECK_EQ(result, "1 and {} and {} and {}"); + + sz = format(buf, "{} and {} and {} and {}"); + CHECK_EQ(sz, 23); + result = sp.left_of(sz); + CHECK_EQ(result, "{} and {} and {} and {}"); +} +#endif // C4_TUPLE_TO_STR + +TEST_CASE("unformat.vars") +{ + size_t sz; + int v1 = 0, v2 = 0, v3 = 0, v4 = 0; + + sz = unformat("1 and 2 and 3 and 4", "{} and {} and {} and {}", v1, v2, v3, v4); + CHECK_EQ(sz, 19); + CHECK_EQ(v1, 1); + CHECK_EQ(v2, 2); + CHECK_EQ(v3, 3); + CHECK_EQ(v4, 4); + + v1 = 0; + sz = unformat("1 and 2 and 3 and 4" , "3", v1); + CHECK_EQ(sz, 1); + CHECK_EQ(v1, 0); + + v1 = 0; + sz = unformat("1,2,3,,,", "{},{},{}", v1, v2, v3); + CHECK_EQ(sz, 5); + CHECK_EQ(v1, 1); + CHECK_EQ(v2, 2); + CHECK_EQ(v3, 3); + + v1 = v2 = v3 = 0; + sz = unformat("1,2,3,,,", "{},{},{},,,", v1, v2, v3); + CHECK_EQ(sz, 8); // make sure we count the trailing characters in the format + CHECK_EQ(v1, 1); + CHECK_EQ(v2, 2); + CHECK_EQ(v3, 3); +} + +#ifdef C4_TUPLE_TO_STR +TEST_CASE("unformat.tuple") +{ + size_t sz; + int v1 = 0, v2 = 0, v3 = 0, v4 = 0; + + auto tp = std::forward_as_tuple(v1, v2, v3, v4); + sz = unformat("1 and 2 and 3 and 4", "{} and {} and {} and {}", tp); + CHECK_EQ(sz, 19); + CHECK_EQ(v1, 1); + CHECK_EQ(v2, 2); + CHECK_EQ(v3, 3); + CHECK_EQ(v4, 4); +} +#endif // C4_TUPLE_TO_STR + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +TEST_CASE("catrs.basic") +{ + std::vector<char> buf; + + catrs(&buf); + CHECK_EQ(to_csubstr(buf), ""); + + catrs(&buf, 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1234"); + catrs(&buf, 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "5678"); +} + +TEST_CASE("catrs.basic_return") +{ + auto bufv = catrs<std::vector<char>>(9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + CHECK_EQ(to_csubstr(bufv), "9876543210"); + bufv = catrs<std::vector<char>>(); + CHECK_EQ(to_csubstr(bufv), ""); + CHECK(bufv.empty()); + + auto bufs = catrs<std::string>(9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + CHECK_EQ(to_csubstr(bufs), "9876543210"); +} + +TEST_CASE("catrs.basic_append") +{ + std::vector<char> buf; + + catrs(append, &buf); + CHECK_EQ(to_csubstr(buf), ""); + + catrs(append, &buf, 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1234"); + catrs(append, &buf, 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "12345678"); + catrs(append, &buf, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "123456789012345678"); +} + +template<class... Args> +void catrs_perfect_fwd(Args && ...args) +{ + catrs(std::forward<Args>(args)...); +} + +TEST_CASE("catrs.perfect_fwd") +{ + std::vector<char> buf; + catrs_perfect_fwd(&buf, 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1234"); + catrs_perfect_fwd(&buf, 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "5678"); +} + +template<class... Args> +void catrs_const_fwd(Args const& ...args) +{ + catrs(args...); +} + +TEST_CASE("catrs.const_fwd") +{ + std::vector<char> buf; + catrs_const_fwd(&buf, 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1234"); + catrs_const_fwd(&buf, 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "5678"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TEST_CASE("catseprs.basic") +{ + std::vector<char> buf; + + catseprs(&buf, ' '); + CHECK_EQ(to_csubstr(buf), ""); + + catseprs(&buf, ' ', 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1 2 3 4"); + catseprs(&buf, ' ', 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "5 6 7 8"); + + catseprs(&buf, ',', 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1,2,3,4"); + catseprs(&buf, ',', 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "5,6,7,8"); + + catseprs(&buf, '/', 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1/2/3/4"); + catseprs(&buf, '/', 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "5/6/7/8"); + + catseprs(&buf, "///", 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1///2///3///4"); + catseprs(&buf, "///", 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "5///6///7///8"); + + catseprs(&buf, 5678, 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1567825678356784"); + catseprs(&buf, 1234, 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "5123461234712348"); +} + +TEST_CASE("catseprs.basic_return") +{ + auto bufv = catseprs<std::vector<char>>('a', 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + CHECK_EQ(to_csubstr(bufv), "9a8a7a6a5a4a3a2a1a0"); + + auto bufs = catseprs<std::string >('a', 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + CHECK_EQ(to_csubstr(bufs), "9a8a7a6a5a4a3a2a1a0"); +} + +TEST_CASE("catseprs.basic_append") +{ + std::vector<char> buf; + + auto ret = catseprs(append, &buf, ' '); + CHECK_EQ(to_csubstr(buf), ""); + CHECK_EQ(ret, ""); + + ret = catseprs(append, &buf, ' ', 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1 2 3 4"); + CHECK_EQ(ret, "1 2 3 4"); + ret = catseprs(append, &buf, ' ', 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "1 2 3 45 6 7 8"); + CHECK_EQ(ret, "5 6 7 8"); + ret = catseprs(append, &buf, ' ', 9, 0, 1, 2, 3, 4, 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "1 2 3 45 6 7 89 0 1 2 3 4 5 6 7 8"); + CHECK_EQ(ret, "9 0 1 2 3 4 5 6 7 8"); + + ret = catseprs(append, &buf, ' '); + CHECK_EQ(to_csubstr(buf), "1 2 3 45 6 7 89 0 1 2 3 4 5 6 7 8"); + CHECK_EQ(ret, ""); +} + +template<class... Args> +void catseprs_perfect_fwd(Args && ...args) +{ + catseprs(std::forward<Args>(args)...); +} + +template<class... Args> +void catseprs_const_fwd(Args const& ...args) +{ + catseprs(args...); +} + +TEST_CASE("catseprs.perfect_fwd") +{ + std::vector<char> buf; + catseprs_perfect_fwd(&buf, '.', 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1.2.3.4"); + catseprs_perfect_fwd(&buf, 0, 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "5060708"); +} + +TEST_CASE("catseprs.const_fwd") +{ + std::vector<char> buf; + catseprs_const_fwd(&buf, '.', 1, 2, 3, 4); + CHECK_EQ(to_csubstr(buf), "1.2.3.4"); + catseprs_const_fwd(&buf, 0, 5, 6, 7, 8); + CHECK_EQ(to_csubstr(buf), "5060708"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TEST_CASE("formatrs.basic") +{ + std::vector<char> buf; + + formatrs(&buf, ""); + CHECK(buf.empty()); + + formatrs(&buf, "{} goes with food, {} goes with heat, {} anytime", "wine", "beer", "coffee"); + CHECK_EQ(to_csubstr(buf), "wine goes with food, beer goes with heat, coffee anytime"); + + formatrs(&buf, ""); + CHECK(buf.empty()); +} + +TEST_CASE("formatrs.basic_return") +{ + auto bufv = formatrs<std::vector<char>>("{} goes with food, {} goes with heat, {} anytime", "wine", "beer", "coffee"); + CHECK_EQ(to_csubstr(bufv), "wine goes with food, beer goes with heat, coffee anytime"); + + auto bufs = formatrs<std::string>("{} goes with food, {} goes with heat, {} anytime", "wine", "beer", "coffee"); + CHECK_EQ(to_csubstr(bufs), "wine goes with food, beer goes with heat, coffee anytime"); +} + +TEST_CASE("formatrs.basic_append") +{ + std::vector<char> buf; + + formatrs(append, &buf, "{} goes with food", "wine"); + CHECK_EQ(to_csubstr(buf), "wine goes with food"); + formatrs(append, &buf, ", {} goes with heat", "beer"); + CHECK_EQ(to_csubstr(buf), "wine goes with food, beer goes with heat"); + formatrs(append, &buf, ", {} anytime", "coffee"); + CHECK_EQ(to_csubstr(buf), "wine goes with food, beer goes with heat, coffee anytime"); + + formatrs(append, &buf, ". And water. {} glass of {}cl in the morning clears you up for the day", 1, 40); + CHECK_EQ(to_csubstr(buf), "wine goes with food, beer goes with heat, coffee anytime. And water. 1 glass of 40cl in the morning clears you up for the day"); +} + +template<class... Args> +void formatrs_perfect_fwd(Args && ...args) +{ + formatrs(std::forward<Args>(args)...); +} + +template<class... Args> +void formatrs_const_fwd(Args const& ...args) +{ + formatrs(args...); +} + +TEST_CASE("formatrs.perfect_fwd") +{ + std::vector<char> buf; + formatrs_perfect_fwd(&buf, "Too much of anything is bad, but too much {} is {}.", "Champagne", "just right"); + CHECK_EQ(to_csubstr(buf), "Too much of anything is bad, but too much Champagne is just right."); + formatrs_perfect_fwd(&buf, "{}, I am tasting the {}", "Come quickly", "stars!"); + CHECK_EQ(to_csubstr(buf), "Come quickly, I am tasting the stars!"); + formatrs_perfect_fwd(&buf, "{} the only wine that leaves a {} {} after {}.", "Champagne is", "woman", "beautiful", "drinking it"); + CHECK_EQ(to_csubstr(buf), "Champagne is the only wine that leaves a woman beautiful after drinking it."); + formatrs_perfect_fwd(&buf, "Remember {}, it's not just {} we are fighting for, it's {}", "gentlemen", "France", "Champagne!"); + CHECK_EQ(to_csubstr(buf), "Remember gentlemen, it's not just France we are fighting for, it's Champagne!"); + // https://www.townandcountrymag.com/leisure/drinks/how-to/g828/the-10-best-quotes-about-champagne/ +} + +TEST_CASE("formatrs.const_fwd") +{ + std::vector<char> buf; + formatrs_const_fwd(&buf, "Too much of anything is bad, but too much {} is {}.", "Champagne", "just right"); + CHECK_EQ(to_csubstr(buf), "Too much of anything is bad, but too much Champagne is just right."); + formatrs_const_fwd(&buf, "{}, I am tasting the {}", "Come quickly", "stars!"); + CHECK_EQ(to_csubstr(buf), "Come quickly, I am tasting the stars!"); + formatrs_const_fwd(&buf, "{} the only wine that leaves a {} {} after {}.", "Champagne is", "woman", "beautiful", "drinking it"); + CHECK_EQ(to_csubstr(buf), "Champagne is the only wine that leaves a woman beautiful after drinking it."); + formatrs_const_fwd(&buf, "Remember {}, it's not just {} we are fighting for, it's {}", "gentlemen", "France", "Champagne!"); + CHECK_EQ(to_csubstr(buf), "Remember gentlemen, it's not just France we are fighting for, it's Champagne!"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +template<class T> +void test_hex(T in, csubstr expected) +{ + INFO("expected=" << expected); + SUBCASE("charbuf") + { + char buf_[128] = {}; + substr buf = buf_; + buf.fill('?'); // this will be executed before each case + SUBCASE("sz=0") + { + CHECK_EQ(cat(buf.first(0), fmt::hex(in)), expected.len); + CHECK_EQ(buf[0], '?'); + CHECK_EQ(buf.trimr('?'), ""); + } + SUBCASE("sz=1") + { + CHECK_EQ(cat(buf.first(1), fmt::hex(in)), expected.len); + CHECK_EQ(buf[0], '?'); + CHECK_EQ(buf.trimr('?'), ""); + } + SUBCASE("sz=2") + { + CHECK_EQ(cat(buf.first(2), fmt::hex(in)), expected.len); + CHECK_EQ(buf[0], '?'); + CHECK_EQ(buf.trimr('?'), ""); + } + SUBCASE("full") + { + REQUIRE_EQ(cat(buf, fmt::hex(in)), expected.len); + CHECK_EQ(buf.first(expected.len), expected); + CHECK_EQ(buf.trimr('?'), expected); + } + } + SUBCASE("vector") + { + std::vector<char> buf; + catrs(&buf, fmt::hex(in)); + CHECK_EQ(buf.size(), expected.len); + CHECK_EQ(to_csubstr(buf), expected); + } +} + +TEST_CASE("fmt.hex") +{ + test_hex(0, "0x0"); + test_hex(nullptr, "0x0"); + test_hex(254, "0xfe"); + test_hex(255, "0xff"); + test_hex(256, "0x100"); +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +template<class T> void test_raw_roundtrip(const char *valstr, T const& orig) +{ + INFO("valstr=" << valstr); + alignas(alignof(T)) char buf_[2 * (sizeof(T) + alignof(T))] = {}; + substr buf = buf_; + + fmt::const_raw_wrapper rawwrap = fmt::raw(orig); + REQUIRE_EQ((void*)rawwrap.buf, (void*)&orig); + REQUIRE_EQ(rawwrap.len, sizeof(orig)); + + for(size_t i = 0; i < alignof(T); ++i) + { + INFO(" i=" << i); + // make sure to cover unaligned buffers + substr sbuf = buf.sub(i); + size_t szwrite = c4::to_chars(sbuf, fmt::raw(orig)); + REQUIRE_LE(szwrite, sbuf.len); + if(i == 0) + { + REQUIRE_EQ(szwrite, sizeof(T)); + } + else + { + REQUIRE_GT(szwrite, sizeof(T)); + } + T copy = {}; + REQUIRE_NE(copy, orig); + bool ok = c4::from_chars_first(sbuf, fmt::raw(copy)); + REQUIRE_EQ(ok, true); + CHECK_EQ(copy, orig); + + // cover also insufficient buffers + sbuf = sbuf.first(sizeof(T)-1); + memset(buf.str, 0, buf.len); + szwrite = c4::to_chars(sbuf, fmt::raw(orig)); + REQUIRE_GT(szwrite, sbuf.len); + for(char c : buf) + { + CHECK_EQ(c, 0); + } + } +} + +TEST_CASE("fmt.raw_int") +{ + #define _(v) test_raw_roundtrip(#v, v) + + _(int(1)); + _(int(2)); + _(int(-1)); + _(int(-2)); + + #undef _ +} + +} // namespace c4 + +#ifdef __clang__ +# pragma clang diagnostic pop +#elif defined(__GNUC__) +# pragma GCC diagnostic pop +#endif + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_log.cpp b/thirdparty/ryml/ext/c4core/test/test_log.cpp new file mode 100644 index 000000000..2f5b56734 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_log.cpp @@ -0,0 +1,70 @@ +#include "c4/log.hpp" + +#include "c4/libtest/supprwarn_push.hpp" +#include "c4/test.hpp" + +namespace c4 { + +TEST(LogBuffer, basic) +{ +#define _CHECK(s, str) \ + EXPECT_EQ(strncmp(s.rd(), str, s.pos), 0) << " string was '" << s.rd() << "'"; \ + s.clear(); \ + EXPECT_EQ(s.pos, 0);\ + EXPECT_EQ(s.buf[0], '\0') + + LogBuffer b; + const char *foo = "Foo"; + const char *bars_str = "123"; + int bars = 123; + + // raw writing + b.write("hello world I am "); + b.write(foo); + b.write(" and I frobnicate "); + b.write(bars_str); // only accepts const char* + b.write(" Bars"); + _CHECK(b, "hello world I am Foo and I frobnicate 123 Bars"); + + // chevron-style AKA iostream-style + b << "hello world I am " << foo << " and I frobnicate " << bars << " Bars"; + _CHECK(b, "hello world I am Foo and I frobnicate 123 Bars"); + + // c-style, not type safe + b.printf("hello world I am %s and I frobnicate %d Bars", foo, bars); + _CHECK(b, "hello world I am Foo and I frobnicate 123 Bars"); + + // python-style, type safe + b.print("hello world I am {} and I frobnicate {} Bars", foo, bars); + _CHECK(b, "hello world I am Foo and I frobnicate 123 Bars"); + + // r-style, type safe + b.cat("hello world I am ", foo, " and I frobnicate ", bars, " Bars"); + _CHECK(b, "hello world I am Foo and I frobnicate 123 Bars"); + + // using separators: this is unpractical... + const char *s[] = {"now", "we", "have", "11", "strings", "to", "cat", "one", "after", "the", "other"}; + b.cat(s[0], ' ', s[1], ' ', s[2], ' ', s[3], ' ', s[4], ' ', + s[5], ' ', s[6], ' ', s[7], ' ', s[8], ' ', s[9], ' ', s[10]); + _CHECK(b, "now we have 11 strings to cat one after the other"); + + // ... and this resolves it + b.catsep(' ', s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10]); + _CHECK(b, "now we have 11 strings to cat one after the other"); + + b.catsep('_', s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10]); + _CHECK(b, "now_we_have_11_strings_to_cat_one_after_the_other"); + + // can be a full string + b.catsep("____", s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10]); + _CHECK(b, "now____we____have____11____strings____to____cat____one____after____the____other"); + + // or just a general object + b.catsep(22, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10]); + _CHECK(b, "now22we22have221122strings22to22cat22one22after22the22other"); + +} + +} // namespace c4 + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_memory_resource.cpp b/thirdparty/ryml/ext/c4core/test/test_memory_resource.cpp new file mode 100644 index 000000000..7ae7a71ac --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_memory_resource.cpp @@ -0,0 +1,255 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/memory_resource.hpp" +#endif + +#include "c4/libtest/supprwarn_push.hpp" + +#include <limits> + +#include "c4/test.hpp" + +namespace c4 { + +TEST_CASE("set_aalloc.basic") +{ + auto a = get_aalloc(); + set_aalloc(nullptr); + CHECK_EQ(get_aalloc(), nullptr); + set_aalloc(a); + CHECK_EQ(get_aalloc(), a); +} + +TEST_CASE("set_afree.basic") +{ + auto a = get_afree(); + set_afree(nullptr); + CHECK_EQ(get_afree(), nullptr); + set_afree(a); + CHECK_EQ(get_afree(), a); +} + +TEST_CASE("set_arealloc.basic") +{ + auto a = get_arealloc(); + set_arealloc(nullptr); + CHECK_EQ(get_arealloc(), nullptr); + set_arealloc(a); + CHECK_EQ(get_arealloc(), a); +} + +//----------------------------------------------------------------------------- +namespace detail { +void* aalloc_impl(size_t size, size_t alignment=alignof(max_align_t)); +void* arealloc_impl(void *ptr, size_t oldsz, size_t newsz, size_t alignment=alignof(max_align_t)); +void afree_impl(void *ptr); +} // namespace detail + +TEST_CASE("aalloc_impl.error_bad_align") +{ +#if defined(C4_POSIX) + C4_EXPECT_ERROR_OCCURS(1); + auto *mem = detail::aalloc_impl(64, 9); // allocating with a non-power of two value is invalid + CHECK_EQ(mem, nullptr); +#endif +} + +TEST_CASE("aalloc_impl.error_out_of_mem") +{ +#if defined(C4_POSIX) + if(sizeof(size_t) != 8) return; // valgrind complains that size is -1 + C4_EXPECT_ERROR_OCCURS(1); + size_t sz = std::numeric_limits<size_t>::max(); + sz /= 2; + auto *mem = detail::aalloc_impl(sz); + CHECK_EQ(mem, nullptr); +#endif +} + +//----------------------------------------------------------------------------- + +void do_test_realloc(arealloc_pfn fn) +{ +#define _set(dim) for(uint8_t i = 0; i < dim; ++i) { mem[i] = static_cast<char>(i); } +#define _check(dim) for(uint8_t i = 0; i < dim; ++i) { CHECK_EQ(mem[i], i); } + + char *mem = (char*) aalloc(16, alignof(max_align_t)); + _set(16u); + _check(16u); + mem = (char*) fn(mem, 16, 20, alignof(max_align_t)); + _check(16u); + mem = (char*) fn(mem, 8, 20, alignof(max_align_t)); + _check(8u); + afree(mem); + +#undef _set +#undef _check +} + +TEST_CASE("realloc_impl.basic") +{ + do_test_realloc(&detail::arealloc_impl); +} + +TEST_CASE("realloc.basic") +{ + do_test_realloc(&arealloc); +} + + +//----------------------------------------------------------------------------- + +void do_memreslinear_realloc_test(MemoryResourceLinear &mr) +{ + C4_ASSERT(mr.capacity() >= 128); // this is needed for the tests below + + char * mem = (char*) mr.allocate(32); + CHECK_EQ(mem-(char*)mr.mem(), 0); + CHECK_EQ(mr.size(), 32); + CHECK_EQ(mr.slack(), mr.capacity() - 32); + + mem = (char*) mr.reallocate(mem, 32, 16); + CHECK_EQ(mem-(char*)mr.mem(), 0); + CHECK_EQ(mr.size(), 16); + CHECK_EQ(mr.slack(), mr.capacity() - 16); + + mem = (char*) mr.reallocate(mem, 16, 64); + CHECK_EQ(mem-(char*)mr.mem(), 0); + CHECK_EQ(mr.size(), 64); + CHECK_EQ(mr.slack(), mr.capacity() - 64); + + mem = (char*) mr.reallocate(mem, 64, 32); + CHECK_EQ(mem-(char*)mr.mem(), 0); + CHECK_EQ(mr.size(), 32); + CHECK_EQ(mr.slack(), mr.capacity() - 32); + + + char *mem2 = (char*) mr.allocate(32); + CHECK_EQ(mem-(char*)mr.mem(), 0); + CHECK_EQ(mem2-(char*)mr.mem(), 32); + CHECK_EQ(mr.size(), 64); + CHECK_EQ(mr.slack(), mr.capacity() - 64); + + mem = (char*) mr.reallocate(mem, 32, 16); + CHECK_EQ(mem-(char*)mr.mem(), 0); + CHECK_EQ(mr.size(), 64); + CHECK_EQ(mr.slack(), mr.capacity() - 64); +} + +TEST_CASE("MemoryResourceLinear.reallocate") +{ + MemoryResourceLinear mr(128); + do_memreslinear_realloc_test(mr); +} + +TEST_CASE("MemoryResourceLinearArr.reallocate") +{ + MemoryResourceLinearArr<128> mr; + do_memreslinear_realloc_test(mr); +} + + +//----------------------------------------------------------------------------- + +TEST_CASE("MemoryResourceLinear.error_out_of_mem") +{ + { + C4_EXPECT_ERROR_OCCURS(0); + MemoryResourceLinear mr(8); + mr.allocate(2); + } + + { + C4_EXPECT_ERROR_OCCURS(2); + MemoryResourceLinear mr(8); + mr.allocate(9); + } +} + +TEST_CASE("MemoryResourceLinearArr.error_out_of_mem") +{ + { + C4_EXPECT_ERROR_OCCURS(0); + MemoryResourceLinearArr<8> mr; + mr.allocate(2); + } + + { + C4_EXPECT_ERROR_OCCURS(2); + MemoryResourceLinearArr<8> mr; + mr.allocate(9); + } +} + + +//----------------------------------------------------------------------------- + +TEST_CASE("ScopedMemoryResource.basic") +{ + auto *before = get_memory_resource(); + { + MemoryResourceCounts mrc; + ScopedMemoryResource smr(&mrc); + CHECK_EQ(get_memory_resource(), &mrc); + } + CHECK_EQ(get_memory_resource(), before); +} + +TEST_CASE("ScopedMemoryResourceCounts.basic") +{ + auto *before = get_memory_resource(); + { + auto sac = ScopedMemoryResourceCounts{}; + CHECK_EQ(get_memory_resource(), &sac.mr); + } + CHECK_EQ(get_memory_resource(), before); +} + +TEST_CASE("ScopedMemoryResourceCounts.counts") +{ + auto *before = get_memory_resource(); + C4_UNUSED(before); + + { + auto checker = AllocationCountsChecker(); + auto *mr = &checker.mr; + + for(size_t sz : {16u, 32u, 64u, 128u}) + { + void *mem = mr->allocate(sz); + checker.check_all_delta(1, static_cast<ssize_t>(sz), static_cast<ssize_t>(sz)); + mr->deallocate(mem, sz); + checker.reset(); + } + checker.check_curr(0, 0); + checker.check_total(4, 240); + checker.check_max(1, 128); + } + + { + auto checker = AllocationCountsChecker(); + auto *mr = &checker.mr; + + std::pair<void *, size_t> mem[4] = {{0,16}, {0,32}, {0,64}, {0,128}}; + for(auto& m : mem) + { + m.first = mr->allocate(m.second); + checker.check_curr_delta(1, static_cast<ssize_t>(m.second)); + checker.reset(); + } + checker.check_curr(4, 240); + checker.check_total(4, 240); + checker.check_max(4, 240); + for(auto& m : mem) + { + mr->deallocate(m.first, m.second); + } + checker.check_curr(0, 0); + checker.check_total(4, 240); + checker.check_max(4, 240); + } + +} + +} // namespace c4 + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_memory_util.cpp b/thirdparty/ryml/ext/c4core/test/test_memory_util.cpp new file mode 100644 index 000000000..36509070c --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_memory_util.cpp @@ -0,0 +1,415 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/memory_util.hpp" +#endif + +#include "c4/libtest/supprwarn_push.hpp" + +#include <c4/test.hpp> +#include <limits> + +namespace c4 { + +TEST_CASE("mem_overlaps") +{ + csubstr buf = "0123456789012345678901234567890123456789"; + CHECK_EQ(buf.len, 40); + auto overlaps = [](csubstr lhs, csubstr rhs){ + bool res = mem_overlaps(lhs.str, rhs.str, lhs.len, rhs.len); + CHECK(res == lhs.overlaps(rhs)); + return res; + }; + CHECK(!overlaps(buf.first(0), buf.last(0))); + CHECK(!overlaps(buf.first(5), buf.last(5))); + CHECK(!overlaps(buf.first(10), buf.last(10))); + CHECK(!overlaps(buf.first(20), buf.last(20))); + CHECK(overlaps(buf.first(21), buf.last(20))); + CHECK(overlaps(buf.first(20), buf.last(21))); + CHECK(!overlaps(buf.first(0), buf)); + CHECK(overlaps(buf.first(1), buf)); + CHECK(!overlaps(buf, buf.last(0))); + CHECK(overlaps(buf, buf.last(1))); + CHECK(!overlaps(buf.first(20), buf.last(20))); + CHECK(overlaps(buf.first(21), buf.last(20))); + CHECK(overlaps(buf.first(20), buf.first(21))); +} + +TEST_CASE("mem_repeatT.one_repetition") +{ + char buf[120] = {0}; + + mem_repeat(buf, "123", 2, 1); + CHECK_EQ(strcmp(buf, "12"), 0); + + mem_repeat(buf, "123", 3, 1); + CHECK_EQ(strcmp(buf, "123"), 0); +} + +TEST_CASE("mem_repeatT.basic") +{ + char buf[120] = {0}; + + mem_zero(buf); + + mem_repeat(buf, "123", 2, 2); + CHECK_EQ(strcmp(buf, "1212"), 0); + CHECK_EQ(buf[4], '\0'); + + mem_zero(buf); + + mem_repeat(buf, "123", 3, 2); + CHECK_EQ(strcmp(buf, "123123"), 0); + CHECK_EQ(buf[6], '\0'); + + mem_zero(buf); + + mem_repeat(buf, "123", 2, 3); + CHECK_EQ(strcmp(buf, "121212"), 0); + CHECK_EQ(buf[6], '\0'); + + mem_zero(buf, sizeof(buf)); + + mem_repeat(buf, "123", 3, 3); + CHECK_EQ(strcmp(buf, "123123123"), 0); + CHECK_EQ(buf[9], '\0'); + + mem_zero(buf, sizeof(buf)); + + mem_repeat(buf, "123", 2, 4); + CHECK_EQ(strcmp(buf, "12121212"), 0); + CHECK_EQ(buf[8], '\0'); + + mem_zero(buf, sizeof(buf)); + + mem_repeat(buf, "123", 3, 4); + CHECK_EQ(strcmp(buf, "123123123123"), 0); + CHECK_EQ(buf[12], '\0'); + + mem_zero(buf, sizeof(buf)); + + mem_repeat(buf, "123", 2, 5); + CHECK_EQ(strcmp(buf, "1212121212"), 0); + CHECK_EQ(buf[10], '\0'); + + mem_zero(buf, sizeof(buf)); + + mem_repeat(buf, "123", 3, 5); + CHECK_EQ(strcmp(buf, "123123123123123"), 0); + CHECK_EQ(buf[15], '\0'); + + mem_zero(buf, sizeof(buf)); + + mem_repeat(buf, "123", 2, 6); + CHECK_EQ(strcmp(buf, "121212121212"), 0); + CHECK_EQ(buf[12], '\0'); + + mem_zero(buf, sizeof(buf)); + + mem_repeat(buf, "123", 3, 6); + CHECK_EQ(strcmp(buf, "123123123123123123"), 0); + CHECK_EQ(buf[18], '\0'); +} + + +//----------------------------------------------------------------------------- + +TEST_CASE("is_aligned.basic") +{ + CHECK(is_aligned<int>((int*)0x0)); + CHECK_FALSE(is_aligned<int>((int*)0x1)); + CHECK_FALSE(is_aligned<int>((int*)0x2)); + CHECK_FALSE(is_aligned<int>((int*)0x3)); + CHECK_FALSE(is_aligned<int>((int*)0x3)); + CHECK(is_aligned<int>((int*)0x4)); +} + + +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("lsb.basic", T, uint8_t, uint16_t, uint32_t, uint64_t) +{ + //CHECK_EQ(lsb<T>( 0), T(0)); + CHECK_EQ(lsb<T>( 1), T(0)); + CHECK_EQ(lsb<T>( 2), T(1)); + CHECK_EQ(lsb<T>( 3), T(0)); + CHECK_EQ(lsb<T>( 4), T(2)); + CHECK_EQ(lsb<T>( 5), T(0)); + CHECK_EQ(lsb<T>( 6), T(1)); + CHECK_EQ(lsb<T>( 7), T(0)); + CHECK_EQ(lsb<T>( 8), T(3)); + CHECK_EQ(lsb<T>( 9), T(0)); + CHECK_EQ(lsb<T>(10), T(1)); + CHECK_EQ(lsb<T>(11), T(0)); + CHECK_EQ(lsb<T>(12), T(2)); + CHECK_EQ(lsb<T>(13), T(0)); + CHECK_EQ(lsb<T>(14), T(1)); + CHECK_EQ(lsb<T>(15), T(0)); + CHECK_EQ(lsb<T>(16), T(4)); +} + +TEST_CASE_TEMPLATE("lsb11.basic", T, uint8_t, uint16_t, uint32_t, uint64_t) +{ + //CHECK_EQ((lsb11<T, 0>::value), T(0)); + CHECK_EQ((lsb11<T, 1>::value), T(0)); + CHECK_EQ((lsb11<T, 2>::value), T(1)); + CHECK_EQ((lsb11<T, 3>::value), T(0)); + CHECK_EQ((lsb11<T, 4>::value), T(2)); + CHECK_EQ((lsb11<T, 5>::value), T(0)); + CHECK_EQ((lsb11<T, 6>::value), T(1)); + CHECK_EQ((lsb11<T, 7>::value), T(0)); + CHECK_EQ((lsb11<T, 8>::value), T(3)); + CHECK_EQ((lsb11<T, 9>::value), T(0)); + CHECK_EQ((lsb11<T,10>::value), T(1)); + CHECK_EQ((lsb11<T,11>::value), T(0)); + CHECK_EQ((lsb11<T,12>::value), T(2)); + CHECK_EQ((lsb11<T,13>::value), T(0)); + CHECK_EQ((lsb11<T,14>::value), T(1)); + CHECK_EQ((lsb11<T,15>::value), T(0)); + CHECK_EQ((lsb11<T,16>::value), T(4)); +} + + +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("ipow.float", T, float, double) +{ + SUBCASE("base 1, signed exponent") + { + CHECK_FLOAT_EQ(ipow(T(1), int(0)), T(1)); + CHECK_FLOAT_EQ(ipow(T(1), int(1)), T(1)); + CHECK_FLOAT_EQ(ipow(T(1), int(2)), T(1)); + CHECK_FLOAT_EQ(ipow(T(1), -int(1)), T(1)); + CHECK_FLOAT_EQ(ipow(T(1), -int(2)), T(1)); + CHECK_FLOAT_EQ((ipow<T, int, 1>(int(0))), T(1)); + CHECK_FLOAT_EQ((ipow<T, int, 1>(int(1))), T(1)); + CHECK_FLOAT_EQ((ipow<T, int, 1>(int(2))), T(1)); + CHECK_FLOAT_EQ((ipow<T, int, 1>(-int(1))), T(1)); + CHECK_FLOAT_EQ((ipow<T, int, 1>(-int(2))), T(1)); + } + SUBCASE("base 1, unsigned exponent") + { + CHECK_FLOAT_EQ(ipow(T(1), unsigned(0)), T(1)); + CHECK_FLOAT_EQ(ipow(T(1), unsigned(1)), T(1)); + CHECK_FLOAT_EQ(ipow(T(1), unsigned(2)), T(1)); + CHECK_FLOAT_EQ((ipow<T, int, 1>(unsigned(0))), T(1)); + CHECK_FLOAT_EQ((ipow<T, int, 1>(unsigned(1))), T(1)); + CHECK_FLOAT_EQ((ipow<T, int, 1>(unsigned(2))), T(1)); + } + SUBCASE("base 2, signed exponent") + { + CHECK_FLOAT_EQ(ipow(T(2), int(0)), T(1)); + CHECK_FLOAT_EQ(ipow(T(2), int(1)), T(2)); + CHECK_FLOAT_EQ(ipow(T(2), int(2)), T(4)); + CHECK_FLOAT_EQ(ipow(T(2), int(7)), T(128)); + CHECK_FLOAT_EQ(ipow(T(2), -int(1)), T(0.5)); + CHECK_FLOAT_EQ(ipow(T(2), -int(2)), T(0.25)); + CHECK_FLOAT_EQ(ipow(T(2), -int(3)), T(0.125)); + CHECK_FLOAT_EQ(ipow(T(2), -int(4)), T(0.0625)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(int(0))), T(1)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(int(1))), T(2)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(int(2))), T(4)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(int(7))), T(128)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(-int(1))), T(0.5)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(-int(2))), T(0.25)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(-int(3))), T(0.125)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(-int(4))), T(0.0625)); + } + SUBCASE("base 2, unsigned exponent") + { + CHECK_FLOAT_EQ(ipow(T(2), unsigned(0)), T(1)); + CHECK_FLOAT_EQ(ipow(T(2), unsigned(1)), T(2)); + CHECK_FLOAT_EQ(ipow(T(2), unsigned(2)), T(4)); + CHECK_FLOAT_EQ(ipow(T(2), unsigned(6)), T(64)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(unsigned(0))), T(1)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(unsigned(1))), T(2)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(unsigned(2))), T(4)); + CHECK_FLOAT_EQ((ipow<T, int, 2>(unsigned(6))), T(64)); + } +} + +TEST_CASE_TEMPLATE("ipow", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + SUBCASE("base 1, signed exponent") + { + CHECK_EQ(ipow(T(1), int(0)), T(1)); + CHECK_EQ(ipow(T(1), int(1)), T(1)); + CHECK_EQ(ipow(T(1), int(2)), T(1)); + CHECK_EQ(ipow(T(1), -int(1)), T(1)); + CHECK_EQ(ipow(T(1), -int(2)), T(1)); + CHECK_EQ(ipow<T, T(1)>(int(0)), T(1)); + CHECK_EQ(ipow<T, T(1)>(int(1)), T(1)); + CHECK_EQ(ipow<T, T(1)>(int(2)), T(1)); + CHECK_EQ(ipow<T, T(1)>(-int(1)), T(1)); + CHECK_EQ(ipow<T, T(1)>(-int(2)), T(1)); + } + SUBCASE("base 1, unsigned exponent") + { + CHECK_EQ(ipow(T(1), unsigned(0)), T(1)); + CHECK_EQ(ipow(T(1), unsigned(1)), T(1)); + CHECK_EQ(ipow(T(1), unsigned(2)), T(1)); + CHECK_EQ(ipow<T, T(1)>(unsigned(0)), T(1)); + CHECK_EQ(ipow<T, T(1)>(unsigned(1)), T(1)); + CHECK_EQ(ipow<T, T(1)>(unsigned(2)), T(1)); + } + SUBCASE("base 2, signed exponent") + { + CHECK_EQ(ipow(T(2), int(0)), T(1)); + CHECK_EQ(ipow(T(2), int(1)), T(2)); + CHECK_EQ(ipow(T(2), int(2)), T(4)); + CHECK_EQ(ipow(T(2), int(6)), T(64)); + CHECK_EQ(ipow(T(2), -int(1)), T(0)); + CHECK_EQ(ipow(T(2), -int(2)), T(0)); + CHECK_EQ(ipow(T(2), -int(6)), T(0)); + CHECK_EQ(ipow<T, T(2)>(int(0)), T(1)); + CHECK_EQ(ipow<T, T(2)>(int(1)), T(2)); + CHECK_EQ(ipow<T, T(2)>(int(2)), T(4)); + CHECK_EQ(ipow<T, T(2)>(int(6)), T(64)); + CHECK_EQ(ipow<T, T(2)>(-int(1)), T(0)); + CHECK_EQ(ipow<T, T(2)>(-int(2)), T(0)); + CHECK_EQ(ipow<T, T(2)>(-int(7)), T(0)); + } + SUBCASE("base 2, unsigned exponent") + { + CHECK_EQ(ipow(T(2), unsigned(0)), T(1)); + CHECK_EQ(ipow(T(2), unsigned(1)), T(2)); + CHECK_EQ(ipow(T(2), unsigned(2)), T(4)); + CHECK_EQ(ipow(T(2), unsigned(6)), T(64)); + CHECK_EQ(ipow<T, T(2)>(unsigned(0)), T(1)); + CHECK_EQ(ipow<T, T(2)>(unsigned(1)), T(2)); + CHECK_EQ(ipow<T, T(2)>(unsigned(2)), T(4)); + CHECK_EQ(ipow<T, T(2)>(unsigned(6)), T(64)); + } +} + + +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("msb.basic", T, uint8_t, uint16_t, uint32_t, uint64_t) +{ + CHECK_EQ(msb(T( 1)), 0u); + CHECK_EQ(msb(T( 2)), 1u); + CHECK_EQ(msb(T( 3)), 1u); + CHECK_EQ(msb(T( 4)), 2u); + CHECK_EQ(msb(T( 5)), 2u); + CHECK_EQ(msb(T( 6)), 2u); + CHECK_EQ(msb(T( 7)), 2u); + CHECK_EQ(msb(T( 8)), 3u); + CHECK_EQ(msb(T( 9)), 3u); + CHECK_EQ(msb(T(10)), 3u); + CHECK_EQ(msb(T(11)), 3u); + CHECK_EQ(msb(T(12)), 3u); + CHECK_EQ(msb(T(13)), 3u); + CHECK_EQ(msb(T(14)), 3u); + CHECK_EQ(msb(T(15)), 3u); + CHECK_EQ(msb(T(16)), 4u); + CHECK_EQ(msb(std::numeric_limits<T>::max()), 8u * sizeof(T) - 1u); +} + +TEST_CASE_TEMPLATE("msb11.basic", T, uint8_t, uint16_t, uint32_t, uint64_t) +{ + CHECK_EQ((msb11<T,T( 1)>::value), T(0)); + CHECK_EQ((msb11<T,T( 2)>::value), T(1)); + CHECK_EQ((msb11<T,T( 3)>::value), T(1)); + CHECK_EQ((msb11<T,T( 4)>::value), T(2)); + CHECK_EQ((msb11<T,T( 5)>::value), T(2)); + CHECK_EQ((msb11<T,T( 6)>::value), T(2)); + CHECK_EQ((msb11<T,T( 7)>::value), T(2)); + CHECK_EQ((msb11<T,T( 8)>::value), T(3)); + CHECK_EQ((msb11<T,T( 9)>::value), T(3)); + CHECK_EQ((msb11<T,T(10)>::value), T(3)); + CHECK_EQ((msb11<T,T(11)>::value), T(3)); + CHECK_EQ((msb11<T,T(12)>::value), T(3)); + CHECK_EQ((msb11<T,T(13)>::value), T(3)); + CHECK_EQ((msb11<T,T(14)>::value), T(3)); + CHECK_EQ((msb11<T,T(15)>::value), T(3)); + CHECK_EQ((msb11<T,T(16)>::value), T(4)); + CHECK_EQ((msb11<T,std::numeric_limits<T>::max()>::value), 8u * sizeof(T) - 1u); +} + + +//----------------------------------------------------------------------------- +// contiguous mask + +template<class T> T _mask() { return T(0); } +template<class T, class... Bits> T _mask(int bit, Bits ...bits) { return (T)(T(1) << bit | _mask<T>(bits...)); } + +TEST_CASE_TEMPLATE("contiguous_mask.basic", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + CHECK_EQ(contiguous_mask(0, 0), _mask<T>()); + CHECK_EQ(contiguous_mask(0, 1), _mask<T>(0)); + CHECK_EQ(contiguous_mask(0, 2), _mask<T>(0, 1)); + CHECK_EQ(contiguous_mask(0, 3), _mask<T>(0, 1, 2)); + CHECK_EQ(contiguous_mask(0, 4), _mask<T>(0, 1, 2, 3)); + CHECK_EQ(contiguous_mask(1, 4), _mask<T>( 1, 2, 3)); + CHECK_EQ(contiguous_mask(2, 4), _mask<T>( 2, 3)); + CHECK_EQ(contiguous_mask(3, 4), _mask<T>( 3)); + CHECK_EQ(contiguous_mask(4, 4), _mask<T>()); +} + +TEST_CASE_TEMPLATE("contiguous_mask11.basic", T, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t) +{ + CHECK_EQ((contiguous_mask11<T, 0, 0>::value), _mask<T>()); + CHECK_EQ((contiguous_mask11<T, 0, 1>::value), _mask<T>(0)); + CHECK_EQ((contiguous_mask11<T, 0, 2>::value), _mask<T>(0, 1)); + CHECK_EQ((contiguous_mask11<T, 0, 3>::value), _mask<T>(0, 1, 2)); + CHECK_EQ((contiguous_mask11<T, 0, 4>::value), _mask<T>(0, 1, 2, 3)); + CHECK_EQ((contiguous_mask11<T, 1, 4>::value), _mask<T>( 1, 2, 3)); + CHECK_EQ((contiguous_mask11<T, 2, 4>::value), _mask<T>( 2, 3)); + CHECK_EQ((contiguous_mask11<T, 3, 4>::value), _mask<T>( 3)); + CHECK_EQ((contiguous_mask11<T, 4, 4>::value), _mask<T>()); +} + + +//----------------------------------------------------------------------------- + + +template<size_t N> struct sz { char buf[N]; }; +template< > struct sz<0> { }; +template<size_t F, size_t S> void check_tp() +{ + #if defined(__clang__) + # pragma clang diagnostic push + #elif defined(__GNUC__) + # pragma GCC diagnostic push + # if __GNUC__ >= 7 + # pragma GCC diagnostic ignored "-Wduplicated-branches" + # endif + #endif + size_t expected; + if(F != 0 && S != 0) expected = F+S; + else if(F == 0 && S != 0) expected = S; + else if(F != 0 && S == 0) expected = F; // -Wduplicated-branches: false positive here + else /* F == 0 && S == 0)*/expected = 1; + #if defined(__clang__) + # pragma clang diagnostic pop + #elif defined(__GNUC__) + # pragma GCC diagnostic pop + #endif + INFO("F=" << F << " S=" << S); + CHECK_EQ(sizeof(tight_pair<sz<F>, sz<S>>), expected); +} + + +TEST_CASE("tight_pair.basic") +{ + check_tp<0,0>(); + check_tp<0,1>(); + check_tp<0,2>(); + check_tp<0,3>(); + check_tp<0,4>(); + + check_tp<0,0>(); + check_tp<1,0>(); + check_tp<2,0>(); + check_tp<3,0>(); + check_tp<4,0>(); + + check_tp<0,0>(); + check_tp<1,1>(); + check_tp<2,2>(); + check_tp<3,3>(); + check_tp<4,4>(); +} + +} // namespace c4 + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_numbers.hpp b/thirdparty/ryml/ext/c4core/test/test_numbers.hpp new file mode 100644 index 000000000..d310b36ba --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_numbers.hpp @@ -0,0 +1,1863 @@ +#ifndef C4CORE_SINGLE_HEADER +#include <stdint.h> +#include <c4/substr.hpp> +#endif +#include <iostream> + +namespace c4 { + +template<class T> +struct overflow64case +{ + bool is_overflow; + T wrapped; + csubstr dec; + csubstr hex; + csubstr oct; + csubstr bin; +}; + +template<class T> +struct overflow64cases; + +#define oc(T, is_overflow, wrapped, dec, hex, oct, bin) \ + overflow64case<T>{is_overflow, wrapped, csubstr{dec}, csubstr{hex}, csubstr{oct}, csubstr{bin}} + +template<> +struct overflow64cases<int64_t> +{ + #define INT64_1(v) INT64_C(v) - INT64_C(1) // the min value is not representable! + static constexpr const overflow64case<int64_t> values[] = { + oc(int64_t, true , INT64_C( 9223372036854775803), "-9223372036854775813", "-0x8000000000000005", "-0o1000000000000000000005", "-0b1000000000000000000000000000000000000000000000000000000000000101"), + oc(int64_t, true , INT64_C( 9223372036854775804), "-9223372036854775812", "-0x8000000000000004", "-0o1000000000000000000004", "-0b1000000000000000000000000000000000000000000000000000000000000100"), + oc(int64_t, true , INT64_C( 9223372036854775805), "-9223372036854775811", "-0x8000000000000003", "-0o1000000000000000000003", "-0b1000000000000000000000000000000000000000000000000000000000000011"), + oc(int64_t, true , INT64_C( 9223372036854775806), "-9223372036854775810", "-0x8000000000000002", "-0o1000000000000000000002", "-0b1000000000000000000000000000000000000000000000000000000000000010"), + oc(int64_t, true , INT64_C( 9223372036854775807), "-9223372036854775809", "-0x8000000000000001", "-0o1000000000000000000001", "-0b1000000000000000000000000000000000000000000000000000000000000001"), + oc(int64_t, false, INT64_1(-9223372036854775807), "-9223372036854775808", "-0x8000000000000000", "-0o1000000000000000000000", "-0b1000000000000000000000000000000000000000000000000000000000000000"), + oc(int64_t, false, INT64_C(-9223372036854775807), "-9223372036854775807", "-0x7fffffffffffffff", "-0o777777777777777777777" , "-0b111111111111111111111111111111111111111111111111111111111111111"), + oc(int64_t, false, INT64_C(-9223372036854775806), "-9223372036854775806", "-0x7ffffffffffffffe", "-0o777777777777777777776" , "-0b111111111111111111111111111111111111111111111111111111111111110"), + oc(int64_t, false, INT64_C(-9223372036854775805), "-9223372036854775805", "-0x7ffffffffffffffd", "-0o777777777777777777775" , "-0b111111111111111111111111111111111111111111111111111111111111101"), + oc(int64_t, false, INT64_C( 9223372036854775804), "9223372036854775804", "0x7ffffffffffffffc", "0o777777777777777777774" , "0b111111111111111111111111111111111111111111111111111111111111100"), + oc(int64_t, false, INT64_C( 9223372036854775805), "9223372036854775805", "0x7ffffffffffffffd", "0o777777777777777777775" , "0b111111111111111111111111111111111111111111111111111111111111101"), + oc(int64_t, false, INT64_C( 9223372036854775806), "9223372036854775806", "0x7ffffffffffffffe", "0o777777777777777777776" , "0b111111111111111111111111111111111111111111111111111111111111110"), + oc(int64_t, false, INT64_C( 9223372036854775807), "9223372036854775807", "0x7fffffffffffffff", "0o777777777777777777777" , "0b111111111111111111111111111111111111111111111111111111111111111"), + oc(int64_t, true , INT64_1(-9223372036854775807), "9223372036854775808", "0x8000000000000000", "0o1000000000000000000000", "0b1000000000000000000000000000000000000000000000000000000000000000"), + oc(int64_t, true , INT64_C(-9223372036854775807), "9223372036854775809", "0x8000000000000001", "0o1000000000000000000001", "0b1000000000000000000000000000000000000000000000000000000000000001"), + oc(int64_t, true , INT64_C(-9223372036854775806), "9223372036854775810", "0x8000000000000002", "0o1000000000000000000002", "0b1000000000000000000000000000000000000000000000000000000000000010"), + oc(int64_t, true , INT64_C(-9223372036854775805), "9223372036854775811", "0x8000000000000003", "0o1000000000000000000003", "0b1000000000000000000000000000000000000000000000000000000000000011"), + oc(int64_t, true , INT64_C(-9223372036854775804), "9223372036854775812", "0x8000000000000004", "0o1000000000000000000004", "0b1000000000000000000000000000000000000000000000000000000000000100"), + }; +}; + +template<> +struct overflow64cases<uint64_t> +{ + static constexpr const overflow64case<uint64_t> values[] = { + oc(uint64_t, true , UINT64_C(18446744073709551611), "-5" , "-0x5" , "-0o5" , "-0b101"), + oc(uint64_t, true , UINT64_C(18446744073709551612), "-4" , "-0x4" , "-0o4" , "-0b100"), + oc(uint64_t, true , UINT64_C(18446744073709551613), "-3" , "-0x3" , "-0o3" , "-0b11"), + oc(uint64_t, true , UINT64_C(18446744073709551614), "-2" , "-0x2" , "-0o2" , "-0b10"), + oc(uint64_t, true , UINT64_C(18446744073709551615), "-1" , "-0x1" , "-0o1" , "-0b1"), + oc(uint64_t, false, UINT64_C( 0), "0" , "0x0" , "0o0" , "0b0"), + oc(uint64_t, false, UINT64_C( 1), "1" , "0x1" , "0o1" , "0b1"), + oc(uint64_t, false, UINT64_C( 2), "2" , "0x2" , "0o2" , "0b10"), + oc(uint64_t, false, UINT64_C( 3), "3" , "0x3" , "0o3" , "0b11"), + oc(uint64_t, false, UINT64_C(18446744073709551612), "18446744073709551612", "0xfffffffffffffffc" , "0o1777777777777777777774" , "0b1111111111111111111111111111111111111111111111111111111111111100"), + oc(uint64_t, false, UINT64_C(18446744073709551613), "18446744073709551613", "0xfffffffffffffffd" , "0o1777777777777777777775" , "0b1111111111111111111111111111111111111111111111111111111111111101"), + oc(uint64_t, false, UINT64_C(18446744073709551614), "18446744073709551614", "0xfffffffffffffffe" , "0o1777777777777777777776" , "0b1111111111111111111111111111111111111111111111111111111111111110"), + oc(uint64_t, false, UINT64_C(18446744073709551615), "18446744073709551615", "0xffffffffffffffff" , "0o1777777777777777777777" , "0b1111111111111111111111111111111111111111111111111111111111111111"), + oc(uint64_t, true , UINT64_C( 0), "18446744073709551616", "0x10000000000000000", "0o20000000000000000000000", "0b10000000000000000000000000000000000000000000000000000000000000000"), + oc(uint64_t, true , UINT64_C( 1), "18446744073709551617", "0x10000000000000001", "0o20000000000000000000001", "0b10000000000000000000000000000000000000000000000000000000000000001"), + oc(uint64_t, true , UINT64_C( 2), "18446744073709551618", "0x10000000000000002", "0o20000000000000000000002", "0b10000000000000000000000000000000000000000000000000000000000000010"), + oc(uint64_t, true , UINT64_C( 3), "18446744073709551619", "0x10000000000000003", "0o20000000000000000000003", "0b10000000000000000000000000000000000000000000000000000000000000011"), + oc(uint64_t, true , UINT64_C( 4), "18446744073709551620", "0x10000000000000004", "0o20000000000000000000004", "0b10000000000000000000000000000000000000000000000000000000000000100"), + oc(uint64_t, true , UINT64_C( 5), "18446744073709551621", "0x10000000000000005", "0o20000000000000000000005", "0b10000000000000000000000000000000000000000000000000000000000000101"), + }; +}; + +constexpr const overflow64case<int64_t> overflow64cases<int64_t>::values[]; +constexpr const overflow64case<uint64_t> overflow64cases<uint64_t>::values[]; + +#undef oc + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +struct invalid_case +{ + csubstr dec, hex, oct, bin; +}; + +C4_INLINE_CONSTEXPR const invalid_case invalid_cases[] = { +#define ic(dec, hex, oct, bin) \ + invalid_case{csubstr{dec}, csubstr{hex}, csubstr{oct}, csubstr{bin}} + ic("" , "" , "" , ""), + ic(" " , " " , " " , " "), + ic("." , "." , "." , "."), + ic("-" , "-" , "-" , "-"), + ic("\t" , "\t" , "\t" , "\t"), + ic("\n" , "\n" , "\n" , "\n"), + ic("...", "..." , "..." , "..."), + ic("===", "===" , "===" , "==="), + ic("=??", "???" , "???" , "???"), + ic("12a", "0x12g", "0o128", "0b102"), + ic("0.1", "0x1.2", "0o1.2", "0b1.1"), + ic("0,1", "0x1,2", "0o1,2", "0b1,1"), + ic("zz" , "0xzz" , "0ozz" , "0bzz"), + ic("" , "0x" , "0o" , "0b"), + ic("- " , "-0x" , "-0o" , "-0b"), + ic("2 0", "0x2 0", "0o2 0", "0b1 0"), + ic(" 2" , " 0x2" , " 0o2" , " 0b1"), + ic("\t2", "\t0x2", "\t0o2", "\t0b1"), + ic("\n2", "nt0x2", "\n0o2", "\n0b1"), + ic("2 " , "0x2 " , "0o2 " , "0b1 "), + ic("2\t", "0x2\t", "0o2\t", "0b1\t"), + ic("2\n", "0x2\n", "0o2\n", "0b1\n"), + ic("nan", "nan", "nan", "nan"), + ic("NaN", "NaN", "NaN", "NaN"), + ic("Inf", "Inf", "Inf", "Inf"), + ic("inf", "inf", "inf", "inf"), + ic("infinity", "infinity", "infinity", "infinity"), + ic("Infinity", "Infinity", "Infinity", "Infinity"), + ic("somevalue", "somevalue", "somevalue", "somevalue"), + ic("2345kjhiuy3245", "2345kjhiuy3245", "2345kjhiuy3245", "2345kjhiuy3245"), +#undef ic +}; + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +template<class T> +struct number_case +{ + T val; + csubstr dec; + csubstr hex; + csubstr oct; + csubstr bin; +}; + +template<class T> +std::ostream& operator<< (std::ostream& s, number_case<T> const& nc) +{ + using upcast_t = typename std::conditional<sizeof(T)!=1, T, + typename std::conditional<std::is_signed<T>::value, + int64_t, + uint64_t>::type>::type; + s << "val=" << (upcast_t)nc.val << " " + << "dec=" << nc.dec << " " + << "hex=" << nc.hex << " " + << "oct=" << nc.oct << " " + << "bin=" << nc.bin; + return s; +} + +template<class T> struct numbers; + +#define ITER_NUMBERS(ty, number_name) for(number_case<ty> const& C4_RESTRICT number_name : numbers<ty>::vals) + +C4_SUPPRESS_WARNING_MSVC_PUSH +C4_SUPPRESS_WARNING_MSVC(4146) +C4_SUPPRESS_WARNING_MSVC(4305) +C4_SUPPRESS_WARNING_MSVC(4310) + +// these numbers were generated with printintegers.py, in this dir. + +template<> +struct numbers<int8_t> +{ + using value_type = int8_t; + static C4_INLINE_CONSTEXPR const number_case<int8_t> vals[] = { +#define nc(val, dec, hex, bin, oct) \ + number_case<value_type>{(value_type)INT8_C(val), csubstr{dec}, csubstr{hex}, csubstr{bin}, csubstr{oct}} + nc(-128, "-128", "-0x80", "-0o200", "-0b10000000"), + nc(-127, "-127", "-0x7f", "-0o177", "-0b1111111"), + nc(-126, "-126", "-0x7e", "-0o176", "-0b1111110"), + nc(-125, "-125", "-0x7d", "-0o175", "-0b1111101"), + nc(-124, "-124", "-0x7c", "-0o174", "-0b1111100"), + nc(-123, "-123", "-0x7b", "-0o173", "-0b1111011"), + nc(-101, "-101", "-0x65", "-0o145", "-0b1100101"), + nc(-100, "-100", "-0x64", "-0o144", "-0b1100100"), + nc(-99, "-99", "-0x63", "-0o143", "-0b1100011"), + nc(-65, "-65", "-0x41", "-0o101", "-0b1000001"), + nc(-64, "-64", "-0x40", "-0o100", "-0b1000000"), + nc(-63, "-63", "-0x3f", "-0o77", "-0b111111"), + nc(-33, "-33", "-0x21", "-0o41", "-0b100001"), + nc(-32, "-32", "-0x20", "-0o40", "-0b100000"), + nc(-31, "-31", "-0x1f", "-0o37", "-0b11111"), + nc(-17, "-17", "-0x11", "-0o21", "-0b10001"), + nc(-16, "-16", "-0x10", "-0o20", "-0b10000"), + nc(-15, "-15", "-0xf", "-0o17", "-0b1111"), + nc(-12, "-12", "-0xc", "-0o14", "-0b1100"), + nc(-11, "-11", "-0xb", "-0o13", "-0b1011"), + nc(-10, "-10", "-0xa", "-0o12", "-0b1010"), + nc(-9, "-9", "-0x9", "-0o11", "-0b1001"), + nc(-8, "-8", "-0x8", "-0o10", "-0b1000"), + nc(-7, "-7", "-0x7", "-0o7", "-0b111"), + nc(-6, "-6", "-0x6", "-0o6", "-0b110"), + nc(-5, "-5", "-0x5", "-0o5", "-0b101"), + nc(-4, "-4", "-0x4", "-0o4", "-0b100"), + nc(-3, "-3", "-0x3", "-0o3", "-0b11"), + nc(-2, "-2", "-0x2", "-0o2", "-0b10"), + nc(-1, "-1", "-0x1", "-0o1", "-0b1"), + nc(0, "0", "0x0", "0o0", "0b0"), + nc(1, "1", "0x1", "0o1", "0b1"), + nc(2, "2", "0x2", "0o2", "0b10"), + nc(3, "3", "0x3", "0o3", "0b11"), + nc(4, "4", "0x4", "0o4", "0b100"), + nc(5, "5", "0x5", "0o5", "0b101"), + nc(6, "6", "0x6", "0o6", "0b110"), + nc(7, "7", "0x7", "0o7", "0b111"), + nc(8, "8", "0x8", "0o10", "0b1000"), + nc(9, "9", "0x9", "0o11", "0b1001"), + nc(10, "10", "0xa", "0o12", "0b1010"), + nc(11, "11", "0xb", "0o13", "0b1011"), + nc(12, "12", "0xc", "0o14", "0b1100"), + nc(13, "13", "0xd", "0o15", "0b1101"), + nc(15, "15", "0xf", "0o17", "0b1111"), + nc(16, "16", "0x10", "0o20", "0b10000"), + nc(17, "17", "0x11", "0o21", "0b10001"), + nc(31, "31", "0x1f", "0o37", "0b11111"), + nc(32, "32", "0x20", "0o40", "0b100000"), + nc(33, "33", "0x21", "0o41", "0b100001"), + nc(63, "63", "0x3f", "0o77", "0b111111"), + nc(64, "64", "0x40", "0o100", "0b1000000"), + nc(65, "65", "0x41", "0o101", "0b1000001"), + nc(99, "99", "0x63", "0o143", "0b1100011"), + nc(100, "100", "0x64", "0o144", "0b1100100"), + nc(101, "101", "0x65", "0o145", "0b1100101"), + nc(122, "122", "0x7a", "0o172", "0b1111010"), + nc(123, "123", "0x7b", "0o173", "0b1111011"), + nc(124, "124", "0x7c", "0o174", "0b1111100"), + nc(125, "125", "0x7d", "0o175", "0b1111101"), + nc(126, "126", "0x7e", "0o176", "0b1111110"), + nc(127, "127", "0x7f", "0o177", "0b1111111"), +#undef nc + }; +}; + + +template<> +struct numbers<uint8_t> +{ + using value_type = uint8_t; + static C4_INLINE_CONSTEXPR const number_case<uint8_t> vals[] = { +#define nc(val, dec, hex, bin, oct) \ + number_case<value_type>{(value_type)UINT8_C(val), csubstr{dec}, csubstr{hex}, csubstr{bin}, csubstr{oct}} + nc(0, "0", "0x0", "0o0", "0b0"), + nc(1, "1", "0x1", "0o1", "0b1"), + nc(2, "2", "0x2", "0o2", "0b10"), + nc(3, "3", "0x3", "0o3", "0b11"), + nc(4, "4", "0x4", "0o4", "0b100"), + nc(5, "5", "0x5", "0o5", "0b101"), + nc(6, "6", "0x6", "0o6", "0b110"), + nc(7, "7", "0x7", "0o7", "0b111"), + nc(8, "8", "0x8", "0o10", "0b1000"), + nc(9, "9", "0x9", "0o11", "0b1001"), + nc(10, "10", "0xa", "0o12", "0b1010"), + nc(11, "11", "0xb", "0o13", "0b1011"), + nc(15, "15", "0xf", "0o17", "0b1111"), + nc(16, "16", "0x10", "0o20", "0b10000"), + nc(17, "17", "0x11", "0o21", "0b10001"), + nc(24, "24", "0x18", "0o30", "0b11000"), + nc(25, "25", "0x19", "0o31", "0b11001"), + nc(26, "26", "0x1a", "0o32", "0b11010"), + nc(31, "31", "0x1f", "0o37", "0b11111"), + nc(32, "32", "0x20", "0o40", "0b100000"), + nc(33, "33", "0x21", "0o41", "0b100001"), + nc(63, "63", "0x3f", "0o77", "0b111111"), + nc(64, "64", "0x40", "0o100", "0b1000000"), + nc(65, "65", "0x41", "0o101", "0b1000001"), + nc(99, "99", "0x63", "0o143", "0b1100011"), + nc(100, "100", "0x64", "0o144", "0b1100100"), + nc(101, "101", "0x65", "0o145", "0b1100101"), + nc(127, "127", "0x7f", "0o177", "0b1111111"), + nc(128, "128", "0x80", "0o200", "0b10000000"), + nc(129, "129", "0x81", "0o201", "0b10000001"), + nc(251, "251", "0xfb", "0o373", "0b11111011"), + nc(252, "252", "0xfc", "0o374", "0b11111100"), + nc(253, "253", "0xfd", "0o375", "0b11111101"), + nc(254, "254", "0xfe", "0o376", "0b11111110"), + nc(255, "255", "0xff", "0o377", "0b11111111"), +#undef nc + }; +}; + + +template<> +struct numbers<int16_t> +{ + using value_type = int16_t; + static C4_INLINE_CONSTEXPR const number_case<int16_t> vals[] = { +#define nc(val, dec, hex, bin, oct) \ + number_case<value_type>{(value_type)INT16_C(val), csubstr{dec}, csubstr{hex}, csubstr{bin}, csubstr{oct}} + nc(-32768, "-32768", "-0x8000", "-0o100000", "-0b1000000000000000"), + nc(-32767, "-32767", "-0x7fff", "-0o77777", "-0b111111111111111"), + nc(-32766, "-32766", "-0x7ffe", "-0o77776", "-0b111111111111110"), + nc(-32765, "-32765", "-0x7ffd", "-0o77775", "-0b111111111111101"), + nc(-32764, "-32764", "-0x7ffc", "-0o77774", "-0b111111111111100"), + nc(-32763, "-32763", "-0x7ffb", "-0o77773", "-0b111111111111011"), + nc(-16385, "-16385", "-0x4001", "-0o40001", "-0b100000000000001"), + nc(-16384, "-16384", "-0x4000", "-0o40000", "-0b100000000000000"), + nc(-16383, "-16383", "-0x3fff", "-0o37777", "-0b11111111111111"), + nc(-10001, "-10001", "-0x2711", "-0o23421", "-0b10011100010001"), + nc(-10000, "-10000", "-0x2710", "-0o23420", "-0b10011100010000"), + nc(-9999, "-9999", "-0x270f", "-0o23417", "-0b10011100001111"), + nc(-8193, "-8193", "-0x2001", "-0o20001", "-0b10000000000001"), + nc(-8192, "-8192", "-0x2000", "-0o20000", "-0b10000000000000"), + nc(-8191, "-8191", "-0x1fff", "-0o17777", "-0b1111111111111"), + nc(-4097, "-4097", "-0x1001", "-0o10001", "-0b1000000000001"), + nc(-4096, "-4096", "-0x1000", "-0o10000", "-0b1000000000000"), + nc(-4095, "-4095", "-0xfff", "-0o7777", "-0b111111111111"), + nc(-3276, "-3276", "-0xccc", "-0o6314", "-0b110011001100"), + nc(-2049, "-2049", "-0x801", "-0o4001", "-0b100000000001"), + nc(-2048, "-2048", "-0x800", "-0o4000", "-0b100000000000"), + nc(-2047, "-2047", "-0x7ff", "-0o3777", "-0b11111111111"), + nc(-1025, "-1025", "-0x401", "-0o2001", "-0b10000000001"), + nc(-1024, "-1024", "-0x400", "-0o2000", "-0b10000000000"), + nc(-1023, "-1023", "-0x3ff", "-0o1777", "-0b1111111111"), + nc(-1001, "-1001", "-0x3e9", "-0o1751", "-0b1111101001"), + nc(-1000, "-1000", "-0x3e8", "-0o1750", "-0b1111101000"), + nc(-999, "-999", "-0x3e7", "-0o1747", "-0b1111100111"), + nc(-513, "-513", "-0x201", "-0o1001", "-0b1000000001"), + nc(-512, "-512", "-0x200", "-0o1000", "-0b1000000000"), + nc(-511, "-511", "-0x1ff", "-0o777", "-0b111111111"), + nc(-327, "-327", "-0x147", "-0o507", "-0b101000111"), + nc(-257, "-257", "-0x101", "-0o401", "-0b100000001"), + nc(-256, "-256", "-0x100", "-0o400", "-0b100000000"), + nc(-255, "-255", "-0xff", "-0o377", "-0b11111111"), + nc(-129, "-129", "-0x81", "-0o201", "-0b10000001"), + nc(-128, "-128", "-0x80", "-0o200", "-0b10000000"), + nc(-127, "-127", "-0x7f", "-0o177", "-0b1111111"), + nc(-101, "-101", "-0x65", "-0o145", "-0b1100101"), + nc(-100, "-100", "-0x64", "-0o144", "-0b1100100"), + nc(-99, "-99", "-0x63", "-0o143", "-0b1100011"), + nc(-65, "-65", "-0x41", "-0o101", "-0b1000001"), + nc(-64, "-64", "-0x40", "-0o100", "-0b1000000"), + nc(-63, "-63", "-0x3f", "-0o77", "-0b111111"), + nc(-33, "-33", "-0x21", "-0o41", "-0b100001"), + nc(-32, "-32", "-0x20", "-0o40", "-0b100000"), + nc(-31, "-31", "-0x1f", "-0o37", "-0b11111"), + nc(-17, "-17", "-0x11", "-0o21", "-0b10001"), + nc(-16, "-16", "-0x10", "-0o20", "-0b10000"), + nc(-15, "-15", "-0xf", "-0o17", "-0b1111"), + nc(-11, "-11", "-0xb", "-0o13", "-0b1011"), + nc(-10, "-10", "-0xa", "-0o12", "-0b1010"), + nc(-9, "-9", "-0x9", "-0o11", "-0b1001"), + nc(-8, "-8", "-0x8", "-0o10", "-0b1000"), + nc(-7, "-7", "-0x7", "-0o7", "-0b111"), + nc(-6, "-6", "-0x6", "-0o6", "-0b110"), + nc(-5, "-5", "-0x5", "-0o5", "-0b101"), + nc(-4, "-4", "-0x4", "-0o4", "-0b100"), + nc(-3, "-3", "-0x3", "-0o3", "-0b11"), + nc(-2, "-2", "-0x2", "-0o2", "-0b10"), + nc(-1, "-1", "-0x1", "-0o1", "-0b1"), + nc(0, "0", "0x0", "0o0", "0b0"), + nc(1, "1", "0x1", "0o1", "0b1"), + nc(2, "2", "0x2", "0o2", "0b10"), + nc(3, "3", "0x3", "0o3", "0b11"), + nc(4, "4", "0x4", "0o4", "0b100"), + nc(5, "5", "0x5", "0o5", "0b101"), + nc(6, "6", "0x6", "0o6", "0b110"), + nc(7, "7", "0x7", "0o7", "0b111"), + nc(8, "8", "0x8", "0o10", "0b1000"), + nc(9, "9", "0x9", "0o11", "0b1001"), + nc(10, "10", "0xa", "0o12", "0b1010"), + nc(11, "11", "0xb", "0o13", "0b1011"), + nc(15, "15", "0xf", "0o17", "0b1111"), + nc(16, "16", "0x10", "0o20", "0b10000"), + nc(17, "17", "0x11", "0o21", "0b10001"), + nc(31, "31", "0x1f", "0o37", "0b11111"), + nc(32, "32", "0x20", "0o40", "0b100000"), + nc(33, "33", "0x21", "0o41", "0b100001"), + nc(63, "63", "0x3f", "0o77", "0b111111"), + nc(64, "64", "0x40", "0o100", "0b1000000"), + nc(65, "65", "0x41", "0o101", "0b1000001"), + nc(99, "99", "0x63", "0o143", "0b1100011"), + nc(100, "100", "0x64", "0o144", "0b1100100"), + nc(101, "101", "0x65", "0o145", "0b1100101"), + nc(127, "127", "0x7f", "0o177", "0b1111111"), + nc(128, "128", "0x80", "0o200", "0b10000000"), + nc(129, "129", "0x81", "0o201", "0b10000001"), + nc(255, "255", "0xff", "0o377", "0b11111111"), + nc(256, "256", "0x100", "0o400", "0b100000000"), + nc(257, "257", "0x101", "0o401", "0b100000001"), + nc(326, "326", "0x146", "0o506", "0b101000110"), + nc(327, "327", "0x147", "0o507", "0b101000111"), + nc(328, "328", "0x148", "0o510", "0b101001000"), + nc(511, "511", "0x1ff", "0o777", "0b111111111"), + nc(512, "512", "0x200", "0o1000", "0b1000000000"), + nc(513, "513", "0x201", "0o1001", "0b1000000001"), + nc(999, "999", "0x3e7", "0o1747", "0b1111100111"), + nc(1000, "1000", "0x3e8", "0o1750", "0b1111101000"), + nc(1001, "1001", "0x3e9", "0o1751", "0b1111101001"), + nc(1023, "1023", "0x3ff", "0o1777", "0b1111111111"), + nc(1024, "1024", "0x400", "0o2000", "0b10000000000"), + nc(1025, "1025", "0x401", "0o2001", "0b10000000001"), + nc(2047, "2047", "0x7ff", "0o3777", "0b11111111111"), + nc(2048, "2048", "0x800", "0o4000", "0b100000000000"), + nc(2049, "2049", "0x801", "0o4001", "0b100000000001"), + nc(3275, "3275", "0xccb", "0o6313", "0b110011001011"), + nc(3276, "3276", "0xccc", "0o6314", "0b110011001100"), + nc(3277, "3277", "0xccd", "0o6315", "0b110011001101"), + nc(4095, "4095", "0xfff", "0o7777", "0b111111111111"), + nc(4096, "4096", "0x1000", "0o10000", "0b1000000000000"), + nc(4097, "4097", "0x1001", "0o10001", "0b1000000000001"), + nc(8191, "8191", "0x1fff", "0o17777", "0b1111111111111"), + nc(8192, "8192", "0x2000", "0o20000", "0b10000000000000"), + nc(8193, "8193", "0x2001", "0o20001", "0b10000000000001"), + nc(9999, "9999", "0x270f", "0o23417", "0b10011100001111"), + nc(10000, "10000", "0x2710", "0o23420", "0b10011100010000"), + nc(10001, "10001", "0x2711", "0o23421", "0b10011100010001"), + nc(16383, "16383", "0x3fff", "0o37777", "0b11111111111111"), + nc(16384, "16384", "0x4000", "0o40000", "0b100000000000000"), + nc(16385, "16385", "0x4001", "0o40001", "0b100000000000001"), + nc(32762, "32762", "0x7ffa", "0o77772", "0b111111111111010"), + nc(32763, "32763", "0x7ffb", "0o77773", "0b111111111111011"), + nc(32764, "32764", "0x7ffc", "0o77774", "0b111111111111100"), + nc(32765, "32765", "0x7ffd", "0o77775", "0b111111111111101"), + nc(32766, "32766", "0x7ffe", "0o77776", "0b111111111111110"), + nc(32767, "32767", "0x7fff", "0o77777", "0b111111111111111"), +#undef nc + }; +}; + + +template<> +struct numbers<uint16_t> +{ + using value_type = uint16_t; + static C4_INLINE_CONSTEXPR const number_case<uint16_t> vals[] = { +#define nc(val, dec, hex, bin, oct) \ + number_case<value_type>{(value_type)UINT16_C(val), csubstr{dec}, csubstr{hex}, csubstr{bin}, csubstr{oct}} + nc(0, "0", "0x0", "0o0", "0b0"), + nc(1, "1", "0x1", "0o1", "0b1"), + nc(2, "2", "0x2", "0o2", "0b10"), + nc(3, "3", "0x3", "0o3", "0b11"), + nc(4, "4", "0x4", "0o4", "0b100"), + nc(5, "5", "0x5", "0o5", "0b101"), + nc(6, "6", "0x6", "0o6", "0b110"), + nc(7, "7", "0x7", "0o7", "0b111"), + nc(8, "8", "0x8", "0o10", "0b1000"), + nc(9, "9", "0x9", "0o11", "0b1001"), + nc(10, "10", "0xa", "0o12", "0b1010"), + nc(11, "11", "0xb", "0o13", "0b1011"), + nc(15, "15", "0xf", "0o17", "0b1111"), + nc(16, "16", "0x10", "0o20", "0b10000"), + nc(17, "17", "0x11", "0o21", "0b10001"), + nc(31, "31", "0x1f", "0o37", "0b11111"), + nc(32, "32", "0x20", "0o40", "0b100000"), + nc(33, "33", "0x21", "0o41", "0b100001"), + nc(63, "63", "0x3f", "0o77", "0b111111"), + nc(64, "64", "0x40", "0o100", "0b1000000"), + nc(65, "65", "0x41", "0o101", "0b1000001"), + nc(66, "66", "0x42", "0o102", "0b1000010"), + nc(99, "99", "0x63", "0o143", "0b1100011"), + nc(100, "100", "0x64", "0o144", "0b1100100"), + nc(101, "101", "0x65", "0o145", "0b1100101"), + nc(127, "127", "0x7f", "0o177", "0b1111111"), + nc(128, "128", "0x80", "0o200", "0b10000000"), + nc(129, "129", "0x81", "0o201", "0b10000001"), + nc(255, "255", "0xff", "0o377", "0b11111111"), + nc(256, "256", "0x100", "0o400", "0b100000000"), + nc(257, "257", "0x101", "0o401", "0b100000001"), + nc(511, "511", "0x1ff", "0o777", "0b111111111"), + nc(512, "512", "0x200", "0o1000", "0b1000000000"), + nc(513, "513", "0x201", "0o1001", "0b1000000001"), + nc(654, "654", "0x28e", "0o1216", "0b1010001110"), + nc(655, "655", "0x28f", "0o1217", "0b1010001111"), + nc(656, "656", "0x290", "0o1220", "0b1010010000"), + nc(999, "999", "0x3e7", "0o1747", "0b1111100111"), + nc(1000, "1000", "0x3e8", "0o1750", "0b1111101000"), + nc(1001, "1001", "0x3e9", "0o1751", "0b1111101001"), + nc(1023, "1023", "0x3ff", "0o1777", "0b1111111111"), + nc(1024, "1024", "0x400", "0o2000", "0b10000000000"), + nc(1025, "1025", "0x401", "0o2001", "0b10000000001"), + nc(2047, "2047", "0x7ff", "0o3777", "0b11111111111"), + nc(2048, "2048", "0x800", "0o4000", "0b100000000000"), + nc(2049, "2049", "0x801", "0o4001", "0b100000000001"), + nc(4095, "4095", "0xfff", "0o7777", "0b111111111111"), + nc(4096, "4096", "0x1000", "0o10000", "0b1000000000000"), + nc(4097, "4097", "0x1001", "0o10001", "0b1000000000001"), + nc(6552, "6552", "0x1998", "0o14630", "0b1100110011000"), + nc(6553, "6553", "0x1999", "0o14631", "0b1100110011001"), + nc(6554, "6554", "0x199a", "0o14632", "0b1100110011010"), + nc(8191, "8191", "0x1fff", "0o17777", "0b1111111111111"), + nc(8192, "8192", "0x2000", "0o20000", "0b10000000000000"), + nc(8193, "8193", "0x2001", "0o20001", "0b10000000000001"), + nc(9999, "9999", "0x270f", "0o23417", "0b10011100001111"), + nc(10000, "10000", "0x2710", "0o23420", "0b10011100010000"), + nc(10001, "10001", "0x2711", "0o23421", "0b10011100010001"), + nc(16383, "16383", "0x3fff", "0o37777", "0b11111111111111"), + nc(16384, "16384", "0x4000", "0o40000", "0b100000000000000"), + nc(16385, "16385", "0x4001", "0o40001", "0b100000000000001"), + nc(32767, "32767", "0x7fff", "0o77777", "0b111111111111111"), + nc(32768, "32768", "0x8000", "0o100000", "0b1000000000000000"), + nc(32769, "32769", "0x8001", "0o100001", "0b1000000000000001"), + nc(65531, "65531", "0xfffb", "0o177773", "0b1111111111111011"), + nc(65532, "65532", "0xfffc", "0o177774", "0b1111111111111100"), + nc(65533, "65533", "0xfffd", "0o177775", "0b1111111111111101"), + nc(65534, "65534", "0xfffe", "0o177776", "0b1111111111111110"), + nc(65535, "65535", "0xffff", "0o177777", "0b1111111111111111"), +#undef nc + }; +}; + + +template<> +struct numbers<int32_t> +{ + using value_type = int32_t; + static C4_INLINE_CONSTEXPR const number_case<int32_t> vals[] = { +#define nc(val, dec, hex, bin, oct) \ + number_case<value_type>{(value_type)INT32_C(val), csubstr{dec}, csubstr{hex}, csubstr{bin}, csubstr{oct}} + nc(-2147483648, "-2147483648", "-0x80000000", "-0o20000000000", "-0b10000000000000000000000000000000"), + nc(-2147483647, "-2147483647", "-0x7fffffff", "-0o17777777777", "-0b1111111111111111111111111111111"), + nc(-2147483646, "-2147483646", "-0x7ffffffe", "-0o17777777776", "-0b1111111111111111111111111111110"), + nc(-2147483645, "-2147483645", "-0x7ffffffd", "-0o17777777775", "-0b1111111111111111111111111111101"), + nc(-2147483644, "-2147483644", "-0x7ffffffc", "-0o17777777774", "-0b1111111111111111111111111111100"), + nc(-2147483643, "-2147483643", "-0x7ffffffb", "-0o17777777773", "-0b1111111111111111111111111111011"), + nc(-1073741825, "-1073741825", "-0x40000001", "-0o10000000001", "-0b1000000000000000000000000000001"), + nc(-1073741824, "-1073741824", "-0x40000000", "-0o10000000000", "-0b1000000000000000000000000000000"), + nc(-1073741823, "-1073741823", "-0x3fffffff", "-0o7777777777", "-0b111111111111111111111111111111"), + nc(-1000000001, "-1000000001", "-0x3b9aca01", "-0o7346545001", "-0b111011100110101100101000000001"), + nc(-1000000000, "-1000000000", "-0x3b9aca00", "-0o7346545000", "-0b111011100110101100101000000000"), + nc(-999999999, "-999999999", "-0x3b9ac9ff", "-0o7346544777", "-0b111011100110101100100111111111"), + nc(-536870913, "-536870913", "-0x20000001", "-0o4000000001", "-0b100000000000000000000000000001"), + nc(-536870912, "-536870912", "-0x20000000", "-0o4000000000", "-0b100000000000000000000000000000"), + nc(-536870911, "-536870911", "-0x1fffffff", "-0o3777777777", "-0b11111111111111111111111111111"), + nc(-268435457, "-268435457", "-0x10000001", "-0o2000000001", "-0b10000000000000000000000000001"), + nc(-268435456, "-268435456", "-0x10000000", "-0o2000000000", "-0b10000000000000000000000000000"), + nc(-268435455, "-268435455", "-0xfffffff", "-0o1777777777", "-0b1111111111111111111111111111"), + nc(-214748364, "-214748364", "-0xccccccc", "-0o1463146314", "-0b1100110011001100110011001100"), + nc(-134217729, "-134217729", "-0x8000001", "-0o1000000001", "-0b1000000000000000000000000001"), + nc(-134217728, "-134217728", "-0x8000000", "-0o1000000000", "-0b1000000000000000000000000000"), + nc(-134217727, "-134217727", "-0x7ffffff", "-0o777777777", "-0b111111111111111111111111111"), + nc(-100000001, "-100000001", "-0x5f5e101", "-0o575360401", "-0b101111101011110000100000001"), + nc(-100000000, "-100000000", "-0x5f5e100", "-0o575360400", "-0b101111101011110000100000000"), + nc(-99999999, "-99999999", "-0x5f5e0ff", "-0o575360377", "-0b101111101011110000011111111"), + nc(-67108865, "-67108865", "-0x4000001", "-0o400000001", "-0b100000000000000000000000001"), + nc(-67108864, "-67108864", "-0x4000000", "-0o400000000", "-0b100000000000000000000000000"), + nc(-67108863, "-67108863", "-0x3ffffff", "-0o377777777", "-0b11111111111111111111111111"), + nc(-33554433, "-33554433", "-0x2000001", "-0o200000001", "-0b10000000000000000000000001"), + nc(-33554432, "-33554432", "-0x2000000", "-0o200000000", "-0b10000000000000000000000000"), + nc(-33554431, "-33554431", "-0x1ffffff", "-0o177777777", "-0b1111111111111111111111111"), + nc(-21474836, "-21474836", "-0x147ae14", "-0o121727024", "-0b1010001111010111000010100"), + nc(-16777217, "-16777217", "-0x1000001", "-0o100000001", "-0b1000000000000000000000001"), + nc(-16777216, "-16777216", "-0x1000000", "-0o100000000", "-0b1000000000000000000000000"), + nc(-16777215, "-16777215", "-0xffffff", "-0o77777777", "-0b111111111111111111111111"), + nc(-10000001, "-10000001", "-0x989681", "-0o46113201", "-0b100110001001011010000001"), + nc(-10000000, "-10000000", "-0x989680", "-0o46113200", "-0b100110001001011010000000"), + nc(-9999999, "-9999999", "-0x98967f", "-0o46113177", "-0b100110001001011001111111"), + nc(-8388609, "-8388609", "-0x800001", "-0o40000001", "-0b100000000000000000000001"), + nc(-8388608, "-8388608", "-0x800000", "-0o40000000", "-0b100000000000000000000000"), + nc(-8388607, "-8388607", "-0x7fffff", "-0o37777777", "-0b11111111111111111111111"), + nc(-4194305, "-4194305", "-0x400001", "-0o20000001", "-0b10000000000000000000001"), + nc(-4194304, "-4194304", "-0x400000", "-0o20000000", "-0b10000000000000000000000"), + nc(-4194303, "-4194303", "-0x3fffff", "-0o17777777", "-0b1111111111111111111111"), + nc(-2147483, "-2147483", "-0x20c49b", "-0o10142233", "-0b1000001100010010011011"), + nc(-2097153, "-2097153", "-0x200001", "-0o10000001", "-0b1000000000000000000001"), + nc(-2097152, "-2097152", "-0x200000", "-0o10000000", "-0b1000000000000000000000"), + nc(-2097151, "-2097151", "-0x1fffff", "-0o7777777", "-0b111111111111111111111"), + nc(-1048577, "-1048577", "-0x100001", "-0o4000001", "-0b100000000000000000001"), + nc(-1048576, "-1048576", "-0x100000", "-0o4000000", "-0b100000000000000000000"), + nc(-1048575, "-1048575", "-0xfffff", "-0o3777777", "-0b11111111111111111111"), + nc(-1000001, "-1000001", "-0xf4241", "-0o3641101", "-0b11110100001001000001"), + nc(-1000000, "-1000000", "-0xf4240", "-0o3641100", "-0b11110100001001000000"), + nc(-999999, "-999999", "-0xf423f", "-0o3641077", "-0b11110100001000111111"), + nc(-524289, "-524289", "-0x80001", "-0o2000001", "-0b10000000000000000001"), + nc(-524288, "-524288", "-0x80000", "-0o2000000", "-0b10000000000000000000"), + nc(-524287, "-524287", "-0x7ffff", "-0o1777777", "-0b1111111111111111111"), + nc(-262145, "-262145", "-0x40001", "-0o1000001", "-0b1000000000000000001"), + nc(-262144, "-262144", "-0x40000", "-0o1000000", "-0b1000000000000000000"), + nc(-262143, "-262143", "-0x3ffff", "-0o777777", "-0b111111111111111111"), + nc(-214748, "-214748", "-0x346dc", "-0o643334", "-0b110100011011011100"), + nc(-131073, "-131073", "-0x20001", "-0o400001", "-0b100000000000000001"), + nc(-131072, "-131072", "-0x20000", "-0o400000", "-0b100000000000000000"), + nc(-131071, "-131071", "-0x1ffff", "-0o377777", "-0b11111111111111111"), + nc(-100001, "-100001", "-0x186a1", "-0o303241", "-0b11000011010100001"), + nc(-100000, "-100000", "-0x186a0", "-0o303240", "-0b11000011010100000"), + nc(-99999, "-99999", "-0x1869f", "-0o303237", "-0b11000011010011111"), + nc(-65537, "-65537", "-0x10001", "-0o200001", "-0b10000000000000001"), + nc(-65536, "-65536", "-0x10000", "-0o200000", "-0b10000000000000000"), + nc(-65535, "-65535", "-0xffff", "-0o177777", "-0b1111111111111111"), + nc(-32769, "-32769", "-0x8001", "-0o100001", "-0b1000000000000001"), + nc(-32768, "-32768", "-0x8000", "-0o100000", "-0b1000000000000000"), + nc(-32767, "-32767", "-0x7fff", "-0o77777", "-0b111111111111111"), + nc(-21474, "-21474", "-0x53e2", "-0o51742", "-0b101001111100010"), + nc(-16385, "-16385", "-0x4001", "-0o40001", "-0b100000000000001"), + nc(-16384, "-16384", "-0x4000", "-0o40000", "-0b100000000000000"), + nc(-16383, "-16383", "-0x3fff", "-0o37777", "-0b11111111111111"), + nc(-10001, "-10001", "-0x2711", "-0o23421", "-0b10011100010001"), + nc(-10000, "-10000", "-0x2710", "-0o23420", "-0b10011100010000"), + nc(-9999, "-9999", "-0x270f", "-0o23417", "-0b10011100001111"), + nc(-8193, "-8193", "-0x2001", "-0o20001", "-0b10000000000001"), + nc(-8192, "-8192", "-0x2000", "-0o20000", "-0b10000000000000"), + nc(-8191, "-8191", "-0x1fff", "-0o17777", "-0b1111111111111"), + nc(-4097, "-4097", "-0x1001", "-0o10001", "-0b1000000000001"), + nc(-4096, "-4096", "-0x1000", "-0o10000", "-0b1000000000000"), + nc(-4095, "-4095", "-0xfff", "-0o7777", "-0b111111111111"), + nc(-2147, "-2147", "-0x863", "-0o4143", "-0b100001100011"), + nc(-2049, "-2049", "-0x801", "-0o4001", "-0b100000000001"), + nc(-2048, "-2048", "-0x800", "-0o4000", "-0b100000000000"), + nc(-2047, "-2047", "-0x7ff", "-0o3777", "-0b11111111111"), + nc(-1025, "-1025", "-0x401", "-0o2001", "-0b10000000001"), + nc(-1024, "-1024", "-0x400", "-0o2000", "-0b10000000000"), + nc(-1023, "-1023", "-0x3ff", "-0o1777", "-0b1111111111"), + nc(-1001, "-1001", "-0x3e9", "-0o1751", "-0b1111101001"), + nc(-1000, "-1000", "-0x3e8", "-0o1750", "-0b1111101000"), + nc(-999, "-999", "-0x3e7", "-0o1747", "-0b1111100111"), + nc(-513, "-513", "-0x201", "-0o1001", "-0b1000000001"), + nc(-512, "-512", "-0x200", "-0o1000", "-0b1000000000"), + nc(-511, "-511", "-0x1ff", "-0o777", "-0b111111111"), + nc(-257, "-257", "-0x101", "-0o401", "-0b100000001"), + nc(-256, "-256", "-0x100", "-0o400", "-0b100000000"), + nc(-255, "-255", "-0xff", "-0o377", "-0b11111111"), + nc(-214, "-214", "-0xd6", "-0o326", "-0b11010110"), + nc(-129, "-129", "-0x81", "-0o201", "-0b10000001"), + nc(-128, "-128", "-0x80", "-0o200", "-0b10000000"), + nc(-127, "-127", "-0x7f", "-0o177", "-0b1111111"), + nc(-101, "-101", "-0x65", "-0o145", "-0b1100101"), + nc(-100, "-100", "-0x64", "-0o144", "-0b1100100"), + nc(-99, "-99", "-0x63", "-0o143", "-0b1100011"), + nc(-65, "-65", "-0x41", "-0o101", "-0b1000001"), + nc(-64, "-64", "-0x40", "-0o100", "-0b1000000"), + nc(-63, "-63", "-0x3f", "-0o77", "-0b111111"), + nc(-33, "-33", "-0x21", "-0o41", "-0b100001"), + nc(-32, "-32", "-0x20", "-0o40", "-0b100000"), + nc(-31, "-31", "-0x1f", "-0o37", "-0b11111"), + nc(-21, "-21", "-0x15", "-0o25", "-0b10101"), + nc(-17, "-17", "-0x11", "-0o21", "-0b10001"), + nc(-16, "-16", "-0x10", "-0o20", "-0b10000"), + nc(-15, "-15", "-0xf", "-0o17", "-0b1111"), + nc(-11, "-11", "-0xb", "-0o13", "-0b1011"), + nc(-10, "-10", "-0xa", "-0o12", "-0b1010"), + nc(-9, "-9", "-0x9", "-0o11", "-0b1001"), + nc(-8, "-8", "-0x8", "-0o10", "-0b1000"), + nc(-7, "-7", "-0x7", "-0o7", "-0b111"), + nc(-6, "-6", "-0x6", "-0o6", "-0b110"), + nc(-5, "-5", "-0x5", "-0o5", "-0b101"), + nc(-4, "-4", "-0x4", "-0o4", "-0b100"), + nc(-3, "-3", "-0x3", "-0o3", "-0b11"), + nc(-2, "-2", "-0x2", "-0o2", "-0b10"), + nc(-1, "-1", "-0x1", "-0o1", "-0b1"), + nc(0, "0", "0x0", "0o0", "0b0"), + nc(1, "1", "0x1", "0o1", "0b1"), + nc(2, "2", "0x2", "0o2", "0b10"), + nc(3, "3", "0x3", "0o3", "0b11"), + nc(4, "4", "0x4", "0o4", "0b100"), + nc(5, "5", "0x5", "0o5", "0b101"), + nc(6, "6", "0x6", "0o6", "0b110"), + nc(7, "7", "0x7", "0o7", "0b111"), + nc(8, "8", "0x8", "0o10", "0b1000"), + nc(9, "9", "0x9", "0o11", "0b1001"), + nc(10, "10", "0xa", "0o12", "0b1010"), + nc(11, "11", "0xb", "0o13", "0b1011"), + nc(15, "15", "0xf", "0o17", "0b1111"), + nc(16, "16", "0x10", "0o20", "0b10000"), + nc(17, "17", "0x11", "0o21", "0b10001"), + nc(20, "20", "0x14", "0o24", "0b10100"), + nc(21, "21", "0x15", "0o25", "0b10101"), + nc(22, "22", "0x16", "0o26", "0b10110"), + nc(31, "31", "0x1f", "0o37", "0b11111"), + nc(32, "32", "0x20", "0o40", "0b100000"), + nc(33, "33", "0x21", "0o41", "0b100001"), + nc(63, "63", "0x3f", "0o77", "0b111111"), + nc(64, "64", "0x40", "0o100", "0b1000000"), + nc(65, "65", "0x41", "0o101", "0b1000001"), + nc(99, "99", "0x63", "0o143", "0b1100011"), + nc(100, "100", "0x64", "0o144", "0b1100100"), + nc(101, "101", "0x65", "0o145", "0b1100101"), + nc(127, "127", "0x7f", "0o177", "0b1111111"), + nc(128, "128", "0x80", "0o200", "0b10000000"), + nc(129, "129", "0x81", "0o201", "0b10000001"), + nc(213, "213", "0xd5", "0o325", "0b11010101"), + nc(214, "214", "0xd6", "0o326", "0b11010110"), + nc(215, "215", "0xd7", "0o327", "0b11010111"), + nc(255, "255", "0xff", "0o377", "0b11111111"), + nc(256, "256", "0x100", "0o400", "0b100000000"), + nc(257, "257", "0x101", "0o401", "0b100000001"), + nc(511, "511", "0x1ff", "0o777", "0b111111111"), + nc(512, "512", "0x200", "0o1000", "0b1000000000"), + nc(513, "513", "0x201", "0o1001", "0b1000000001"), + nc(999, "999", "0x3e7", "0o1747", "0b1111100111"), + nc(1000, "1000", "0x3e8", "0o1750", "0b1111101000"), + nc(1001, "1001", "0x3e9", "0o1751", "0b1111101001"), + nc(1023, "1023", "0x3ff", "0o1777", "0b1111111111"), + nc(1024, "1024", "0x400", "0o2000", "0b10000000000"), + nc(1025, "1025", "0x401", "0o2001", "0b10000000001"), + nc(2047, "2047", "0x7ff", "0o3777", "0b11111111111"), + nc(2048, "2048", "0x800", "0o4000", "0b100000000000"), + nc(2049, "2049", "0x801", "0o4001", "0b100000000001"), + nc(2146, "2146", "0x862", "0o4142", "0b100001100010"), + nc(2147, "2147", "0x863", "0o4143", "0b100001100011"), + nc(2148, "2148", "0x864", "0o4144", "0b100001100100"), + nc(4095, "4095", "0xfff", "0o7777", "0b111111111111"), + nc(4096, "4096", "0x1000", "0o10000", "0b1000000000000"), + nc(4097, "4097", "0x1001", "0o10001", "0b1000000000001"), + nc(8191, "8191", "0x1fff", "0o17777", "0b1111111111111"), + nc(8192, "8192", "0x2000", "0o20000", "0b10000000000000"), + nc(8193, "8193", "0x2001", "0o20001", "0b10000000000001"), + nc(9999, "9999", "0x270f", "0o23417", "0b10011100001111"), + nc(10000, "10000", "0x2710", "0o23420", "0b10011100010000"), + nc(10001, "10001", "0x2711", "0o23421", "0b10011100010001"), + nc(16383, "16383", "0x3fff", "0o37777", "0b11111111111111"), + nc(16384, "16384", "0x4000", "0o40000", "0b100000000000000"), + nc(16385, "16385", "0x4001", "0o40001", "0b100000000000001"), + nc(21473, "21473", "0x53e1", "0o51741", "0b101001111100001"), + nc(21474, "21474", "0x53e2", "0o51742", "0b101001111100010"), + nc(21475, "21475", "0x53e3", "0o51743", "0b101001111100011"), + nc(32767, "32767", "0x7fff", "0o77777", "0b111111111111111"), + nc(32768, "32768", "0x8000", "0o100000", "0b1000000000000000"), + nc(32769, "32769", "0x8001", "0o100001", "0b1000000000000001"), + nc(65535, "65535", "0xffff", "0o177777", "0b1111111111111111"), + nc(65536, "65536", "0x10000", "0o200000", "0b10000000000000000"), + nc(65537, "65537", "0x10001", "0o200001", "0b10000000000000001"), + nc(99999, "99999", "0x1869f", "0o303237", "0b11000011010011111"), + nc(100000, "100000", "0x186a0", "0o303240", "0b11000011010100000"), + nc(100001, "100001", "0x186a1", "0o303241", "0b11000011010100001"), + nc(131071, "131071", "0x1ffff", "0o377777", "0b11111111111111111"), + nc(131072, "131072", "0x20000", "0o400000", "0b100000000000000000"), + nc(131073, "131073", "0x20001", "0o400001", "0b100000000000000001"), + nc(214747, "214747", "0x346db", "0o643333", "0b110100011011011011"), + nc(214748, "214748", "0x346dc", "0o643334", "0b110100011011011100"), + nc(214749, "214749", "0x346dd", "0o643335", "0b110100011011011101"), + nc(262143, "262143", "0x3ffff", "0o777777", "0b111111111111111111"), + nc(262144, "262144", "0x40000", "0o1000000", "0b1000000000000000000"), + nc(262145, "262145", "0x40001", "0o1000001", "0b1000000000000000001"), + nc(524287, "524287", "0x7ffff", "0o1777777", "0b1111111111111111111"), + nc(524288, "524288", "0x80000", "0o2000000", "0b10000000000000000000"), + nc(524289, "524289", "0x80001", "0o2000001", "0b10000000000000000001"), + nc(999999, "999999", "0xf423f", "0o3641077", "0b11110100001000111111"), + nc(1000000, "1000000", "0xf4240", "0o3641100", "0b11110100001001000000"), + nc(1000001, "1000001", "0xf4241", "0o3641101", "0b11110100001001000001"), + nc(1048575, "1048575", "0xfffff", "0o3777777", "0b11111111111111111111"), + nc(1048576, "1048576", "0x100000", "0o4000000", "0b100000000000000000000"), + nc(1048577, "1048577", "0x100001", "0o4000001", "0b100000000000000000001"), + nc(2097151, "2097151", "0x1fffff", "0o7777777", "0b111111111111111111111"), + nc(2097152, "2097152", "0x200000", "0o10000000", "0b1000000000000000000000"), + nc(2097153, "2097153", "0x200001", "0o10000001", "0b1000000000000000000001"), + nc(2147482, "2147482", "0x20c49a", "0o10142232", "0b1000001100010010011010"), + nc(2147483, "2147483", "0x20c49b", "0o10142233", "0b1000001100010010011011"), + nc(2147484, "2147484", "0x20c49c", "0o10142234", "0b1000001100010010011100"), + nc(4194303, "4194303", "0x3fffff", "0o17777777", "0b1111111111111111111111"), + nc(4194304, "4194304", "0x400000", "0o20000000", "0b10000000000000000000000"), + nc(4194305, "4194305", "0x400001", "0o20000001", "0b10000000000000000000001"), + nc(8388607, "8388607", "0x7fffff", "0o37777777", "0b11111111111111111111111"), + nc(8388608, "8388608", "0x800000", "0o40000000", "0b100000000000000000000000"), + nc(8388609, "8388609", "0x800001", "0o40000001", "0b100000000000000000000001"), + nc(9999999, "9999999", "0x98967f", "0o46113177", "0b100110001001011001111111"), + nc(10000000, "10000000", "0x989680", "0o46113200", "0b100110001001011010000000"), + nc(10000001, "10000001", "0x989681", "0o46113201", "0b100110001001011010000001"), + nc(16777215, "16777215", "0xffffff", "0o77777777", "0b111111111111111111111111"), + nc(16777216, "16777216", "0x1000000", "0o100000000", "0b1000000000000000000000000"), + nc(16777217, "16777217", "0x1000001", "0o100000001", "0b1000000000000000000000001"), + nc(21474835, "21474835", "0x147ae13", "0o121727023", "0b1010001111010111000010011"), + nc(21474836, "21474836", "0x147ae14", "0o121727024", "0b1010001111010111000010100"), + nc(21474837, "21474837", "0x147ae15", "0o121727025", "0b1010001111010111000010101"), + nc(33554431, "33554431", "0x1ffffff", "0o177777777", "0b1111111111111111111111111"), + nc(33554432, "33554432", "0x2000000", "0o200000000", "0b10000000000000000000000000"), + nc(33554433, "33554433", "0x2000001", "0o200000001", "0b10000000000000000000000001"), + nc(67108863, "67108863", "0x3ffffff", "0o377777777", "0b11111111111111111111111111"), + nc(67108864, "67108864", "0x4000000", "0o400000000", "0b100000000000000000000000000"), + nc(67108865, "67108865", "0x4000001", "0o400000001", "0b100000000000000000000000001"), + nc(99999999, "99999999", "0x5f5e0ff", "0o575360377", "0b101111101011110000011111111"), + nc(100000000, "100000000", "0x5f5e100", "0o575360400", "0b101111101011110000100000000"), + nc(100000001, "100000001", "0x5f5e101", "0o575360401", "0b101111101011110000100000001"), + nc(134217727, "134217727", "0x7ffffff", "0o777777777", "0b111111111111111111111111111"), + nc(134217728, "134217728", "0x8000000", "0o1000000000", "0b1000000000000000000000000000"), + nc(134217729, "134217729", "0x8000001", "0o1000000001", "0b1000000000000000000000000001"), + nc(214748363, "214748363", "0xccccccb", "0o1463146313", "0b1100110011001100110011001011"), + nc(214748364, "214748364", "0xccccccc", "0o1463146314", "0b1100110011001100110011001100"), + nc(214748365, "214748365", "0xccccccd", "0o1463146315", "0b1100110011001100110011001101"), + nc(268435455, "268435455", "0xfffffff", "0o1777777777", "0b1111111111111111111111111111"), + nc(268435456, "268435456", "0x10000000", "0o2000000000", "0b10000000000000000000000000000"), + nc(268435457, "268435457", "0x10000001", "0o2000000001", "0b10000000000000000000000000001"), + nc(536870911, "536870911", "0x1fffffff", "0o3777777777", "0b11111111111111111111111111111"), + nc(536870912, "536870912", "0x20000000", "0o4000000000", "0b100000000000000000000000000000"), + nc(536870913, "536870913", "0x20000001", "0o4000000001", "0b100000000000000000000000000001"), + nc(999999999, "999999999", "0x3b9ac9ff", "0o7346544777", "0b111011100110101100100111111111"), + nc(1000000000, "1000000000", "0x3b9aca00", "0o7346545000", "0b111011100110101100101000000000"), + nc(1000000001, "1000000001", "0x3b9aca01", "0o7346545001", "0b111011100110101100101000000001"), + nc(1073741823, "1073741823", "0x3fffffff", "0o7777777777", "0b111111111111111111111111111111"), + nc(1073741824, "1073741824", "0x40000000", "0o10000000000", "0b1000000000000000000000000000000"), + nc(1073741825, "1073741825", "0x40000001", "0o10000000001", "0b1000000000000000000000000000001"), + nc(2147483642, "2147483642", "0x7ffffffa", "0o17777777772", "0b1111111111111111111111111111010"), + nc(2147483643, "2147483643", "0x7ffffffb", "0o17777777773", "0b1111111111111111111111111111011"), + nc(2147483644, "2147483644", "0x7ffffffc", "0o17777777774", "0b1111111111111111111111111111100"), + nc(2147483645, "2147483645", "0x7ffffffd", "0o17777777775", "0b1111111111111111111111111111101"), + nc(2147483646, "2147483646", "0x7ffffffe", "0o17777777776", "0b1111111111111111111111111111110"), + nc(2147483647, "2147483647", "0x7fffffff", "0o17777777777", "0b1111111111111111111111111111111"), +#undef nc + }; +}; + + +template<> +struct numbers<uint32_t> +{ + using value_type = uint32_t; + static C4_INLINE_CONSTEXPR const number_case<uint32_t> vals[] = { +#define nc(val, dec, hex, bin, oct) \ + number_case<value_type>{(value_type)UINT32_C(val), csubstr{dec}, csubstr{hex}, csubstr{bin}, csubstr{oct}} + nc(0, "0", "0x0", "0o0", "0b0"), + nc(1, "1", "0x1", "0o1", "0b1"), + nc(2, "2", "0x2", "0o2", "0b10"), + nc(3, "3", "0x3", "0o3", "0b11"), + nc(4, "4", "0x4", "0o4", "0b100"), + nc(5, "5", "0x5", "0o5", "0b101"), + nc(6, "6", "0x6", "0o6", "0b110"), + nc(7, "7", "0x7", "0o7", "0b111"), + nc(8, "8", "0x8", "0o10", "0b1000"), + nc(9, "9", "0x9", "0o11", "0b1001"), + nc(10, "10", "0xa", "0o12", "0b1010"), + nc(11, "11", "0xb", "0o13", "0b1011"), + nc(15, "15", "0xf", "0o17", "0b1111"), + nc(16, "16", "0x10", "0o20", "0b10000"), + nc(17, "17", "0x11", "0o21", "0b10001"), + nc(31, "31", "0x1f", "0o37", "0b11111"), + nc(32, "32", "0x20", "0o40", "0b100000"), + nc(33, "33", "0x21", "0o41", "0b100001"), + nc(41, "41", "0x29", "0o51", "0b101001"), + nc(42, "42", "0x2a", "0o52", "0b101010"), + nc(43, "43", "0x2b", "0o53", "0b101011"), + nc(63, "63", "0x3f", "0o77", "0b111111"), + nc(64, "64", "0x40", "0o100", "0b1000000"), + nc(65, "65", "0x41", "0o101", "0b1000001"), + nc(99, "99", "0x63", "0o143", "0b1100011"), + nc(100, "100", "0x64", "0o144", "0b1100100"), + nc(101, "101", "0x65", "0o145", "0b1100101"), + nc(127, "127", "0x7f", "0o177", "0b1111111"), + nc(128, "128", "0x80", "0o200", "0b10000000"), + nc(129, "129", "0x81", "0o201", "0b10000001"), + nc(255, "255", "0xff", "0o377", "0b11111111"), + nc(256, "256", "0x100", "0o400", "0b100000000"), + nc(257, "257", "0x101", "0o401", "0b100000001"), + nc(428, "428", "0x1ac", "0o654", "0b110101100"), + nc(429, "429", "0x1ad", "0o655", "0b110101101"), + nc(430, "430", "0x1ae", "0o656", "0b110101110"), + nc(511, "511", "0x1ff", "0o777", "0b111111111"), + nc(512, "512", "0x200", "0o1000", "0b1000000000"), + nc(513, "513", "0x201", "0o1001", "0b1000000001"), + nc(999, "999", "0x3e7", "0o1747", "0b1111100111"), + nc(1000, "1000", "0x3e8", "0o1750", "0b1111101000"), + nc(1001, "1001", "0x3e9", "0o1751", "0b1111101001"), + nc(1023, "1023", "0x3ff", "0o1777", "0b1111111111"), + nc(1024, "1024", "0x400", "0o2000", "0b10000000000"), + nc(1025, "1025", "0x401", "0o2001", "0b10000000001"), + nc(2047, "2047", "0x7ff", "0o3777", "0b11111111111"), + nc(2048, "2048", "0x800", "0o4000", "0b100000000000"), + nc(2049, "2049", "0x801", "0o4001", "0b100000000001"), + nc(4095, "4095", "0xfff", "0o7777", "0b111111111111"), + nc(4096, "4096", "0x1000", "0o10000", "0b1000000000000"), + nc(4097, "4097", "0x1001", "0o10001", "0b1000000000001"), + nc(4293, "4293", "0x10c5", "0o10305", "0b1000011000101"), + nc(4294, "4294", "0x10c6", "0o10306", "0b1000011000110"), + nc(4295, "4295", "0x10c7", "0o10307", "0b1000011000111"), + nc(8191, "8191", "0x1fff", "0o17777", "0b1111111111111"), + nc(8192, "8192", "0x2000", "0o20000", "0b10000000000000"), + nc(8193, "8193", "0x2001", "0o20001", "0b10000000000001"), + nc(9999, "9999", "0x270f", "0o23417", "0b10011100001111"), + nc(10000, "10000", "0x2710", "0o23420", "0b10011100010000"), + nc(10001, "10001", "0x2711", "0o23421", "0b10011100010001"), + nc(16383, "16383", "0x3fff", "0o37777", "0b11111111111111"), + nc(16384, "16384", "0x4000", "0o40000", "0b100000000000000"), + nc(16385, "16385", "0x4001", "0o40001", "0b100000000000001"), + nc(32767, "32767", "0x7fff", "0o77777", "0b111111111111111"), + nc(32768, "32768", "0x8000", "0o100000", "0b1000000000000000"), + nc(32769, "32769", "0x8001", "0o100001", "0b1000000000000001"), + nc(42948, "42948", "0xa7c4", "0o123704", "0b1010011111000100"), + nc(42949, "42949", "0xa7c5", "0o123705", "0b1010011111000101"), + nc(42950, "42950", "0xa7c6", "0o123706", "0b1010011111000110"), + nc(65535, "65535", "0xffff", "0o177777", "0b1111111111111111"), + nc(65536, "65536", "0x10000", "0o200000", "0b10000000000000000"), + nc(65537, "65537", "0x10001", "0o200001", "0b10000000000000001"), + nc(99999, "99999", "0x1869f", "0o303237", "0b11000011010011111"), + nc(100000, "100000", "0x186a0", "0o303240", "0b11000011010100000"), + nc(100001, "100001", "0x186a1", "0o303241", "0b11000011010100001"), + nc(131071, "131071", "0x1ffff", "0o377777", "0b11111111111111111"), + nc(131072, "131072", "0x20000", "0o400000", "0b100000000000000000"), + nc(131073, "131073", "0x20001", "0o400001", "0b100000000000000001"), + nc(262143, "262143", "0x3ffff", "0o777777", "0b111111111111111111"), + nc(262144, "262144", "0x40000", "0o1000000", "0b1000000000000000000"), + nc(262145, "262145", "0x40001", "0o1000001", "0b1000000000000000001"), + nc(429495, "429495", "0x68db7", "0o1506667", "0b1101000110110110111"), + nc(429496, "429496", "0x68db8", "0o1506670", "0b1101000110110111000"), + nc(429497, "429497", "0x68db9", "0o1506671", "0b1101000110110111001"), + nc(524287, "524287", "0x7ffff", "0o1777777", "0b1111111111111111111"), + nc(524288, "524288", "0x80000", "0o2000000", "0b10000000000000000000"), + nc(524289, "524289", "0x80001", "0o2000001", "0b10000000000000000001"), + nc(999999, "999999", "0xf423f", "0o3641077", "0b11110100001000111111"), + nc(1000000, "1000000", "0xf4240", "0o3641100", "0b11110100001001000000"), + nc(1000001, "1000001", "0xf4241", "0o3641101", "0b11110100001001000001"), + nc(1048575, "1048575", "0xfffff", "0o3777777", "0b11111111111111111111"), + nc(1048576, "1048576", "0x100000", "0o4000000", "0b100000000000000000000"), + nc(1048577, "1048577", "0x100001", "0o4000001", "0b100000000000000000001"), + nc(2097151, "2097151", "0x1fffff", "0o7777777", "0b111111111111111111111"), + nc(2097152, "2097152", "0x200000", "0o10000000", "0b1000000000000000000000"), + nc(2097153, "2097153", "0x200001", "0o10000001", "0b1000000000000000000001"), + nc(4194303, "4194303", "0x3fffff", "0o17777777", "0b1111111111111111111111"), + nc(4194304, "4194304", "0x400000", "0o20000000", "0b10000000000000000000000"), + nc(4194305, "4194305", "0x400001", "0o20000001", "0b10000000000000000000001"), + nc(4294966, "4294966", "0x418936", "0o20304466", "0b10000011000100100110110"), + nc(4294967, "4294967", "0x418937", "0o20304467", "0b10000011000100100110111"), + nc(4294968, "4294968", "0x418938", "0o20304470", "0b10000011000100100111000"), + nc(8388607, "8388607", "0x7fffff", "0o37777777", "0b11111111111111111111111"), + nc(8388608, "8388608", "0x800000", "0o40000000", "0b100000000000000000000000"), + nc(8388609, "8388609", "0x800001", "0o40000001", "0b100000000000000000000001"), + nc(9999999, "9999999", "0x98967f", "0o46113177", "0b100110001001011001111111"), + nc(10000000, "10000000", "0x989680", "0o46113200", "0b100110001001011010000000"), + nc(10000001, "10000001", "0x989681", "0o46113201", "0b100110001001011010000001"), + nc(16777215, "16777215", "0xffffff", "0o77777777", "0b111111111111111111111111"), + nc(16777216, "16777216", "0x1000000", "0o100000000", "0b1000000000000000000000000"), + nc(16777217, "16777217", "0x1000001", "0o100000001", "0b1000000000000000000000001"), + nc(33554431, "33554431", "0x1ffffff", "0o177777777", "0b1111111111111111111111111"), + nc(33554432, "33554432", "0x2000000", "0o200000000", "0b10000000000000000000000000"), + nc(33554433, "33554433", "0x2000001", "0o200000001", "0b10000000000000000000000001"), + nc(42949671, "42949671", "0x28f5c27", "0o243656047", "0b10100011110101110000100111"), + nc(42949672, "42949672", "0x28f5c28", "0o243656050", "0b10100011110101110000101000"), + nc(42949673, "42949673", "0x28f5c29", "0o243656051", "0b10100011110101110000101001"), + nc(67108863, "67108863", "0x3ffffff", "0o377777777", "0b11111111111111111111111111"), + nc(67108864, "67108864", "0x4000000", "0o400000000", "0b100000000000000000000000000"), + nc(67108865, "67108865", "0x4000001", "0o400000001", "0b100000000000000000000000001"), + nc(99999999, "99999999", "0x5f5e0ff", "0o575360377", "0b101111101011110000011111111"), + nc(100000000, "100000000", "0x5f5e100", "0o575360400", "0b101111101011110000100000000"), + nc(100000001, "100000001", "0x5f5e101", "0o575360401", "0b101111101011110000100000001"), + nc(134217727, "134217727", "0x7ffffff", "0o777777777", "0b111111111111111111111111111"), + nc(134217728, "134217728", "0x8000000", "0o1000000000", "0b1000000000000000000000000000"), + nc(134217729, "134217729", "0x8000001", "0o1000000001", "0b1000000000000000000000000001"), + nc(268435455, "268435455", "0xfffffff", "0o1777777777", "0b1111111111111111111111111111"), + nc(268435456, "268435456", "0x10000000", "0o2000000000", "0b10000000000000000000000000000"), + nc(268435457, "268435457", "0x10000001", "0o2000000001", "0b10000000000000000000000000001"), + nc(429496728, "429496728", "0x19999998", "0o3146314630", "0b11001100110011001100110011000"), + nc(429496729, "429496729", "0x19999999", "0o3146314631", "0b11001100110011001100110011001"), + nc(429496730, "429496730", "0x1999999a", "0o3146314632", "0b11001100110011001100110011010"), + nc(536870911, "536870911", "0x1fffffff", "0o3777777777", "0b11111111111111111111111111111"), + nc(536870912, "536870912", "0x20000000", "0o4000000000", "0b100000000000000000000000000000"), + nc(536870913, "536870913", "0x20000001", "0o4000000001", "0b100000000000000000000000000001"), + nc(999999999, "999999999", "0x3b9ac9ff", "0o7346544777", "0b111011100110101100100111111111"), + nc(1000000000, "1000000000", "0x3b9aca00", "0o7346545000", "0b111011100110101100101000000000"), + nc(1000000001, "1000000001", "0x3b9aca01", "0o7346545001", "0b111011100110101100101000000001"), + nc(1073741823, "1073741823", "0x3fffffff", "0o7777777777", "0b111111111111111111111111111111"), + nc(1073741824, "1073741824", "0x40000000", "0o10000000000", "0b1000000000000000000000000000000"), + nc(1073741825, "1073741825", "0x40000001", "0o10000000001", "0b1000000000000000000000000000001"), + nc(2147483647, "2147483647", "0x7fffffff", "0o17777777777", "0b1111111111111111111111111111111"), + nc(2147483648, "2147483648", "0x80000000", "0o20000000000", "0b10000000000000000000000000000000"), + nc(2147483649, "2147483649", "0x80000001", "0o20000000001", "0b10000000000000000000000000000001"), + nc(4294967291, "4294967291", "0xfffffffb", "0o37777777773", "0b11111111111111111111111111111011"), + nc(4294967292, "4294967292", "0xfffffffc", "0o37777777774", "0b11111111111111111111111111111100"), + nc(4294967293, "4294967293", "0xfffffffd", "0o37777777775", "0b11111111111111111111111111111101"), + nc(4294967294, "4294967294", "0xfffffffe", "0o37777777776", "0b11111111111111111111111111111110"), + nc(4294967295, "4294967295", "0xffffffff", "0o37777777777", "0b11111111111111111111111111111111"), +#undef nc + }; +}; + + +template<> +struct numbers<int64_t> +{ + using value_type = int64_t; + static C4_INLINE_CONSTEXPR const number_case<int64_t> vals[] = { +#define nc(val, dec, hex, bin, oct) \ + number_case<value_type>{(value_type)INT64_C(val), csubstr{dec}, csubstr{hex}, csubstr{bin}, csubstr{oct}} +#define ncm1(val, dec, hex, bin, oct) \ + number_case<value_type>{(value_type)(INT64_C(val)-INT64_C(1)), csubstr{dec}, csubstr{hex}, csubstr{bin}, csubstr{oct}} + ncm1(-9223372036854775807, "-9223372036854775808", "-0x8000000000000000", "-0o1000000000000000000000", "-0b1000000000000000000000000000000000000000000000000000000000000000"), + nc(-9223372036854775807, "-9223372036854775807", "-0x7fffffffffffffff", "-0o777777777777777777777", "-0b111111111111111111111111111111111111111111111111111111111111111"), + nc(-9223372036854775806, "-9223372036854775806", "-0x7ffffffffffffffe", "-0o777777777777777777776", "-0b111111111111111111111111111111111111111111111111111111111111110"), + nc(-9223372036854775805, "-9223372036854775805", "-0x7ffffffffffffffd", "-0o777777777777777777775", "-0b111111111111111111111111111111111111111111111111111111111111101"), + nc(-9223372036854775804, "-9223372036854775804", "-0x7ffffffffffffffc", "-0o777777777777777777774", "-0b111111111111111111111111111111111111111111111111111111111111100"), + nc(-9223372036854775803, "-9223372036854775803", "-0x7ffffffffffffffb", "-0o777777777777777777773", "-0b111111111111111111111111111111111111111111111111111111111111011"), + nc(-4611686018427387905, "-4611686018427387905", "-0x4000000000000001", "-0o400000000000000000001", "-0b100000000000000000000000000000000000000000000000000000000000001"), + nc(-4611686018427387904, "-4611686018427387904", "-0x4000000000000000", "-0o400000000000000000000", "-0b100000000000000000000000000000000000000000000000000000000000000"), + nc(-4611686018427387903, "-4611686018427387903", "-0x3fffffffffffffff", "-0o377777777777777777777", "-0b11111111111111111111111111111111111111111111111111111111111111"), + nc(-2305843009213693953, "-2305843009213693953", "-0x2000000000000001", "-0o200000000000000000001", "-0b10000000000000000000000000000000000000000000000000000000000001"), + nc(-2305843009213693952, "-2305843009213693952", "-0x2000000000000000", "-0o200000000000000000000", "-0b10000000000000000000000000000000000000000000000000000000000000"), + nc(-2305843009213693951, "-2305843009213693951", "-0x1fffffffffffffff", "-0o177777777777777777777", "-0b1111111111111111111111111111111111111111111111111111111111111"), + nc(-1152921504606846977, "-1152921504606846977", "-0x1000000000000001", "-0o100000000000000000001", "-0b1000000000000000000000000000000000000000000000000000000000001"), + nc(-1152921504606846976, "-1152921504606846976", "-0x1000000000000000", "-0o100000000000000000000", "-0b1000000000000000000000000000000000000000000000000000000000000"), + nc(-1152921504606846975, "-1152921504606846975", "-0xfffffffffffffff", "-0o77777777777777777777", "-0b111111111111111111111111111111111111111111111111111111111111"), + nc(-1000000000000000001, "-1000000000000000001", "-0xde0b6b3a7640001", "-0o67405553164731000001", "-0b110111100000101101101011001110100111011001000000000000000001"), + nc(-1000000000000000000, "-1000000000000000000", "-0xde0b6b3a7640000", "-0o67405553164731000000", "-0b110111100000101101101011001110100111011001000000000000000000"), + nc(-999999999999999999, "-999999999999999999", "-0xde0b6b3a763ffff", "-0o67405553164730777777", "-0b110111100000101101101011001110100111011000111111111111111111"), + nc(-922337203685477632, "-922337203685477632", "-0xccccccccccccd00", "-0o63146314631463146400", "-0b110011001100110011001100110011001100110011001100110100000000"), + nc(-576460752303423489, "-576460752303423489", "-0x800000000000001", "-0o40000000000000000001", "-0b100000000000000000000000000000000000000000000000000000000001"), + nc(-576460752303423488, "-576460752303423488", "-0x800000000000000", "-0o40000000000000000000", "-0b100000000000000000000000000000000000000000000000000000000000"), + nc(-576460752303423487, "-576460752303423487", "-0x7ffffffffffffff", "-0o37777777777777777777", "-0b11111111111111111111111111111111111111111111111111111111111"), + nc(-288230376151711745, "-288230376151711745", "-0x400000000000001", "-0o20000000000000000001", "-0b10000000000000000000000000000000000000000000000000000000001"), + nc(-288230376151711744, "-288230376151711744", "-0x400000000000000", "-0o20000000000000000000", "-0b10000000000000000000000000000000000000000000000000000000000"), + nc(-288230376151711743, "-288230376151711743", "-0x3ffffffffffffff", "-0o17777777777777777777", "-0b1111111111111111111111111111111111111111111111111111111111"), + nc(-144115188075855873, "-144115188075855873", "-0x200000000000001", "-0o10000000000000000001", "-0b1000000000000000000000000000000000000000000000000000000001"), + nc(-144115188075855872, "-144115188075855872", "-0x200000000000000", "-0o10000000000000000000", "-0b1000000000000000000000000000000000000000000000000000000000"), + nc(-144115188075855871, "-144115188075855871", "-0x1ffffffffffffff", "-0o7777777777777777777", "-0b111111111111111111111111111111111111111111111111111111111"), + nc(-100000000000000001, "-100000000000000001", "-0x16345785d8a0001", "-0o5432127413542400001", "-0b101100011010001010111100001011101100010100000000000000001"), + nc(-100000000000000000, "-100000000000000000", "-0x16345785d8a0000", "-0o5432127413542400000", "-0b101100011010001010111100001011101100010100000000000000000"), + nc(-99999999999999999, "-99999999999999999", "-0x16345785d89ffff", "-0o5432127413542377777", "-0b101100011010001010111100001011101100010011111111111111111"), + nc(-92233720368547760, "-92233720368547760", "-0x147ae147ae147b0", "-0o5075341217270243660", "-0b101000111101011100001010001111010111000010100011110110000"), + nc(-72057594037927937, "-72057594037927937", "-0x100000000000001", "-0o4000000000000000001", "-0b100000000000000000000000000000000000000000000000000000001"), + nc(-72057594037927936, "-72057594037927936", "-0x100000000000000", "-0o4000000000000000000", "-0b100000000000000000000000000000000000000000000000000000000"), + nc(-72057594037927935, "-72057594037927935", "-0xffffffffffffff", "-0o3777777777777777777", "-0b11111111111111111111111111111111111111111111111111111111"), + nc(-36028797018963969, "-36028797018963969", "-0x80000000000001", "-0o2000000000000000001", "-0b10000000000000000000000000000000000000000000000000000001"), + nc(-36028797018963968, "-36028797018963968", "-0x80000000000000", "-0o2000000000000000000", "-0b10000000000000000000000000000000000000000000000000000000"), + nc(-36028797018963967, "-36028797018963967", "-0x7fffffffffffff", "-0o1777777777777777777", "-0b1111111111111111111111111111111111111111111111111111111"), + nc(-18014398509481985, "-18014398509481985", "-0x40000000000001", "-0o1000000000000000001", "-0b1000000000000000000000000000000000000000000000000000001"), + nc(-18014398509481984, "-18014398509481984", "-0x40000000000000", "-0o1000000000000000000", "-0b1000000000000000000000000000000000000000000000000000000"), + nc(-18014398509481983, "-18014398509481983", "-0x3fffffffffffff", "-0o777777777777777777", "-0b111111111111111111111111111111111111111111111111111111"), + nc(-10000000000000001, "-10000000000000001", "-0x2386f26fc10001", "-0o434157115760200001", "-0b100011100001101111001001101111110000010000000000000001"), + nc(-10000000000000000, "-10000000000000000", "-0x2386f26fc10000", "-0o434157115760200000", "-0b100011100001101111001001101111110000010000000000000000"), + nc(-9999999999999999, "-9999999999999999", "-0x2386f26fc0ffff", "-0o434157115760177777", "-0b100011100001101111001001101111110000001111111111111111"), + nc(-9223372036854776, "-9223372036854776", "-0x20c49ba5e353f8", "-0o406111564570651770", "-0b100000110001001001101110100101111000110101001111111000"), + nc(-9007199254740993, "-9007199254740993", "-0x20000000000001", "-0o400000000000000001", "-0b100000000000000000000000000000000000000000000000000001"), + nc(-9007199254740992, "-9007199254740992", "-0x20000000000000", "-0o400000000000000000", "-0b100000000000000000000000000000000000000000000000000000"), + nc(-9007199254740991, "-9007199254740991", "-0x1fffffffffffff", "-0o377777777777777777", "-0b11111111111111111111111111111111111111111111111111111"), + nc(-4503599627370497, "-4503599627370497", "-0x10000000000001", "-0o200000000000000001", "-0b10000000000000000000000000000000000000000000000000001"), + nc(-4503599627370496, "-4503599627370496", "-0x10000000000000", "-0o200000000000000000", "-0b10000000000000000000000000000000000000000000000000000"), + nc(-4503599627370495, "-4503599627370495", "-0xfffffffffffff", "-0o177777777777777777", "-0b1111111111111111111111111111111111111111111111111111"), + nc(-2251799813685249, "-2251799813685249", "-0x8000000000001", "-0o100000000000000001", "-0b1000000000000000000000000000000000000000000000000001"), + nc(-2251799813685248, "-2251799813685248", "-0x8000000000000", "-0o100000000000000000", "-0b1000000000000000000000000000000000000000000000000000"), + nc(-2251799813685247, "-2251799813685247", "-0x7ffffffffffff", "-0o77777777777777777", "-0b111111111111111111111111111111111111111111111111111"), + nc(-1125899906842625, "-1125899906842625", "-0x4000000000001", "-0o40000000000000001", "-0b100000000000000000000000000000000000000000000000001"), + nc(-1125899906842624, "-1125899906842624", "-0x4000000000000", "-0o40000000000000000", "-0b100000000000000000000000000000000000000000000000000"), + nc(-1125899906842623, "-1125899906842623", "-0x3ffffffffffff", "-0o37777777777777777", "-0b11111111111111111111111111111111111111111111111111"), + nc(-1000000000000001, "-1000000000000001", "-0x38d7ea4c68001", "-0o34327724461500001", "-0b11100011010111111010100100110001101000000000000001"), + nc(-1000000000000000, "-1000000000000000", "-0x38d7ea4c68000", "-0o34327724461500000", "-0b11100011010111111010100100110001101000000000000000"), + nc(-999999999999999, "-999999999999999", "-0x38d7ea4c67fff", "-0o34327724461477777", "-0b11100011010111111010100100110001100111111111111111"), + nc(-922337203685477, "-922337203685477", "-0x346dc5d638865", "-0o32155613530704145", "-0b11010001101101110001011101011000111000100001100101"), + nc(-562949953421313, "-562949953421313", "-0x2000000000001", "-0o20000000000000001", "-0b10000000000000000000000000000000000000000000000001"), + nc(-562949953421312, "-562949953421312", "-0x2000000000000", "-0o20000000000000000", "-0b10000000000000000000000000000000000000000000000000"), + nc(-562949953421311, "-562949953421311", "-0x1ffffffffffff", "-0o17777777777777777", "-0b1111111111111111111111111111111111111111111111111"), + nc(-281474976710657, "-281474976710657", "-0x1000000000001", "-0o10000000000000001", "-0b1000000000000000000000000000000000000000000000001"), + nc(-281474976710656, "-281474976710656", "-0x1000000000000", "-0o10000000000000000", "-0b1000000000000000000000000000000000000000000000000"), + nc(-281474976710655, "-281474976710655", "-0xffffffffffff", "-0o7777777777777777", "-0b111111111111111111111111111111111111111111111111"), + nc(-140737488355329, "-140737488355329", "-0x800000000001", "-0o4000000000000001", "-0b100000000000000000000000000000000000000000000001"), + nc(-140737488355328, "-140737488355328", "-0x800000000000", "-0o4000000000000000", "-0b100000000000000000000000000000000000000000000000"), + nc(-140737488355327, "-140737488355327", "-0x7fffffffffff", "-0o3777777777777777", "-0b11111111111111111111111111111111111111111111111"), + nc(-100000000000001, "-100000000000001", "-0x5af3107a4001", "-0o2657142036440001", "-0b10110101111001100010000011110100100000000000001"), + nc(-100000000000000, "-100000000000000", "-0x5af3107a4000", "-0o2657142036440000", "-0b10110101111001100010000011110100100000000000000"), + nc(-99999999999999, "-99999999999999", "-0x5af3107a3fff", "-0o2657142036437777", "-0b10110101111001100010000011110100011111111111111"), + nc(-92233720368547, "-92233720368547", "-0x53e2d6238da3", "-0o2476132610706643", "-0b10100111110001011010110001000111000110110100011"), + nc(-70368744177665, "-70368744177665", "-0x400000000001", "-0o2000000000000001", "-0b10000000000000000000000000000000000000000000001"), + nc(-70368744177664, "-70368744177664", "-0x400000000000", "-0o2000000000000000", "-0b10000000000000000000000000000000000000000000000"), + nc(-70368744177663, "-70368744177663", "-0x3fffffffffff", "-0o1777777777777777", "-0b1111111111111111111111111111111111111111111111"), + nc(-35184372088833, "-35184372088833", "-0x200000000001", "-0o1000000000000001", "-0b1000000000000000000000000000000000000000000001"), + nc(-35184372088832, "-35184372088832", "-0x200000000000", "-0o1000000000000000", "-0b1000000000000000000000000000000000000000000000"), + nc(-35184372088831, "-35184372088831", "-0x1fffffffffff", "-0o777777777777777", "-0b111111111111111111111111111111111111111111111"), + nc(-17592186044417, "-17592186044417", "-0x100000000001", "-0o400000000000001", "-0b100000000000000000000000000000000000000000001"), + nc(-17592186044416, "-17592186044416", "-0x100000000000", "-0o400000000000000", "-0b100000000000000000000000000000000000000000000"), + nc(-17592186044415, "-17592186044415", "-0xfffffffffff", "-0o377777777777777", "-0b11111111111111111111111111111111111111111111"), + nc(-10000000000001, "-10000000000001", "-0x9184e72a001", "-0o221411634520001", "-0b10010001100001001110011100101010000000000001"), + nc(-10000000000000, "-10000000000000", "-0x9184e72a000", "-0o221411634520000", "-0b10010001100001001110011100101010000000000000"), + nc(-9999999999999, "-9999999999999", "-0x9184e729fff", "-0o221411634517777", "-0b10010001100001001110011100101001111111111111"), + nc(-9223372036854, "-9223372036854", "-0x8637bd05af6", "-0o206157364055366", "-0b10000110001101111011110100000101101011110110"), + nc(-8796093022209, "-8796093022209", "-0x80000000001", "-0o200000000000001", "-0b10000000000000000000000000000000000000000001"), + nc(-8796093022208, "-8796093022208", "-0x80000000000", "-0o200000000000000", "-0b10000000000000000000000000000000000000000000"), + nc(-8796093022207, "-8796093022207", "-0x7ffffffffff", "-0o177777777777777", "-0b1111111111111111111111111111111111111111111"), + nc(-4398046511105, "-4398046511105", "-0x40000000001", "-0o100000000000001", "-0b1000000000000000000000000000000000000000001"), + nc(-4398046511104, "-4398046511104", "-0x40000000000", "-0o100000000000000", "-0b1000000000000000000000000000000000000000000"), + nc(-4398046511103, "-4398046511103", "-0x3ffffffffff", "-0o77777777777777", "-0b111111111111111111111111111111111111111111"), + nc(-2199023255553, "-2199023255553", "-0x20000000001", "-0o40000000000001", "-0b100000000000000000000000000000000000000001"), + nc(-2199023255552, "-2199023255552", "-0x20000000000", "-0o40000000000000", "-0b100000000000000000000000000000000000000000"), + nc(-2199023255551, "-2199023255551", "-0x1ffffffffff", "-0o37777777777777", "-0b11111111111111111111111111111111111111111"), + nc(-1099511627777, "-1099511627777", "-0x10000000001", "-0o20000000000001", "-0b10000000000000000000000000000000000000001"), + nc(-1099511627776, "-1099511627776", "-0x10000000000", "-0o20000000000000", "-0b10000000000000000000000000000000000000000"), + nc(-1099511627775, "-1099511627775", "-0xffffffffff", "-0o17777777777777", "-0b1111111111111111111111111111111111111111"), + nc(-1000000000001, "-1000000000001", "-0xe8d4a51001", "-0o16432451210001", "-0b1110100011010100101001010001000000000001"), + nc(-1000000000000, "-1000000000000", "-0xe8d4a51000", "-0o16432451210000", "-0b1110100011010100101001010001000000000000"), + nc(-999999999999, "-999999999999", "-0xe8d4a50fff", "-0o16432451207777", "-0b1110100011010100101001010000111111111111"), + nc(-922337203685, "-922337203685", "-0xd6bf94d5e5", "-0o15327745152745", "-0b1101011010111111100101001101010111100101"), + nc(-549755813889, "-549755813889", "-0x8000000001", "-0o10000000000001", "-0b1000000000000000000000000000000000000001"), + nc(-549755813888, "-549755813888", "-0x8000000000", "-0o10000000000000", "-0b1000000000000000000000000000000000000000"), + nc(-549755813887, "-549755813887", "-0x7fffffffff", "-0o7777777777777", "-0b111111111111111111111111111111111111111"), + nc(-274877906945, "-274877906945", "-0x4000000001", "-0o4000000000001", "-0b100000000000000000000000000000000000001"), + nc(-274877906944, "-274877906944", "-0x4000000000", "-0o4000000000000", "-0b100000000000000000000000000000000000000"), + nc(-274877906943, "-274877906943", "-0x3fffffffff", "-0o3777777777777", "-0b11111111111111111111111111111111111111"), + nc(-137438953473, "-137438953473", "-0x2000000001", "-0o2000000000001", "-0b10000000000000000000000000000000000001"), + nc(-137438953472, "-137438953472", "-0x2000000000", "-0o2000000000000", "-0b10000000000000000000000000000000000000"), + nc(-137438953471, "-137438953471", "-0x1fffffffff", "-0o1777777777777", "-0b1111111111111111111111111111111111111"), + nc(-100000000001, "-100000000001", "-0x174876e801", "-0o1351035564001", "-0b1011101001000011101101110100000000001"), + nc(-100000000000, "-100000000000", "-0x174876e800", "-0o1351035564000", "-0b1011101001000011101101110100000000000"), + nc(-99999999999, "-99999999999", "-0x174876e7ff", "-0o1351035563777", "-0b1011101001000011101101110011111111111"), + nc(-92233720368, "-92233720368", "-0x15798ee230", "-0o1257143561060", "-0b1010101111001100011101110001000110000"), + nc(-68719476737, "-68719476737", "-0x1000000001", "-0o1000000000001", "-0b1000000000000000000000000000000000001"), + nc(-68719476736, "-68719476736", "-0x1000000000", "-0o1000000000000", "-0b1000000000000000000000000000000000000"), + nc(-68719476735, "-68719476735", "-0xfffffffff", "-0o777777777777", "-0b111111111111111111111111111111111111"), + nc(-34359738369, "-34359738369", "-0x800000001", "-0o400000000001", "-0b100000000000000000000000000000000001"), + nc(-34359738368, "-34359738368", "-0x800000000", "-0o400000000000", "-0b100000000000000000000000000000000000"), + nc(-34359738367, "-34359738367", "-0x7ffffffff", "-0o377777777777", "-0b11111111111111111111111111111111111"), + nc(-17179869185, "-17179869185", "-0x400000001", "-0o200000000001", "-0b10000000000000000000000000000000001"), + nc(-17179869184, "-17179869184", "-0x400000000", "-0o200000000000", "-0b10000000000000000000000000000000000"), + nc(-17179869183, "-17179869183", "-0x3ffffffff", "-0o177777777777", "-0b1111111111111111111111111111111111"), + nc(-10000000001, "-10000000001", "-0x2540be401", "-0o112402762001", "-0b1001010100000010111110010000000001"), + nc(-10000000000, "-10000000000", "-0x2540be400", "-0o112402762000", "-0b1001010100000010111110010000000000"), + nc(-9999999999, "-9999999999", "-0x2540be3ff", "-0o112402761777", "-0b1001010100000010111110001111111111"), + nc(-9223372036, "-9223372036", "-0x225c17d04", "-0o104560276404", "-0b1000100101110000010111110100000100"), + nc(-8589934593, "-8589934593", "-0x200000001", "-0o100000000001", "-0b1000000000000000000000000000000001"), + nc(-8589934592, "-8589934592", "-0x200000000", "-0o100000000000", "-0b1000000000000000000000000000000000"), + nc(-8589934591, "-8589934591", "-0x1ffffffff", "-0o77777777777", "-0b111111111111111111111111111111111"), + nc(-4294967297, "-4294967297", "-0x100000001", "-0o40000000001", "-0b100000000000000000000000000000001"), + nc(-4294967296, "-4294967296", "-0x100000000", "-0o40000000000", "-0b100000000000000000000000000000000"), + nc(-4294967295, "-4294967295", "-0xffffffff", "-0o37777777777", "-0b11111111111111111111111111111111"), + nc(-2147483649, "-2147483649", "-0x80000001", "-0o20000000001", "-0b10000000000000000000000000000001"), + nc(-2147483648, "-2147483648", "-0x80000000", "-0o20000000000", "-0b10000000000000000000000000000000"), + nc(-2147483647, "-2147483647", "-0x7fffffff", "-0o17777777777", "-0b1111111111111111111111111111111"), + nc(-1073741825, "-1073741825", "-0x40000001", "-0o10000000001", "-0b1000000000000000000000000000001"), + nc(-1073741824, "-1073741824", "-0x40000000", "-0o10000000000", "-0b1000000000000000000000000000000"), + nc(-1073741823, "-1073741823", "-0x3fffffff", "-0o7777777777", "-0b111111111111111111111111111111"), + nc(-1000000001, "-1000000001", "-0x3b9aca01", "-0o7346545001", "-0b111011100110101100101000000001"), + nc(-1000000000, "-1000000000", "-0x3b9aca00", "-0o7346545000", "-0b111011100110101100101000000000"), + nc(-999999999, "-999999999", "-0x3b9ac9ff", "-0o7346544777", "-0b111011100110101100100111111111"), + nc(-922337203, "-922337203", "-0x36f9bfb3", "-0o6676337663", "-0b110110111110011011111110110011"), + nc(-536870913, "-536870913", "-0x20000001", "-0o4000000001", "-0b100000000000000000000000000001"), + nc(-536870912, "-536870912", "-0x20000000", "-0o4000000000", "-0b100000000000000000000000000000"), + nc(-536870911, "-536870911", "-0x1fffffff", "-0o3777777777", "-0b11111111111111111111111111111"), + nc(-268435457, "-268435457", "-0x10000001", "-0o2000000001", "-0b10000000000000000000000000001"), + nc(-268435456, "-268435456", "-0x10000000", "-0o2000000000", "-0b10000000000000000000000000000"), + nc(-268435455, "-268435455", "-0xfffffff", "-0o1777777777", "-0b1111111111111111111111111111"), + nc(-134217729, "-134217729", "-0x8000001", "-0o1000000001", "-0b1000000000000000000000000001"), + nc(-134217728, "-134217728", "-0x8000000", "-0o1000000000", "-0b1000000000000000000000000000"), + nc(-134217727, "-134217727", "-0x7ffffff", "-0o777777777", "-0b111111111111111111111111111"), + nc(-100000001, "-100000001", "-0x5f5e101", "-0o575360401", "-0b101111101011110000100000001"), + nc(-100000000, "-100000000", "-0x5f5e100", "-0o575360400", "-0b101111101011110000100000000"), + nc(-99999999, "-99999999", "-0x5f5e0ff", "-0o575360377", "-0b101111101011110000011111111"), + nc(-92233720, "-92233720", "-0x57f5ff8", "-0o537657770", "-0b101011111110101111111111000"), + nc(-67108865, "-67108865", "-0x4000001", "-0o400000001", "-0b100000000000000000000000001"), + nc(-67108864, "-67108864", "-0x4000000", "-0o400000000", "-0b100000000000000000000000000"), + nc(-67108863, "-67108863", "-0x3ffffff", "-0o377777777", "-0b11111111111111111111111111"), + nc(-33554433, "-33554433", "-0x2000001", "-0o200000001", "-0b10000000000000000000000001"), + nc(-33554432, "-33554432", "-0x2000000", "-0o200000000", "-0b10000000000000000000000000"), + nc(-33554431, "-33554431", "-0x1ffffff", "-0o177777777", "-0b1111111111111111111111111"), + nc(-16777217, "-16777217", "-0x1000001", "-0o100000001", "-0b1000000000000000000000001"), + nc(-16777216, "-16777216", "-0x1000000", "-0o100000000", "-0b1000000000000000000000000"), + nc(-16777215, "-16777215", "-0xffffff", "-0o77777777", "-0b111111111111111111111111"), + nc(-10000001, "-10000001", "-0x989681", "-0o46113201", "-0b100110001001011010000001"), + nc(-10000000, "-10000000", "-0x989680", "-0o46113200", "-0b100110001001011010000000"), + nc(-9999999, "-9999999", "-0x98967f", "-0o46113177", "-0b100110001001011001111111"), + nc(-9223372, "-9223372", "-0x8cbccc", "-0o43136314", "-0b100011001011110011001100"), + nc(-8388609, "-8388609", "-0x800001", "-0o40000001", "-0b100000000000000000000001"), + nc(-8388608, "-8388608", "-0x800000", "-0o40000000", "-0b100000000000000000000000"), + nc(-8388607, "-8388607", "-0x7fffff", "-0o37777777", "-0b11111111111111111111111"), + nc(-4194305, "-4194305", "-0x400001", "-0o20000001", "-0b10000000000000000000001"), + nc(-4194304, "-4194304", "-0x400000", "-0o20000000", "-0b10000000000000000000000"), + nc(-4194303, "-4194303", "-0x3fffff", "-0o17777777", "-0b1111111111111111111111"), + nc(-2097153, "-2097153", "-0x200001", "-0o10000001", "-0b1000000000000000000001"), + nc(-2097152, "-2097152", "-0x200000", "-0o10000000", "-0b1000000000000000000000"), + nc(-2097151, "-2097151", "-0x1fffff", "-0o7777777", "-0b111111111111111111111"), + nc(-1048577, "-1048577", "-0x100001", "-0o4000001", "-0b100000000000000000001"), + nc(-1048576, "-1048576", "-0x100000", "-0o4000000", "-0b100000000000000000000"), + nc(-1048575, "-1048575", "-0xfffff", "-0o3777777", "-0b11111111111111111111"), + nc(-1000001, "-1000001", "-0xf4241", "-0o3641101", "-0b11110100001001000001"), + nc(-1000000, "-1000000", "-0xf4240", "-0o3641100", "-0b11110100001001000000"), + nc(-999999, "-999999", "-0xf423f", "-0o3641077", "-0b11110100001000111111"), + nc(-922337, "-922337", "-0xe12e1", "-0o3411341", "-0b11100001001011100001"), + nc(-524289, "-524289", "-0x80001", "-0o2000001", "-0b10000000000000000001"), + nc(-524288, "-524288", "-0x80000", "-0o2000000", "-0b10000000000000000000"), + nc(-524287, "-524287", "-0x7ffff", "-0o1777777", "-0b1111111111111111111"), + nc(-262145, "-262145", "-0x40001", "-0o1000001", "-0b1000000000000000001"), + nc(-262144, "-262144", "-0x40000", "-0o1000000", "-0b1000000000000000000"), + nc(-262143, "-262143", "-0x3ffff", "-0o777777", "-0b111111111111111111"), + nc(-131073, "-131073", "-0x20001", "-0o400001", "-0b100000000000000001"), + nc(-131072, "-131072", "-0x20000", "-0o400000", "-0b100000000000000000"), + nc(-131071, "-131071", "-0x1ffff", "-0o377777", "-0b11111111111111111"), + nc(-100001, "-100001", "-0x186a1", "-0o303241", "-0b11000011010100001"), + nc(-100000, "-100000", "-0x186a0", "-0o303240", "-0b11000011010100000"), + nc(-99999, "-99999", "-0x1869f", "-0o303237", "-0b11000011010011111"), + nc(-92233, "-92233", "-0x16849", "-0o264111", "-0b10110100001001001"), + nc(-65537, "-65537", "-0x10001", "-0o200001", "-0b10000000000000001"), + nc(-65536, "-65536", "-0x10000", "-0o200000", "-0b10000000000000000"), + nc(-65535, "-65535", "-0xffff", "-0o177777", "-0b1111111111111111"), + nc(-32769, "-32769", "-0x8001", "-0o100001", "-0b1000000000000001"), + nc(-32768, "-32768", "-0x8000", "-0o100000", "-0b1000000000000000"), + nc(-32767, "-32767", "-0x7fff", "-0o77777", "-0b111111111111111"), + nc(-16385, "-16385", "-0x4001", "-0o40001", "-0b100000000000001"), + nc(-16384, "-16384", "-0x4000", "-0o40000", "-0b100000000000000"), + nc(-16383, "-16383", "-0x3fff", "-0o37777", "-0b11111111111111"), + nc(-10001, "-10001", "-0x2711", "-0o23421", "-0b10011100010001"), + nc(-10000, "-10000", "-0x2710", "-0o23420", "-0b10011100010000"), + nc(-9999, "-9999", "-0x270f", "-0o23417", "-0b10011100001111"), + nc(-9223, "-9223", "-0x2407", "-0o22007", "-0b10010000000111"), + nc(-8193, "-8193", "-0x2001", "-0o20001", "-0b10000000000001"), + nc(-8192, "-8192", "-0x2000", "-0o20000", "-0b10000000000000"), + nc(-8191, "-8191", "-0x1fff", "-0o17777", "-0b1111111111111"), + nc(-4097, "-4097", "-0x1001", "-0o10001", "-0b1000000000001"), + nc(-4096, "-4096", "-0x1000", "-0o10000", "-0b1000000000000"), + nc(-4095, "-4095", "-0xfff", "-0o7777", "-0b111111111111"), + nc(-2049, "-2049", "-0x801", "-0o4001", "-0b100000000001"), + nc(-2048, "-2048", "-0x800", "-0o4000", "-0b100000000000"), + nc(-2047, "-2047", "-0x7ff", "-0o3777", "-0b11111111111"), + nc(-1025, "-1025", "-0x401", "-0o2001", "-0b10000000001"), + nc(-1024, "-1024", "-0x400", "-0o2000", "-0b10000000000"), + nc(-1023, "-1023", "-0x3ff", "-0o1777", "-0b1111111111"), + nc(-1001, "-1001", "-0x3e9", "-0o1751", "-0b1111101001"), + nc(-1000, "-1000", "-0x3e8", "-0o1750", "-0b1111101000"), + nc(-999, "-999", "-0x3e7", "-0o1747", "-0b1111100111"), + nc(-922, "-922", "-0x39a", "-0o1632", "-0b1110011010"), + nc(-513, "-513", "-0x201", "-0o1001", "-0b1000000001"), + nc(-512, "-512", "-0x200", "-0o1000", "-0b1000000000"), + nc(-511, "-511", "-0x1ff", "-0o777", "-0b111111111"), + nc(-257, "-257", "-0x101", "-0o401", "-0b100000001"), + nc(-256, "-256", "-0x100", "-0o400", "-0b100000000"), + nc(-255, "-255", "-0xff", "-0o377", "-0b11111111"), + nc(-129, "-129", "-0x81", "-0o201", "-0b10000001"), + nc(-128, "-128", "-0x80", "-0o200", "-0b10000000"), + nc(-127, "-127", "-0x7f", "-0o177", "-0b1111111"), + nc(-101, "-101", "-0x65", "-0o145", "-0b1100101"), + nc(-100, "-100", "-0x64", "-0o144", "-0b1100100"), + nc(-99, "-99", "-0x63", "-0o143", "-0b1100011"), + nc(-92, "-92", "-0x5c", "-0o134", "-0b1011100"), + nc(-65, "-65", "-0x41", "-0o101", "-0b1000001"), + nc(-64, "-64", "-0x40", "-0o100", "-0b1000000"), + nc(-63, "-63", "-0x3f", "-0o77", "-0b111111"), + nc(-33, "-33", "-0x21", "-0o41", "-0b100001"), + nc(-32, "-32", "-0x20", "-0o40", "-0b100000"), + nc(-31, "-31", "-0x1f", "-0o37", "-0b11111"), + nc(-17, "-17", "-0x11", "-0o21", "-0b10001"), + nc(-16, "-16", "-0x10", "-0o20", "-0b10000"), + nc(-15, "-15", "-0xf", "-0o17", "-0b1111"), + nc(-11, "-11", "-0xb", "-0o13", "-0b1011"), + nc(-10, "-10", "-0xa", "-0o12", "-0b1010"), + nc(-9, "-9", "-0x9", "-0o11", "-0b1001"), + nc(-8, "-8", "-0x8", "-0o10", "-0b1000"), + nc(-7, "-7", "-0x7", "-0o7", "-0b111"), + nc(-6, "-6", "-0x6", "-0o6", "-0b110"), + nc(-5, "-5", "-0x5", "-0o5", "-0b101"), + nc(-4, "-4", "-0x4", "-0o4", "-0b100"), + nc(-3, "-3", "-0x3", "-0o3", "-0b11"), + nc(-2, "-2", "-0x2", "-0o2", "-0b10"), + nc(-1, "-1", "-0x1", "-0o1", "-0b1"), + nc(0, "0", "0x0", "0o0", "0b0"), + nc(1, "1", "0x1", "0o1", "0b1"), + nc(2, "2", "0x2", "0o2", "0b10"), + nc(3, "3", "0x3", "0o3", "0b11"), + nc(4, "4", "0x4", "0o4", "0b100"), + nc(5, "5", "0x5", "0o5", "0b101"), + nc(6, "6", "0x6", "0o6", "0b110"), + nc(7, "7", "0x7", "0o7", "0b111"), + nc(8, "8", "0x8", "0o10", "0b1000"), + nc(9, "9", "0x9", "0o11", "0b1001"), + nc(10, "10", "0xa", "0o12", "0b1010"), + nc(11, "11", "0xb", "0o13", "0b1011"), + nc(15, "15", "0xf", "0o17", "0b1111"), + nc(16, "16", "0x10", "0o20", "0b10000"), + nc(17, "17", "0x11", "0o21", "0b10001"), + nc(31, "31", "0x1f", "0o37", "0b11111"), + nc(32, "32", "0x20", "0o40", "0b100000"), + nc(33, "33", "0x21", "0o41", "0b100001"), + nc(63, "63", "0x3f", "0o77", "0b111111"), + nc(64, "64", "0x40", "0o100", "0b1000000"), + nc(65, "65", "0x41", "0o101", "0b1000001"), + nc(91, "91", "0x5b", "0o133", "0b1011011"), + nc(92, "92", "0x5c", "0o134", "0b1011100"), + nc(93, "93", "0x5d", "0o135", "0b1011101"), + nc(99, "99", "0x63", "0o143", "0b1100011"), + nc(100, "100", "0x64", "0o144", "0b1100100"), + nc(101, "101", "0x65", "0o145", "0b1100101"), + nc(127, "127", "0x7f", "0o177", "0b1111111"), + nc(128, "128", "0x80", "0o200", "0b10000000"), + nc(129, "129", "0x81", "0o201", "0b10000001"), + nc(255, "255", "0xff", "0o377", "0b11111111"), + nc(256, "256", "0x100", "0o400", "0b100000000"), + nc(257, "257", "0x101", "0o401", "0b100000001"), + nc(511, "511", "0x1ff", "0o777", "0b111111111"), + nc(512, "512", "0x200", "0o1000", "0b1000000000"), + nc(513, "513", "0x201", "0o1001", "0b1000000001"), + nc(921, "921", "0x399", "0o1631", "0b1110011001"), + nc(922, "922", "0x39a", "0o1632", "0b1110011010"), + nc(923, "923", "0x39b", "0o1633", "0b1110011011"), + nc(999, "999", "0x3e7", "0o1747", "0b1111100111"), + nc(1000, "1000", "0x3e8", "0o1750", "0b1111101000"), + nc(1001, "1001", "0x3e9", "0o1751", "0b1111101001"), + nc(1023, "1023", "0x3ff", "0o1777", "0b1111111111"), + nc(1024, "1024", "0x400", "0o2000", "0b10000000000"), + nc(1025, "1025", "0x401", "0o2001", "0b10000000001"), + nc(2047, "2047", "0x7ff", "0o3777", "0b11111111111"), + nc(2048, "2048", "0x800", "0o4000", "0b100000000000"), + nc(2049, "2049", "0x801", "0o4001", "0b100000000001"), + nc(4095, "4095", "0xfff", "0o7777", "0b111111111111"), + nc(4096, "4096", "0x1000", "0o10000", "0b1000000000000"), + nc(4097, "4097", "0x1001", "0o10001", "0b1000000000001"), + nc(8191, "8191", "0x1fff", "0o17777", "0b1111111111111"), + nc(8192, "8192", "0x2000", "0o20000", "0b10000000000000"), + nc(8193, "8193", "0x2001", "0o20001", "0b10000000000001"), + nc(9222, "9222", "0x2406", "0o22006", "0b10010000000110"), + nc(9223, "9223", "0x2407", "0o22007", "0b10010000000111"), + nc(9224, "9224", "0x2408", "0o22010", "0b10010000001000"), + nc(9999, "9999", "0x270f", "0o23417", "0b10011100001111"), + nc(10000, "10000", "0x2710", "0o23420", "0b10011100010000"), + nc(10001, "10001", "0x2711", "0o23421", "0b10011100010001"), + nc(16383, "16383", "0x3fff", "0o37777", "0b11111111111111"), + nc(16384, "16384", "0x4000", "0o40000", "0b100000000000000"), + nc(16385, "16385", "0x4001", "0o40001", "0b100000000000001"), + nc(32767, "32767", "0x7fff", "0o77777", "0b111111111111111"), + nc(32768, "32768", "0x8000", "0o100000", "0b1000000000000000"), + nc(32769, "32769", "0x8001", "0o100001", "0b1000000000000001"), + nc(65535, "65535", "0xffff", "0o177777", "0b1111111111111111"), + nc(65536, "65536", "0x10000", "0o200000", "0b10000000000000000"), + nc(65537, "65537", "0x10001", "0o200001", "0b10000000000000001"), + nc(92232, "92232", "0x16848", "0o264110", "0b10110100001001000"), + nc(92233, "92233", "0x16849", "0o264111", "0b10110100001001001"), + nc(92234, "92234", "0x1684a", "0o264112", "0b10110100001001010"), + nc(99999, "99999", "0x1869f", "0o303237", "0b11000011010011111"), + nc(100000, "100000", "0x186a0", "0o303240", "0b11000011010100000"), + nc(100001, "100001", "0x186a1", "0o303241", "0b11000011010100001"), + nc(131071, "131071", "0x1ffff", "0o377777", "0b11111111111111111"), + nc(131072, "131072", "0x20000", "0o400000", "0b100000000000000000"), + nc(131073, "131073", "0x20001", "0o400001", "0b100000000000000001"), + nc(262143, "262143", "0x3ffff", "0o777777", "0b111111111111111111"), + nc(262144, "262144", "0x40000", "0o1000000", "0b1000000000000000000"), + nc(262145, "262145", "0x40001", "0o1000001", "0b1000000000000000001"), + nc(524287, "524287", "0x7ffff", "0o1777777", "0b1111111111111111111"), + nc(524288, "524288", "0x80000", "0o2000000", "0b10000000000000000000"), + nc(524289, "524289", "0x80001", "0o2000001", "0b10000000000000000001"), + nc(922336, "922336", "0xe12e0", "0o3411340", "0b11100001001011100000"), + nc(922337, "922337", "0xe12e1", "0o3411341", "0b11100001001011100001"), + nc(922338, "922338", "0xe12e2", "0o3411342", "0b11100001001011100010"), + nc(999999, "999999", "0xf423f", "0o3641077", "0b11110100001000111111"), + nc(1000000, "1000000", "0xf4240", "0o3641100", "0b11110100001001000000"), + nc(1000001, "1000001", "0xf4241", "0o3641101", "0b11110100001001000001"), + nc(1048575, "1048575", "0xfffff", "0o3777777", "0b11111111111111111111"), + nc(1048576, "1048576", "0x100000", "0o4000000", "0b100000000000000000000"), + nc(1048577, "1048577", "0x100001", "0o4000001", "0b100000000000000000001"), + nc(2097151, "2097151", "0x1fffff", "0o7777777", "0b111111111111111111111"), + nc(2097152, "2097152", "0x200000", "0o10000000", "0b1000000000000000000000"), + nc(2097153, "2097153", "0x200001", "0o10000001", "0b1000000000000000000001"), + nc(4194303, "4194303", "0x3fffff", "0o17777777", "0b1111111111111111111111"), + nc(4194304, "4194304", "0x400000", "0o20000000", "0b10000000000000000000000"), + nc(4194305, "4194305", "0x400001", "0o20000001", "0b10000000000000000000001"), + nc(8388607, "8388607", "0x7fffff", "0o37777777", "0b11111111111111111111111"), + nc(8388608, "8388608", "0x800000", "0o40000000", "0b100000000000000000000000"), + nc(8388609, "8388609", "0x800001", "0o40000001", "0b100000000000000000000001"), + nc(9223371, "9223371", "0x8cbccb", "0o43136313", "0b100011001011110011001011"), + nc(9223372, "9223372", "0x8cbccc", "0o43136314", "0b100011001011110011001100"), + nc(9223373, "9223373", "0x8cbccd", "0o43136315", "0b100011001011110011001101"), + nc(9999999, "9999999", "0x98967f", "0o46113177", "0b100110001001011001111111"), + nc(10000000, "10000000", "0x989680", "0o46113200", "0b100110001001011010000000"), + nc(10000001, "10000001", "0x989681", "0o46113201", "0b100110001001011010000001"), + nc(16777215, "16777215", "0xffffff", "0o77777777", "0b111111111111111111111111"), + nc(16777216, "16777216", "0x1000000", "0o100000000", "0b1000000000000000000000000"), + nc(16777217, "16777217", "0x1000001", "0o100000001", "0b1000000000000000000000001"), + nc(33554431, "33554431", "0x1ffffff", "0o177777777", "0b1111111111111111111111111"), + nc(33554432, "33554432", "0x2000000", "0o200000000", "0b10000000000000000000000000"), + nc(33554433, "33554433", "0x2000001", "0o200000001", "0b10000000000000000000000001"), + nc(67108863, "67108863", "0x3ffffff", "0o377777777", "0b11111111111111111111111111"), + nc(67108864, "67108864", "0x4000000", "0o400000000", "0b100000000000000000000000000"), + nc(67108865, "67108865", "0x4000001", "0o400000001", "0b100000000000000000000000001"), + nc(92233719, "92233719", "0x57f5ff7", "0o537657767", "0b101011111110101111111110111"), + nc(92233720, "92233720", "0x57f5ff8", "0o537657770", "0b101011111110101111111111000"), + nc(92233721, "92233721", "0x57f5ff9", "0o537657771", "0b101011111110101111111111001"), + nc(99999999, "99999999", "0x5f5e0ff", "0o575360377", "0b101111101011110000011111111"), + nc(100000000, "100000000", "0x5f5e100", "0o575360400", "0b101111101011110000100000000"), + nc(100000001, "100000001", "0x5f5e101", "0o575360401", "0b101111101011110000100000001"), + nc(134217727, "134217727", "0x7ffffff", "0o777777777", "0b111111111111111111111111111"), + nc(134217728, "134217728", "0x8000000", "0o1000000000", "0b1000000000000000000000000000"), + nc(134217729, "134217729", "0x8000001", "0o1000000001", "0b1000000000000000000000000001"), + nc(268435455, "268435455", "0xfffffff", "0o1777777777", "0b1111111111111111111111111111"), + nc(268435456, "268435456", "0x10000000", "0o2000000000", "0b10000000000000000000000000000"), + nc(268435457, "268435457", "0x10000001", "0o2000000001", "0b10000000000000000000000000001"), + nc(536870911, "536870911", "0x1fffffff", "0o3777777777", "0b11111111111111111111111111111"), + nc(536870912, "536870912", "0x20000000", "0o4000000000", "0b100000000000000000000000000000"), + nc(536870913, "536870913", "0x20000001", "0o4000000001", "0b100000000000000000000000000001"), + nc(922337202, "922337202", "0x36f9bfb2", "0o6676337662", "0b110110111110011011111110110010"), + nc(922337203, "922337203", "0x36f9bfb3", "0o6676337663", "0b110110111110011011111110110011"), + nc(922337204, "922337204", "0x36f9bfb4", "0o6676337664", "0b110110111110011011111110110100"), + nc(999999999, "999999999", "0x3b9ac9ff", "0o7346544777", "0b111011100110101100100111111111"), + nc(1000000000, "1000000000", "0x3b9aca00", "0o7346545000", "0b111011100110101100101000000000"), + nc(1000000001, "1000000001", "0x3b9aca01", "0o7346545001", "0b111011100110101100101000000001"), + nc(1073741823, "1073741823", "0x3fffffff", "0o7777777777", "0b111111111111111111111111111111"), + nc(1073741824, "1073741824", "0x40000000", "0o10000000000", "0b1000000000000000000000000000000"), + nc(1073741825, "1073741825", "0x40000001", "0o10000000001", "0b1000000000000000000000000000001"), + nc(2147483647, "2147483647", "0x7fffffff", "0o17777777777", "0b1111111111111111111111111111111"), + nc(2147483648, "2147483648", "0x80000000", "0o20000000000", "0b10000000000000000000000000000000"), + nc(2147483649, "2147483649", "0x80000001", "0o20000000001", "0b10000000000000000000000000000001"), + nc(4294967295, "4294967295", "0xffffffff", "0o37777777777", "0b11111111111111111111111111111111"), + nc(4294967296, "4294967296", "0x100000000", "0o40000000000", "0b100000000000000000000000000000000"), + nc(4294967297, "4294967297", "0x100000001", "0o40000000001", "0b100000000000000000000000000000001"), + nc(8589934591, "8589934591", "0x1ffffffff", "0o77777777777", "0b111111111111111111111111111111111"), + nc(8589934592, "8589934592", "0x200000000", "0o100000000000", "0b1000000000000000000000000000000000"), + nc(8589934593, "8589934593", "0x200000001", "0o100000000001", "0b1000000000000000000000000000000001"), + nc(9223372035, "9223372035", "0x225c17d03", "0o104560276403", "0b1000100101110000010111110100000011"), + nc(9223372036, "9223372036", "0x225c17d04", "0o104560276404", "0b1000100101110000010111110100000100"), + nc(9223372037, "9223372037", "0x225c17d05", "0o104560276405", "0b1000100101110000010111110100000101"), + nc(9999999999, "9999999999", "0x2540be3ff", "0o112402761777", "0b1001010100000010111110001111111111"), + nc(10000000000, "10000000000", "0x2540be400", "0o112402762000", "0b1001010100000010111110010000000000"), + nc(10000000001, "10000000001", "0x2540be401", "0o112402762001", "0b1001010100000010111110010000000001"), + nc(17179869183, "17179869183", "0x3ffffffff", "0o177777777777", "0b1111111111111111111111111111111111"), + nc(17179869184, "17179869184", "0x400000000", "0o200000000000", "0b10000000000000000000000000000000000"), + nc(17179869185, "17179869185", "0x400000001", "0o200000000001", "0b10000000000000000000000000000000001"), + nc(34359738367, "34359738367", "0x7ffffffff", "0o377777777777", "0b11111111111111111111111111111111111"), + nc(34359738368, "34359738368", "0x800000000", "0o400000000000", "0b100000000000000000000000000000000000"), + nc(34359738369, "34359738369", "0x800000001", "0o400000000001", "0b100000000000000000000000000000000001"), + nc(68719476735, "68719476735", "0xfffffffff", "0o777777777777", "0b111111111111111111111111111111111111"), + nc(68719476736, "68719476736", "0x1000000000", "0o1000000000000", "0b1000000000000000000000000000000000000"), + nc(68719476737, "68719476737", "0x1000000001", "0o1000000000001", "0b1000000000000000000000000000000000001"), + nc(92233720367, "92233720367", "0x15798ee22f", "0o1257143561057", "0b1010101111001100011101110001000101111"), + nc(92233720368, "92233720368", "0x15798ee230", "0o1257143561060", "0b1010101111001100011101110001000110000"), + nc(92233720369, "92233720369", "0x15798ee231", "0o1257143561061", "0b1010101111001100011101110001000110001"), + nc(99999999999, "99999999999", "0x174876e7ff", "0o1351035563777", "0b1011101001000011101101110011111111111"), + nc(100000000000, "100000000000", "0x174876e800", "0o1351035564000", "0b1011101001000011101101110100000000000"), + nc(100000000001, "100000000001", "0x174876e801", "0o1351035564001", "0b1011101001000011101101110100000000001"), + nc(137438953471, "137438953471", "0x1fffffffff", "0o1777777777777", "0b1111111111111111111111111111111111111"), + nc(137438953472, "137438953472", "0x2000000000", "0o2000000000000", "0b10000000000000000000000000000000000000"), + nc(137438953473, "137438953473", "0x2000000001", "0o2000000000001", "0b10000000000000000000000000000000000001"), + nc(274877906943, "274877906943", "0x3fffffffff", "0o3777777777777", "0b11111111111111111111111111111111111111"), + nc(274877906944, "274877906944", "0x4000000000", "0o4000000000000", "0b100000000000000000000000000000000000000"), + nc(274877906945, "274877906945", "0x4000000001", "0o4000000000001", "0b100000000000000000000000000000000000001"), + nc(549755813887, "549755813887", "0x7fffffffff", "0o7777777777777", "0b111111111111111111111111111111111111111"), + nc(549755813888, "549755813888", "0x8000000000", "0o10000000000000", "0b1000000000000000000000000000000000000000"), + nc(549755813889, "549755813889", "0x8000000001", "0o10000000000001", "0b1000000000000000000000000000000000000001"), + nc(922337203684, "922337203684", "0xd6bf94d5e4", "0o15327745152744", "0b1101011010111111100101001101010111100100"), + nc(922337203685, "922337203685", "0xd6bf94d5e5", "0o15327745152745", "0b1101011010111111100101001101010111100101"), + nc(922337203686, "922337203686", "0xd6bf94d5e6", "0o15327745152746", "0b1101011010111111100101001101010111100110"), + nc(999999999999, "999999999999", "0xe8d4a50fff", "0o16432451207777", "0b1110100011010100101001010000111111111111"), + nc(1000000000000, "1000000000000", "0xe8d4a51000", "0o16432451210000", "0b1110100011010100101001010001000000000000"), + nc(1000000000001, "1000000000001", "0xe8d4a51001", "0o16432451210001", "0b1110100011010100101001010001000000000001"), + nc(1099511627775, "1099511627775", "0xffffffffff", "0o17777777777777", "0b1111111111111111111111111111111111111111"), + nc(1099511627776, "1099511627776", "0x10000000000", "0o20000000000000", "0b10000000000000000000000000000000000000000"), + nc(1099511627777, "1099511627777", "0x10000000001", "0o20000000000001", "0b10000000000000000000000000000000000000001"), + nc(2199023255551, "2199023255551", "0x1ffffffffff", "0o37777777777777", "0b11111111111111111111111111111111111111111"), + nc(2199023255552, "2199023255552", "0x20000000000", "0o40000000000000", "0b100000000000000000000000000000000000000000"), + nc(2199023255553, "2199023255553", "0x20000000001", "0o40000000000001", "0b100000000000000000000000000000000000000001"), + nc(4398046511103, "4398046511103", "0x3ffffffffff", "0o77777777777777", "0b111111111111111111111111111111111111111111"), + nc(4398046511104, "4398046511104", "0x40000000000", "0o100000000000000", "0b1000000000000000000000000000000000000000000"), + nc(4398046511105, "4398046511105", "0x40000000001", "0o100000000000001", "0b1000000000000000000000000000000000000000001"), + nc(8796093022207, "8796093022207", "0x7ffffffffff", "0o177777777777777", "0b1111111111111111111111111111111111111111111"), + nc(8796093022208, "8796093022208", "0x80000000000", "0o200000000000000", "0b10000000000000000000000000000000000000000000"), + nc(8796093022209, "8796093022209", "0x80000000001", "0o200000000000001", "0b10000000000000000000000000000000000000000001"), + nc(9223372036853, "9223372036853", "0x8637bd05af5", "0o206157364055365", "0b10000110001101111011110100000101101011110101"), + nc(9223372036854, "9223372036854", "0x8637bd05af6", "0o206157364055366", "0b10000110001101111011110100000101101011110110"), + nc(9223372036855, "9223372036855", "0x8637bd05af7", "0o206157364055367", "0b10000110001101111011110100000101101011110111"), + nc(9999999999999, "9999999999999", "0x9184e729fff", "0o221411634517777", "0b10010001100001001110011100101001111111111111"), + nc(10000000000000, "10000000000000", "0x9184e72a000", "0o221411634520000", "0b10010001100001001110011100101010000000000000"), + nc(10000000000001, "10000000000001", "0x9184e72a001", "0o221411634520001", "0b10010001100001001110011100101010000000000001"), + nc(17592186044415, "17592186044415", "0xfffffffffff", "0o377777777777777", "0b11111111111111111111111111111111111111111111"), + nc(17592186044416, "17592186044416", "0x100000000000", "0o400000000000000", "0b100000000000000000000000000000000000000000000"), + nc(17592186044417, "17592186044417", "0x100000000001", "0o400000000000001", "0b100000000000000000000000000000000000000000001"), + nc(35184372088831, "35184372088831", "0x1fffffffffff", "0o777777777777777", "0b111111111111111111111111111111111111111111111"), + nc(35184372088832, "35184372088832", "0x200000000000", "0o1000000000000000", "0b1000000000000000000000000000000000000000000000"), + nc(35184372088833, "35184372088833", "0x200000000001", "0o1000000000000001", "0b1000000000000000000000000000000000000000000001"), + nc(70368744177663, "70368744177663", "0x3fffffffffff", "0o1777777777777777", "0b1111111111111111111111111111111111111111111111"), + nc(70368744177664, "70368744177664", "0x400000000000", "0o2000000000000000", "0b10000000000000000000000000000000000000000000000"), + nc(70368744177665, "70368744177665", "0x400000000001", "0o2000000000000001", "0b10000000000000000000000000000000000000000000001"), + nc(92233720368546, "92233720368546", "0x53e2d6238da2", "0o2476132610706642", "0b10100111110001011010110001000111000110110100010"), + nc(92233720368547, "92233720368547", "0x53e2d6238da3", "0o2476132610706643", "0b10100111110001011010110001000111000110110100011"), + nc(92233720368548, "92233720368548", "0x53e2d6238da4", "0o2476132610706644", "0b10100111110001011010110001000111000110110100100"), + nc(99999999999999, "99999999999999", "0x5af3107a3fff", "0o2657142036437777", "0b10110101111001100010000011110100011111111111111"), + nc(100000000000000, "100000000000000", "0x5af3107a4000", "0o2657142036440000", "0b10110101111001100010000011110100100000000000000"), + nc(100000000000001, "100000000000001", "0x5af3107a4001", "0o2657142036440001", "0b10110101111001100010000011110100100000000000001"), + nc(140737488355327, "140737488355327", "0x7fffffffffff", "0o3777777777777777", "0b11111111111111111111111111111111111111111111111"), + nc(140737488355328, "140737488355328", "0x800000000000", "0o4000000000000000", "0b100000000000000000000000000000000000000000000000"), + nc(140737488355329, "140737488355329", "0x800000000001", "0o4000000000000001", "0b100000000000000000000000000000000000000000000001"), + nc(281474976710655, "281474976710655", "0xffffffffffff", "0o7777777777777777", "0b111111111111111111111111111111111111111111111111"), + nc(281474976710656, "281474976710656", "0x1000000000000", "0o10000000000000000", "0b1000000000000000000000000000000000000000000000000"), + nc(281474976710657, "281474976710657", "0x1000000000001", "0o10000000000000001", "0b1000000000000000000000000000000000000000000000001"), + nc(562949953421311, "562949953421311", "0x1ffffffffffff", "0o17777777777777777", "0b1111111111111111111111111111111111111111111111111"), + nc(562949953421312, "562949953421312", "0x2000000000000", "0o20000000000000000", "0b10000000000000000000000000000000000000000000000000"), + nc(562949953421313, "562949953421313", "0x2000000000001", "0o20000000000000001", "0b10000000000000000000000000000000000000000000000001"), + nc(922337203685476, "922337203685476", "0x346dc5d638864", "0o32155613530704144", "0b11010001101101110001011101011000111000100001100100"), + nc(922337203685477, "922337203685477", "0x346dc5d638865", "0o32155613530704145", "0b11010001101101110001011101011000111000100001100101"), + nc(922337203685478, "922337203685478", "0x346dc5d638866", "0o32155613530704146", "0b11010001101101110001011101011000111000100001100110"), + nc(999999999999999, "999999999999999", "0x38d7ea4c67fff", "0o34327724461477777", "0b11100011010111111010100100110001100111111111111111"), + nc(1000000000000000, "1000000000000000", "0x38d7ea4c68000", "0o34327724461500000", "0b11100011010111111010100100110001101000000000000000"), + nc(1000000000000001, "1000000000000001", "0x38d7ea4c68001", "0o34327724461500001", "0b11100011010111111010100100110001101000000000000001"), + nc(1125899906842623, "1125899906842623", "0x3ffffffffffff", "0o37777777777777777", "0b11111111111111111111111111111111111111111111111111"), + nc(1125899906842624, "1125899906842624", "0x4000000000000", "0o40000000000000000", "0b100000000000000000000000000000000000000000000000000"), + nc(1125899906842625, "1125899906842625", "0x4000000000001", "0o40000000000000001", "0b100000000000000000000000000000000000000000000000001"), + nc(2251799813685247, "2251799813685247", "0x7ffffffffffff", "0o77777777777777777", "0b111111111111111111111111111111111111111111111111111"), + nc(2251799813685248, "2251799813685248", "0x8000000000000", "0o100000000000000000", "0b1000000000000000000000000000000000000000000000000000"), + nc(2251799813685249, "2251799813685249", "0x8000000000001", "0o100000000000000001", "0b1000000000000000000000000000000000000000000000000001"), + nc(4503599627370495, "4503599627370495", "0xfffffffffffff", "0o177777777777777777", "0b1111111111111111111111111111111111111111111111111111"), + nc(4503599627370496, "4503599627370496", "0x10000000000000", "0o200000000000000000", "0b10000000000000000000000000000000000000000000000000000"), + nc(4503599627370497, "4503599627370497", "0x10000000000001", "0o200000000000000001", "0b10000000000000000000000000000000000000000000000000001"), + nc(9007199254740991, "9007199254740991", "0x1fffffffffffff", "0o377777777777777777", "0b11111111111111111111111111111111111111111111111111111"), + nc(9007199254740992, "9007199254740992", "0x20000000000000", "0o400000000000000000", "0b100000000000000000000000000000000000000000000000000000"), + nc(9007199254740993, "9007199254740993", "0x20000000000001", "0o400000000000000001", "0b100000000000000000000000000000000000000000000000000001"), + nc(9223372036854775, "9223372036854775", "0x20c49ba5e353f7", "0o406111564570651767", "0b100000110001001001101110100101111000110101001111110111"), + nc(9223372036854776, "9223372036854776", "0x20c49ba5e353f8", "0o406111564570651770", "0b100000110001001001101110100101111000110101001111111000"), + nc(9223372036854777, "9223372036854777", "0x20c49ba5e353f9", "0o406111564570651771", "0b100000110001001001101110100101111000110101001111111001"), + nc(9999999999999999, "9999999999999999", "0x2386f26fc0ffff", "0o434157115760177777", "0b100011100001101111001001101111110000001111111111111111"), + nc(10000000000000000, "10000000000000000", "0x2386f26fc10000", "0o434157115760200000", "0b100011100001101111001001101111110000010000000000000000"), + nc(10000000000000001, "10000000000000001", "0x2386f26fc10001", "0o434157115760200001", "0b100011100001101111001001101111110000010000000000000001"), + nc(18014398509481983, "18014398509481983", "0x3fffffffffffff", "0o777777777777777777", "0b111111111111111111111111111111111111111111111111111111"), + nc(18014398509481984, "18014398509481984", "0x40000000000000", "0o1000000000000000000", "0b1000000000000000000000000000000000000000000000000000000"), + nc(18014398509481985, "18014398509481985", "0x40000000000001", "0o1000000000000000001", "0b1000000000000000000000000000000000000000000000000000001"), + nc(36028797018963967, "36028797018963967", "0x7fffffffffffff", "0o1777777777777777777", "0b1111111111111111111111111111111111111111111111111111111"), + nc(36028797018963968, "36028797018963968", "0x80000000000000", "0o2000000000000000000", "0b10000000000000000000000000000000000000000000000000000000"), + nc(36028797018963969, "36028797018963969", "0x80000000000001", "0o2000000000000000001", "0b10000000000000000000000000000000000000000000000000000001"), + nc(72057594037927935, "72057594037927935", "0xffffffffffffff", "0o3777777777777777777", "0b11111111111111111111111111111111111111111111111111111111"), + nc(72057594037927936, "72057594037927936", "0x100000000000000", "0o4000000000000000000", "0b100000000000000000000000000000000000000000000000000000000"), + nc(72057594037927937, "72057594037927937", "0x100000000000001", "0o4000000000000000001", "0b100000000000000000000000000000000000000000000000000000001"), + nc(92233720368547759, "92233720368547759", "0x147ae147ae147af", "0o5075341217270243657", "0b101000111101011100001010001111010111000010100011110101111"), + nc(92233720368547760, "92233720368547760", "0x147ae147ae147b0", "0o5075341217270243660", "0b101000111101011100001010001111010111000010100011110110000"), + nc(92233720368547761, "92233720368547761", "0x147ae147ae147b1", "0o5075341217270243661", "0b101000111101011100001010001111010111000010100011110110001"), + nc(99999999999999999, "99999999999999999", "0x16345785d89ffff", "0o5432127413542377777", "0b101100011010001010111100001011101100010011111111111111111"), + nc(100000000000000000, "100000000000000000", "0x16345785d8a0000", "0o5432127413542400000", "0b101100011010001010111100001011101100010100000000000000000"), + nc(100000000000000001, "100000000000000001", "0x16345785d8a0001", "0o5432127413542400001", "0b101100011010001010111100001011101100010100000000000000001"), + nc(144115188075855871, "144115188075855871", "0x1ffffffffffffff", "0o7777777777777777777", "0b111111111111111111111111111111111111111111111111111111111"), + nc(144115188075855872, "144115188075855872", "0x200000000000000", "0o10000000000000000000", "0b1000000000000000000000000000000000000000000000000000000000"), + nc(144115188075855873, "144115188075855873", "0x200000000000001", "0o10000000000000000001", "0b1000000000000000000000000000000000000000000000000000000001"), + nc(288230376151711743, "288230376151711743", "0x3ffffffffffffff", "0o17777777777777777777", "0b1111111111111111111111111111111111111111111111111111111111"), + nc(288230376151711744, "288230376151711744", "0x400000000000000", "0o20000000000000000000", "0b10000000000000000000000000000000000000000000000000000000000"), + nc(288230376151711745, "288230376151711745", "0x400000000000001", "0o20000000000000000001", "0b10000000000000000000000000000000000000000000000000000000001"), + nc(576460752303423487, "576460752303423487", "0x7ffffffffffffff", "0o37777777777777777777", "0b11111111111111111111111111111111111111111111111111111111111"), + nc(576460752303423488, "576460752303423488", "0x800000000000000", "0o40000000000000000000", "0b100000000000000000000000000000000000000000000000000000000000"), + nc(576460752303423489, "576460752303423489", "0x800000000000001", "0o40000000000000000001", "0b100000000000000000000000000000000000000000000000000000000001"), + nc(922337203685477631, "922337203685477631", "0xcccccccccccccff", "0o63146314631463146377", "0b110011001100110011001100110011001100110011001100110011111111"), + nc(922337203685477632, "922337203685477632", "0xccccccccccccd00", "0o63146314631463146400", "0b110011001100110011001100110011001100110011001100110100000000"), + nc(922337203685477633, "922337203685477633", "0xccccccccccccd01", "0o63146314631463146401", "0b110011001100110011001100110011001100110011001100110100000001"), + nc(999999999999999999, "999999999999999999", "0xde0b6b3a763ffff", "0o67405553164730777777", "0b110111100000101101101011001110100111011000111111111111111111"), + nc(1000000000000000000, "1000000000000000000", "0xde0b6b3a7640000", "0o67405553164731000000", "0b110111100000101101101011001110100111011001000000000000000000"), + nc(1000000000000000001, "1000000000000000001", "0xde0b6b3a7640001", "0o67405553164731000001", "0b110111100000101101101011001110100111011001000000000000000001"), + nc(1152921504606846975, "1152921504606846975", "0xfffffffffffffff", "0o77777777777777777777", "0b111111111111111111111111111111111111111111111111111111111111"), + nc(1152921504606846976, "1152921504606846976", "0x1000000000000000", "0o100000000000000000000", "0b1000000000000000000000000000000000000000000000000000000000000"), + nc(1152921504606846977, "1152921504606846977", "0x1000000000000001", "0o100000000000000000001", "0b1000000000000000000000000000000000000000000000000000000000001"), + nc(2305843009213693951, "2305843009213693951", "0x1fffffffffffffff", "0o177777777777777777777", "0b1111111111111111111111111111111111111111111111111111111111111"), + nc(2305843009213693952, "2305843009213693952", "0x2000000000000000", "0o200000000000000000000", "0b10000000000000000000000000000000000000000000000000000000000000"), + nc(2305843009213693953, "2305843009213693953", "0x2000000000000001", "0o200000000000000000001", "0b10000000000000000000000000000000000000000000000000000000000001"), + nc(4611686018427387903, "4611686018427387903", "0x3fffffffffffffff", "0o377777777777777777777", "0b11111111111111111111111111111111111111111111111111111111111111"), + nc(4611686018427387904, "4611686018427387904", "0x4000000000000000", "0o400000000000000000000", "0b100000000000000000000000000000000000000000000000000000000000000"), + nc(4611686018427387905, "4611686018427387905", "0x4000000000000001", "0o400000000000000000001", "0b100000000000000000000000000000000000000000000000000000000000001"), + nc(9223372036854775802, "9223372036854775802", "0x7ffffffffffffffa", "0o777777777777777777772", "0b111111111111111111111111111111111111111111111111111111111111010"), + nc(9223372036854775803, "9223372036854775803", "0x7ffffffffffffffb", "0o777777777777777777773", "0b111111111111111111111111111111111111111111111111111111111111011"), + nc(9223372036854775804, "9223372036854775804", "0x7ffffffffffffffc", "0o777777777777777777774", "0b111111111111111111111111111111111111111111111111111111111111100"), + nc(9223372036854775805, "9223372036854775805", "0x7ffffffffffffffd", "0o777777777777777777775", "0b111111111111111111111111111111111111111111111111111111111111101"), + nc(9223372036854775806, "9223372036854775806", "0x7ffffffffffffffe", "0o777777777777777777776", "0b111111111111111111111111111111111111111111111111111111111111110"), + nc(9223372036854775807, "9223372036854775807", "0x7fffffffffffffff", "0o777777777777777777777", "0b111111111111111111111111111111111111111111111111111111111111111"), +#undef nc + }; +}; + + +template<> +struct numbers<uint64_t> +{ + using value_type = uint64_t; + static C4_INLINE_CONSTEXPR const number_case<uint64_t> vals[] = { +#define nc(val, dec, hex, bin, oct) \ + number_case<value_type>{UINT64_C(val), csubstr{dec}, csubstr{hex}, csubstr{bin}, csubstr{oct}} + nc(0, "0", "0x0", "0o0", "0b0"), + nc(1, "1", "0x1", "0o1", "0b1"), + nc(2, "2", "0x2", "0o2", "0b10"), + nc(3, "3", "0x3", "0o3", "0b11"), + nc(4, "4", "0x4", "0o4", "0b100"), + nc(5, "5", "0x5", "0o5", "0b101"), + nc(6, "6", "0x6", "0o6", "0b110"), + nc(7, "7", "0x7", "0o7", "0b111"), + nc(8, "8", "0x8", "0o10", "0b1000"), + nc(9, "9", "0x9", "0o11", "0b1001"), + nc(10, "10", "0xa", "0o12", "0b1010"), + nc(11, "11", "0xb", "0o13", "0b1011"), + nc(15, "15", "0xf", "0o17", "0b1111"), + nc(16, "16", "0x10", "0o20", "0b10000"), + nc(17, "17", "0x11", "0o21", "0b10001"), + nc(18, "18", "0x12", "0o22", "0b10010"), + nc(19, "19", "0x13", "0o23", "0b10011"), + nc(31, "31", "0x1f", "0o37", "0b11111"), + nc(32, "32", "0x20", "0o40", "0b100000"), + nc(33, "33", "0x21", "0o41", "0b100001"), + nc(63, "63", "0x3f", "0o77", "0b111111"), + nc(64, "64", "0x40", "0o100", "0b1000000"), + nc(65, "65", "0x41", "0o101", "0b1000001"), + nc(99, "99", "0x63", "0o143", "0b1100011"), + nc(100, "100", "0x64", "0o144", "0b1100100"), + nc(101, "101", "0x65", "0o145", "0b1100101"), + nc(127, "127", "0x7f", "0o177", "0b1111111"), + nc(128, "128", "0x80", "0o200", "0b10000000"), + nc(129, "129", "0x81", "0o201", "0b10000001"), + nc(183, "183", "0xb7", "0o267", "0b10110111"), + nc(184, "184", "0xb8", "0o270", "0b10111000"), + nc(185, "185", "0xb9", "0o271", "0b10111001"), + nc(255, "255", "0xff", "0o377", "0b11111111"), + nc(256, "256", "0x100", "0o400", "0b100000000"), + nc(257, "257", "0x101", "0o401", "0b100000001"), + nc(511, "511", "0x1ff", "0o777", "0b111111111"), + nc(512, "512", "0x200", "0o1000", "0b1000000000"), + nc(513, "513", "0x201", "0o1001", "0b1000000001"), + nc(999, "999", "0x3e7", "0o1747", "0b1111100111"), + nc(1000, "1000", "0x3e8", "0o1750", "0b1111101000"), + nc(1001, "1001", "0x3e9", "0o1751", "0b1111101001"), + nc(1023, "1023", "0x3ff", "0o1777", "0b1111111111"), + nc(1024, "1024", "0x400", "0o2000", "0b10000000000"), + nc(1025, "1025", "0x401", "0o2001", "0b10000000001"), + nc(1843, "1843", "0x733", "0o3463", "0b11100110011"), + nc(1844, "1844", "0x734", "0o3464", "0b11100110100"), + nc(1845, "1845", "0x735", "0o3465", "0b11100110101"), + nc(2047, "2047", "0x7ff", "0o3777", "0b11111111111"), + nc(2048, "2048", "0x800", "0o4000", "0b100000000000"), + nc(2049, "2049", "0x801", "0o4001", "0b100000000001"), + nc(4095, "4095", "0xfff", "0o7777", "0b111111111111"), + nc(4096, "4096", "0x1000", "0o10000", "0b1000000000000"), + nc(4097, "4097", "0x1001", "0o10001", "0b1000000000001"), + nc(8191, "8191", "0x1fff", "0o17777", "0b1111111111111"), + nc(8192, "8192", "0x2000", "0o20000", "0b10000000000000"), + nc(8193, "8193", "0x2001", "0o20001", "0b10000000000001"), + nc(9999, "9999", "0x270f", "0o23417", "0b10011100001111"), + nc(10000, "10000", "0x2710", "0o23420", "0b10011100010000"), + nc(10001, "10001", "0x2711", "0o23421", "0b10011100010001"), + nc(16383, "16383", "0x3fff", "0o37777", "0b11111111111111"), + nc(16384, "16384", "0x4000", "0o40000", "0b100000000000000"), + nc(16385, "16385", "0x4001", "0o40001", "0b100000000000001"), + nc(18445, "18445", "0x480d", "0o44015", "0b100100000001101"), + nc(18446, "18446", "0x480e", "0o44016", "0b100100000001110"), + nc(18447, "18447", "0x480f", "0o44017", "0b100100000001111"), + nc(32767, "32767", "0x7fff", "0o77777", "0b111111111111111"), + nc(32768, "32768", "0x8000", "0o100000", "0b1000000000000000"), + nc(32769, "32769", "0x8001", "0o100001", "0b1000000000000001"), + nc(65535, "65535", "0xffff", "0o177777", "0b1111111111111111"), + nc(65536, "65536", "0x10000", "0o200000", "0b10000000000000000"), + nc(65537, "65537", "0x10001", "0o200001", "0b10000000000000001"), + nc(99999, "99999", "0x1869f", "0o303237", "0b11000011010011111"), + nc(100000, "100000", "0x186a0", "0o303240", "0b11000011010100000"), + nc(100001, "100001", "0x186a1", "0o303241", "0b11000011010100001"), + nc(131071, "131071", "0x1ffff", "0o377777", "0b11111111111111111"), + nc(131072, "131072", "0x20000", "0o400000", "0b100000000000000000"), + nc(131073, "131073", "0x20001", "0o400001", "0b100000000000000001"), + nc(184466, "184466", "0x2d092", "0o550222", "0b101101000010010010"), + nc(184467, "184467", "0x2d093", "0o550223", "0b101101000010010011"), + nc(184468, "184468", "0x2d094", "0o550224", "0b101101000010010100"), + nc(262143, "262143", "0x3ffff", "0o777777", "0b111111111111111111"), + nc(262144, "262144", "0x40000", "0o1000000", "0b1000000000000000000"), + nc(262145, "262145", "0x40001", "0o1000001", "0b1000000000000000001"), + nc(524287, "524287", "0x7ffff", "0o1777777", "0b1111111111111111111"), + nc(524288, "524288", "0x80000", "0o2000000", "0b10000000000000000000"), + nc(524289, "524289", "0x80001", "0o2000001", "0b10000000000000000001"), + nc(999999, "999999", "0xf423f", "0o3641077", "0b11110100001000111111"), + nc(1000000, "1000000", "0xf4240", "0o3641100", "0b11110100001001000000"), + nc(1000001, "1000001", "0xf4241", "0o3641101", "0b11110100001001000001"), + nc(1048575, "1048575", "0xfffff", "0o3777777", "0b11111111111111111111"), + nc(1048576, "1048576", "0x100000", "0o4000000", "0b100000000000000000000"), + nc(1048577, "1048577", "0x100001", "0o4000001", "0b100000000000000000001"), + nc(1844673, "1844673", "0x1c25c1", "0o7022701", "0b111000010010111000001"), + nc(1844674, "1844674", "0x1c25c2", "0o7022702", "0b111000010010111000010"), + nc(1844675, "1844675", "0x1c25c3", "0o7022703", "0b111000010010111000011"), + nc(2097151, "2097151", "0x1fffff", "0o7777777", "0b111111111111111111111"), + nc(2097152, "2097152", "0x200000", "0o10000000", "0b1000000000000000000000"), + nc(2097153, "2097153", "0x200001", "0o10000001", "0b1000000000000000000001"), + nc(4194303, "4194303", "0x3fffff", "0o17777777", "0b1111111111111111111111"), + nc(4194304, "4194304", "0x400000", "0o20000000", "0b10000000000000000000000"), + nc(4194305, "4194305", "0x400001", "0o20000001", "0b10000000000000000000001"), + nc(8388607, "8388607", "0x7fffff", "0o37777777", "0b11111111111111111111111"), + nc(8388608, "8388608", "0x800000", "0o40000000", "0b100000000000000000000000"), + nc(8388609, "8388609", "0x800001", "0o40000001", "0b100000000000000000000001"), + nc(9999999, "9999999", "0x98967f", "0o46113177", "0b100110001001011001111111"), + nc(10000000, "10000000", "0x989680", "0o46113200", "0b100110001001011010000000"), + nc(10000001, "10000001", "0x989681", "0o46113201", "0b100110001001011010000001"), + nc(16777215, "16777215", "0xffffff", "0o77777777", "0b111111111111111111111111"), + nc(16777216, "16777216", "0x1000000", "0o100000000", "0b1000000000000000000000000"), + nc(16777217, "16777217", "0x1000001", "0o100000001", "0b1000000000000000000000001"), + nc(18446743, "18446743", "0x1197997", "0o106274627", "0b1000110010111100110010111"), + nc(18446744, "18446744", "0x1197998", "0o106274630", "0b1000110010111100110011000"), + nc(18446745, "18446745", "0x1197999", "0o106274631", "0b1000110010111100110011001"), + nc(33554431, "33554431", "0x1ffffff", "0o177777777", "0b1111111111111111111111111"), + nc(33554432, "33554432", "0x2000000", "0o200000000", "0b10000000000000000000000000"), + nc(33554433, "33554433", "0x2000001", "0o200000001", "0b10000000000000000000000001"), + nc(67108863, "67108863", "0x3ffffff", "0o377777777", "0b11111111111111111111111111"), + nc(67108864, "67108864", "0x4000000", "0o400000000", "0b100000000000000000000000000"), + nc(67108865, "67108865", "0x4000001", "0o400000001", "0b100000000000000000000000001"), + nc(99999999, "99999999", "0x5f5e0ff", "0o575360377", "0b101111101011110000011111111"), + nc(100000000, "100000000", "0x5f5e100", "0o575360400", "0b101111101011110000100000000"), + nc(100000001, "100000001", "0x5f5e101", "0o575360401", "0b101111101011110000100000001"), + nc(134217727, "134217727", "0x7ffffff", "0o777777777", "0b111111111111111111111111111"), + nc(134217728, "134217728", "0x8000000", "0o1000000000", "0b1000000000000000000000000000"), + nc(134217729, "134217729", "0x8000001", "0o1000000001", "0b1000000000000000000000000001"), + nc(184467439, "184467439", "0xafebfef", "0o1277537757", "0b1010111111101011111111101111"), + nc(184467440, "184467440", "0xafebff0", "0o1277537760", "0b1010111111101011111111110000"), + nc(184467441, "184467441", "0xafebff1", "0o1277537761", "0b1010111111101011111111110001"), + nc(268435455, "268435455", "0xfffffff", "0o1777777777", "0b1111111111111111111111111111"), + nc(268435456, "268435456", "0x10000000", "0o2000000000", "0b10000000000000000000000000000"), + nc(268435457, "268435457", "0x10000001", "0o2000000001", "0b10000000000000000000000000001"), + nc(536870911, "536870911", "0x1fffffff", "0o3777777777", "0b11111111111111111111111111111"), + nc(536870912, "536870912", "0x20000000", "0o4000000000", "0b100000000000000000000000000000"), + nc(536870913, "536870913", "0x20000001", "0o4000000001", "0b100000000000000000000000000001"), + nc(999999999, "999999999", "0x3b9ac9ff", "0o7346544777", "0b111011100110101100100111111111"), + nc(1000000000, "1000000000", "0x3b9aca00", "0o7346545000", "0b111011100110101100101000000000"), + nc(1000000001, "1000000001", "0x3b9aca01", "0o7346545001", "0b111011100110101100101000000001"), + nc(1073741823, "1073741823", "0x3fffffff", "0o7777777777", "0b111111111111111111111111111111"), + nc(1073741824, "1073741824", "0x40000000", "0o10000000000", "0b1000000000000000000000000000000"), + nc(1073741825, "1073741825", "0x40000001", "0o10000000001", "0b1000000000000000000000000000001"), + nc(1844674406, "1844674406", "0x6df37f66", "0o15574677546", "0b1101101111100110111111101100110"), + nc(1844674407, "1844674407", "0x6df37f67", "0o15574677547", "0b1101101111100110111111101100111"), + nc(1844674408, "1844674408", "0x6df37f68", "0o15574677550", "0b1101101111100110111111101101000"), + nc(2147483647, "2147483647", "0x7fffffff", "0o17777777777", "0b1111111111111111111111111111111"), + nc(2147483648, "2147483648", "0x80000000", "0o20000000000", "0b10000000000000000000000000000000"), + nc(2147483649, "2147483649", "0x80000001", "0o20000000001", "0b10000000000000000000000000000001"), + nc(4294967295, "4294967295", "0xffffffff", "0o37777777777", "0b11111111111111111111111111111111"), + nc(4294967296, "4294967296", "0x100000000", "0o40000000000", "0b100000000000000000000000000000000"), + nc(4294967297, "4294967297", "0x100000001", "0o40000000001", "0b100000000000000000000000000000001"), + nc(8589934591, "8589934591", "0x1ffffffff", "0o77777777777", "0b111111111111111111111111111111111"), + nc(8589934592, "8589934592", "0x200000000", "0o100000000000", "0b1000000000000000000000000000000000"), + nc(8589934593, "8589934593", "0x200000001", "0o100000000001", "0b1000000000000000000000000000000001"), + nc(9999999999, "9999999999", "0x2540be3ff", "0o112402761777", "0b1001010100000010111110001111111111"), + nc(10000000000, "10000000000", "0x2540be400", "0o112402762000", "0b1001010100000010111110010000000000"), + nc(10000000001, "10000000001", "0x2540be401", "0o112402762001", "0b1001010100000010111110010000000001"), + nc(17179869183, "17179869183", "0x3ffffffff", "0o177777777777", "0b1111111111111111111111111111111111"), + nc(17179869184, "17179869184", "0x400000000", "0o200000000000", "0b10000000000000000000000000000000000"), + nc(17179869185, "17179869185", "0x400000001", "0o200000000001", "0b10000000000000000000000000000000001"), + nc(18446744072, "18446744072", "0x44b82fa08", "0o211340575010", "0b10001001011100000101111101000001000"), + nc(18446744073, "18446744073", "0x44b82fa09", "0o211340575011", "0b10001001011100000101111101000001001"), + nc(18446744074, "18446744074", "0x44b82fa0a", "0o211340575012", "0b10001001011100000101111101000001010"), + nc(34359738367, "34359738367", "0x7ffffffff", "0o377777777777", "0b11111111111111111111111111111111111"), + nc(34359738368, "34359738368", "0x800000000", "0o400000000000", "0b100000000000000000000000000000000000"), + nc(34359738369, "34359738369", "0x800000001", "0o400000000001", "0b100000000000000000000000000000000001"), + nc(68719476735, "68719476735", "0xfffffffff", "0o777777777777", "0b111111111111111111111111111111111111"), + nc(68719476736, "68719476736", "0x1000000000", "0o1000000000000", "0b1000000000000000000000000000000000000"), + nc(68719476737, "68719476737", "0x1000000001", "0o1000000000001", "0b1000000000000000000000000000000000001"), + nc(99999999999, "99999999999", "0x174876e7ff", "0o1351035563777", "0b1011101001000011101101110011111111111"), + nc(100000000000, "100000000000", "0x174876e800", "0o1351035564000", "0b1011101001000011101101110100000000000"), + nc(100000000001, "100000000001", "0x174876e801", "0o1351035564001", "0b1011101001000011101101110100000000001"), + nc(137438953471, "137438953471", "0x1fffffffff", "0o1777777777777", "0b1111111111111111111111111111111111111"), + nc(137438953472, "137438953472", "0x2000000000", "0o2000000000000", "0b10000000000000000000000000000000000000"), + nc(137438953473, "137438953473", "0x2000000001", "0o2000000000001", "0b10000000000000000000000000000000000001"), + nc(184467440736, "184467440736", "0x2af31dc460", "0o2536307342140", "0b10101011110011000111011100010001100000"), + nc(184467440737, "184467440737", "0x2af31dc461", "0o2536307342141", "0b10101011110011000111011100010001100001"), + nc(184467440738, "184467440738", "0x2af31dc462", "0o2536307342142", "0b10101011110011000111011100010001100010"), + nc(274877906943, "274877906943", "0x3fffffffff", "0o3777777777777", "0b11111111111111111111111111111111111111"), + nc(274877906944, "274877906944", "0x4000000000", "0o4000000000000", "0b100000000000000000000000000000000000000"), + nc(274877906945, "274877906945", "0x4000000001", "0o4000000000001", "0b100000000000000000000000000000000000001"), + nc(549755813887, "549755813887", "0x7fffffffff", "0o7777777777777", "0b111111111111111111111111111111111111111"), + nc(549755813888, "549755813888", "0x8000000000", "0o10000000000000", "0b1000000000000000000000000000000000000000"), + nc(549755813889, "549755813889", "0x8000000001", "0o10000000000001", "0b1000000000000000000000000000000000000001"), + nc(999999999999, "999999999999", "0xe8d4a50fff", "0o16432451207777", "0b1110100011010100101001010000111111111111"), + nc(1000000000000, "1000000000000", "0xe8d4a51000", "0o16432451210000", "0b1110100011010100101001010001000000000000"), + nc(1000000000001, "1000000000001", "0xe8d4a51001", "0o16432451210001", "0b1110100011010100101001010001000000000001"), + nc(1099511627775, "1099511627775", "0xffffffffff", "0o17777777777777", "0b1111111111111111111111111111111111111111"), + nc(1099511627776, "1099511627776", "0x10000000000", "0o20000000000000", "0b10000000000000000000000000000000000000000"), + nc(1099511627777, "1099511627777", "0x10000000001", "0o20000000000001", "0b10000000000000000000000000000000000000001"), + nc(1844674407369, "1844674407369", "0x1ad7f29abc9", "0o32657712325711", "0b11010110101111111001010011010101111001001"), + nc(1844674407370, "1844674407370", "0x1ad7f29abca", "0o32657712325712", "0b11010110101111111001010011010101111001010"), + nc(1844674407371, "1844674407371", "0x1ad7f29abcb", "0o32657712325713", "0b11010110101111111001010011010101111001011"), + nc(2199023255551, "2199023255551", "0x1ffffffffff", "0o37777777777777", "0b11111111111111111111111111111111111111111"), + nc(2199023255552, "2199023255552", "0x20000000000", "0o40000000000000", "0b100000000000000000000000000000000000000000"), + nc(2199023255553, "2199023255553", "0x20000000001", "0o40000000000001", "0b100000000000000000000000000000000000000001"), + nc(4398046511103, "4398046511103", "0x3ffffffffff", "0o77777777777777", "0b111111111111111111111111111111111111111111"), + nc(4398046511104, "4398046511104", "0x40000000000", "0o100000000000000", "0b1000000000000000000000000000000000000000000"), + nc(4398046511105, "4398046511105", "0x40000000001", "0o100000000000001", "0b1000000000000000000000000000000000000000001"), + nc(8796093022207, "8796093022207", "0x7ffffffffff", "0o177777777777777", "0b1111111111111111111111111111111111111111111"), + nc(8796093022208, "8796093022208", "0x80000000000", "0o200000000000000", "0b10000000000000000000000000000000000000000000"), + nc(8796093022209, "8796093022209", "0x80000000001", "0o200000000000001", "0b10000000000000000000000000000000000000000001"), + nc(9999999999999, "9999999999999", "0x9184e729fff", "0o221411634517777", "0b10010001100001001110011100101001111111111111"), + nc(10000000000000, "10000000000000", "0x9184e72a000", "0o221411634520000", "0b10010001100001001110011100101010000000000000"), + nc(10000000000001, "10000000000001", "0x9184e72a001", "0o221411634520001", "0b10010001100001001110011100101010000000000001"), + nc(17592186044415, "17592186044415", "0xfffffffffff", "0o377777777777777", "0b11111111111111111111111111111111111111111111"), + nc(17592186044416, "17592186044416", "0x100000000000", "0o400000000000000", "0b100000000000000000000000000000000000000000000"), + nc(17592186044417, "17592186044417", "0x100000000001", "0o400000000000001", "0b100000000000000000000000000000000000000000001"), + nc(18446744073708, "18446744073708", "0x10c6f7a0b5ec", "0o414336750132754", "0b100001100011011110111101000001011010111101100"), + nc(18446744073709, "18446744073709", "0x10c6f7a0b5ed", "0o414336750132755", "0b100001100011011110111101000001011010111101101"), + nc(18446744073710, "18446744073710", "0x10c6f7a0b5ee", "0o414336750132756", "0b100001100011011110111101000001011010111101110"), + nc(35184372088831, "35184372088831", "0x1fffffffffff", "0o777777777777777", "0b111111111111111111111111111111111111111111111"), + nc(35184372088832, "35184372088832", "0x200000000000", "0o1000000000000000", "0b1000000000000000000000000000000000000000000000"), + nc(35184372088833, "35184372088833", "0x200000000001", "0o1000000000000001", "0b1000000000000000000000000000000000000000000001"), + nc(70368744177663, "70368744177663", "0x3fffffffffff", "0o1777777777777777", "0b1111111111111111111111111111111111111111111111"), + nc(70368744177664, "70368744177664", "0x400000000000", "0o2000000000000000", "0b10000000000000000000000000000000000000000000000"), + nc(70368744177665, "70368744177665", "0x400000000001", "0o2000000000000001", "0b10000000000000000000000000000000000000000000001"), + nc(99999999999999, "99999999999999", "0x5af3107a3fff", "0o2657142036437777", "0b10110101111001100010000011110100011111111111111"), + nc(100000000000000, "100000000000000", "0x5af3107a4000", "0o2657142036440000", "0b10110101111001100010000011110100100000000000000"), + nc(100000000000001, "100000000000001", "0x5af3107a4001", "0o2657142036440001", "0b10110101111001100010000011110100100000000000001"), + nc(140737488355327, "140737488355327", "0x7fffffffffff", "0o3777777777777777", "0b11111111111111111111111111111111111111111111111"), + nc(140737488355328, "140737488355328", "0x800000000000", "0o4000000000000000", "0b100000000000000000000000000000000000000000000000"), + nc(140737488355329, "140737488355329", "0x800000000001", "0o4000000000000001", "0b100000000000000000000000000000000000000000000001"), + nc(184467440737094, "184467440737094", "0xa7c5ac471b46", "0o5174265421615506", "0b101001111100010110101100010001110001101101000110"), + nc(184467440737095, "184467440737095", "0xa7c5ac471b47", "0o5174265421615507", "0b101001111100010110101100010001110001101101000111"), + nc(184467440737096, "184467440737096", "0xa7c5ac471b48", "0o5174265421615510", "0b101001111100010110101100010001110001101101001000"), + nc(281474976710655, "281474976710655", "0xffffffffffff", "0o7777777777777777", "0b111111111111111111111111111111111111111111111111"), + nc(281474976710656, "281474976710656", "0x1000000000000", "0o10000000000000000", "0b1000000000000000000000000000000000000000000000000"), + nc(281474976710657, "281474976710657", "0x1000000000001", "0o10000000000000001", "0b1000000000000000000000000000000000000000000000001"), + nc(562949953421311, "562949953421311", "0x1ffffffffffff", "0o17777777777777777", "0b1111111111111111111111111111111111111111111111111"), + nc(562949953421312, "562949953421312", "0x2000000000000", "0o20000000000000000", "0b10000000000000000000000000000000000000000000000000"), + nc(562949953421313, "562949953421313", "0x2000000000001", "0o20000000000000001", "0b10000000000000000000000000000000000000000000000001"), + nc(999999999999999, "999999999999999", "0x38d7ea4c67fff", "0o34327724461477777", "0b11100011010111111010100100110001100111111111111111"), + nc(1000000000000000, "1000000000000000", "0x38d7ea4c68000", "0o34327724461500000", "0b11100011010111111010100100110001101000000000000000"), + nc(1000000000000001, "1000000000000001", "0x38d7ea4c68001", "0o34327724461500001", "0b11100011010111111010100100110001101000000000000001"), + nc(1125899906842623, "1125899906842623", "0x3ffffffffffff", "0o37777777777777777", "0b11111111111111111111111111111111111111111111111111"), + nc(1125899906842624, "1125899906842624", "0x4000000000000", "0o40000000000000000", "0b100000000000000000000000000000000000000000000000000"), + nc(1125899906842625, "1125899906842625", "0x4000000000001", "0o40000000000000001", "0b100000000000000000000000000000000000000000000000001"), + nc(1844674407370954, "1844674407370954", "0x68db8bac710ca", "0o64333427261610312", "0b110100011011011100010111010110001110001000011001010"), + nc(1844674407370955, "1844674407370955", "0x68db8bac710cb", "0o64333427261610313", "0b110100011011011100010111010110001110001000011001011"), + nc(1844674407370956, "1844674407370956", "0x68db8bac710cc", "0o64333427261610314", "0b110100011011011100010111010110001110001000011001100"), + nc(2251799813685247, "2251799813685247", "0x7ffffffffffff", "0o77777777777777777", "0b111111111111111111111111111111111111111111111111111"), + nc(2251799813685248, "2251799813685248", "0x8000000000000", "0o100000000000000000", "0b1000000000000000000000000000000000000000000000000000"), + nc(2251799813685249, "2251799813685249", "0x8000000000001", "0o100000000000000001", "0b1000000000000000000000000000000000000000000000000001"), + nc(4503599627370495, "4503599627370495", "0xfffffffffffff", "0o177777777777777777", "0b1111111111111111111111111111111111111111111111111111"), + nc(4503599627370496, "4503599627370496", "0x10000000000000", "0o200000000000000000", "0b10000000000000000000000000000000000000000000000000000"), + nc(4503599627370497, "4503599627370497", "0x10000000000001", "0o200000000000000001", "0b10000000000000000000000000000000000000000000000000001"), + nc(9007199254740991, "9007199254740991", "0x1fffffffffffff", "0o377777777777777777", "0b11111111111111111111111111111111111111111111111111111"), + nc(9007199254740992, "9007199254740992", "0x20000000000000", "0o400000000000000000", "0b100000000000000000000000000000000000000000000000000000"), + nc(9007199254740993, "9007199254740993", "0x20000000000001", "0o400000000000000001", "0b100000000000000000000000000000000000000000000000000001"), + nc(9999999999999999, "9999999999999999", "0x2386f26fc0ffff", "0o434157115760177777", "0b100011100001101111001001101111110000001111111111111111"), + nc(10000000000000000, "10000000000000000", "0x2386f26fc10000", "0o434157115760200000", "0b100011100001101111001001101111110000010000000000000000"), + nc(10000000000000001, "10000000000000001", "0x2386f26fc10001", "0o434157115760200001", "0b100011100001101111001001101111110000010000000000000001"), + nc(18014398509481983, "18014398509481983", "0x3fffffffffffff", "0o777777777777777777", "0b111111111111111111111111111111111111111111111111111111"), + nc(18014398509481984, "18014398509481984", "0x40000000000000", "0o1000000000000000000", "0b1000000000000000000000000000000000000000000000000000000"), + nc(18014398509481985, "18014398509481985", "0x40000000000001", "0o1000000000000000001", "0b1000000000000000000000000000000000000000000000000000001"), + nc(18446744073709551, "18446744073709551", "0x4189374bc6a7ef", "0o1014223351361523757", "0b1000001100010010011011101001011110001101010011111101111"), + nc(18446744073709552, "18446744073709552", "0x4189374bc6a7f0", "0o1014223351361523760", "0b1000001100010010011011101001011110001101010011111110000"), + nc(18446744073709553, "18446744073709553", "0x4189374bc6a7f1", "0o1014223351361523761", "0b1000001100010010011011101001011110001101010011111110001"), + nc(36028797018963967, "36028797018963967", "0x7fffffffffffff", "0o1777777777777777777", "0b1111111111111111111111111111111111111111111111111111111"), + nc(36028797018963968, "36028797018963968", "0x80000000000000", "0o2000000000000000000", "0b10000000000000000000000000000000000000000000000000000000"), + nc(36028797018963969, "36028797018963969", "0x80000000000001", "0o2000000000000000001", "0b10000000000000000000000000000000000000000000000000000001"), + nc(72057594037927935, "72057594037927935", "0xffffffffffffff", "0o3777777777777777777", "0b11111111111111111111111111111111111111111111111111111111"), + nc(72057594037927936, "72057594037927936", "0x100000000000000", "0o4000000000000000000", "0b100000000000000000000000000000000000000000000000000000000"), + nc(72057594037927937, "72057594037927937", "0x100000000000001", "0o4000000000000000001", "0b100000000000000000000000000000000000000000000000000000001"), + nc(99999999999999999, "99999999999999999", "0x16345785d89ffff", "0o5432127413542377777", "0b101100011010001010111100001011101100010011111111111111111"), + nc(100000000000000000, "100000000000000000", "0x16345785d8a0000", "0o5432127413542400000", "0b101100011010001010111100001011101100010100000000000000000"), + nc(100000000000000001, "100000000000000001", "0x16345785d8a0001", "0o5432127413542400001", "0b101100011010001010111100001011101100010100000000000000001"), + nc(144115188075855871, "144115188075855871", "0x1ffffffffffffff", "0o7777777777777777777", "0b111111111111111111111111111111111111111111111111111111111"), + nc(144115188075855872, "144115188075855872", "0x200000000000000", "0o10000000000000000000", "0b1000000000000000000000000000000000000000000000000000000000"), + nc(144115188075855873, "144115188075855873", "0x200000000000001", "0o10000000000000000001", "0b1000000000000000000000000000000000000000000000000000000001"), + nc(184467440737095519, "184467440737095519", "0x28f5c28f5c28f5f", "0o12172702436560507537", "0b1010001111010111000010100011110101110000101000111101011111"), + nc(184467440737095520, "184467440737095520", "0x28f5c28f5c28f60", "0o12172702436560507540", "0b1010001111010111000010100011110101110000101000111101100000"), + nc(184467440737095521, "184467440737095521", "0x28f5c28f5c28f61", "0o12172702436560507541", "0b1010001111010111000010100011110101110000101000111101100001"), + nc(288230376151711743, "288230376151711743", "0x3ffffffffffffff", "0o17777777777777777777", "0b1111111111111111111111111111111111111111111111111111111111"), + nc(288230376151711744, "288230376151711744", "0x400000000000000", "0o20000000000000000000", "0b10000000000000000000000000000000000000000000000000000000000"), + nc(288230376151711745, "288230376151711745", "0x400000000000001", "0o20000000000000000001", "0b10000000000000000000000000000000000000000000000000000000001"), + nc(576460752303423487, "576460752303423487", "0x7ffffffffffffff", "0o37777777777777777777", "0b11111111111111111111111111111111111111111111111111111111111"), + nc(576460752303423488, "576460752303423488", "0x800000000000000", "0o40000000000000000000", "0b100000000000000000000000000000000000000000000000000000000000"), + nc(576460752303423489, "576460752303423489", "0x800000000000001", "0o40000000000000000001", "0b100000000000000000000000000000000000000000000000000000000001"), + nc(999999999999999999, "999999999999999999", "0xde0b6b3a763ffff", "0o67405553164730777777", "0b110111100000101101101011001110100111011000111111111111111111"), + nc(1000000000000000000, "1000000000000000000", "0xde0b6b3a7640000", "0o67405553164731000000", "0b110111100000101101101011001110100111011001000000000000000000"), + nc(1000000000000000001, "1000000000000000001", "0xde0b6b3a7640001", "0o67405553164731000001", "0b110111100000101101101011001110100111011001000000000000000001"), + nc(1152921504606846975, "1152921504606846975", "0xfffffffffffffff", "0o77777777777777777777", "0b111111111111111111111111111111111111111111111111111111111111"), + nc(1152921504606846976, "1152921504606846976", "0x1000000000000000", "0o100000000000000000000", "0b1000000000000000000000000000000000000000000000000000000000000"), + nc(1152921504606846977, "1152921504606846977", "0x1000000000000001", "0o100000000000000000001", "0b1000000000000000000000000000000000000000000000000000000000001"), + nc(1844674407370955263, "1844674407370955263", "0x19999999999999ff", "0o146314631463146314777", "0b1100110011001100110011001100110011001100110011001100111111111"), + nc(1844674407370955264, "1844674407370955264", "0x1999999999999a00", "0o146314631463146315000", "0b1100110011001100110011001100110011001100110011001101000000000"), + nc(1844674407370955265, "1844674407370955265", "0x1999999999999a01", "0o146314631463146315001", "0b1100110011001100110011001100110011001100110011001101000000001"), + nc(2305843009213693951, "2305843009213693951", "0x1fffffffffffffff", "0o177777777777777777777", "0b1111111111111111111111111111111111111111111111111111111111111"), + nc(2305843009213693952, "2305843009213693952", "0x2000000000000000", "0o200000000000000000000", "0b10000000000000000000000000000000000000000000000000000000000000"), + nc(2305843009213693953, "2305843009213693953", "0x2000000000000001", "0o200000000000000000001", "0b10000000000000000000000000000000000000000000000000000000000001"), + nc(4611686018427387903, "4611686018427387903", "0x3fffffffffffffff", "0o377777777777777777777", "0b11111111111111111111111111111111111111111111111111111111111111"), + nc(4611686018427387904, "4611686018427387904", "0x4000000000000000", "0o400000000000000000000", "0b100000000000000000000000000000000000000000000000000000000000000"), + nc(4611686018427387905, "4611686018427387905", "0x4000000000000001", "0o400000000000000000001", "0b100000000000000000000000000000000000000000000000000000000000001"), + nc(9223372036854775807, "9223372036854775807", "0x7fffffffffffffff", "0o777777777777777777777", "0b111111111111111111111111111111111111111111111111111111111111111"), + nc(9223372036854775808, "9223372036854775808", "0x8000000000000000", "0o1000000000000000000000", "0b1000000000000000000000000000000000000000000000000000000000000000"), + nc(9223372036854775809, "9223372036854775809", "0x8000000000000001", "0o1000000000000000000001", "0b1000000000000000000000000000000000000000000000000000000000000001"), + nc(9999999999999999999, "9999999999999999999", "0x8ac7230489e7ffff", "0o1053071060221171777777", "0b1000101011000111001000110000010010001001111001111111111111111111"), + nc(10000000000000000000, "10000000000000000000", "0x8ac7230489e80000", "0o1053071060221172000000", "0b1000101011000111001000110000010010001001111010000000000000000000"), + nc(10000000000000000001, "10000000000000000001", "0x8ac7230489e80001", "0o1053071060221172000001", "0b1000101011000111001000110000010010001001111010000000000000000001"), + nc(18446744073709551611, "18446744073709551611", "0xfffffffffffffffb", "0o1777777777777777777773", "0b1111111111111111111111111111111111111111111111111111111111111011"), + nc(18446744073709551612, "18446744073709551612", "0xfffffffffffffffc", "0o1777777777777777777774", "0b1111111111111111111111111111111111111111111111111111111111111100"), + nc(18446744073709551613, "18446744073709551613", "0xfffffffffffffffd", "0o1777777777777777777775", "0b1111111111111111111111111111111111111111111111111111111111111101"), + nc(18446744073709551614, "18446744073709551614", "0xfffffffffffffffe", "0o1777777777777777777776", "0b1111111111111111111111111111111111111111111111111111111111111110"), + nc(18446744073709551615, "18446744073709551615", "0xffffffffffffffff", "0o1777777777777777777777", "0b1111111111111111111111111111111111111111111111111111111111111111"), +#undef nc + }; +}; + +C4_INLINE_CONSTEXPR const number_case<int8_t> numbers<int8_t>::vals[]; +C4_INLINE_CONSTEXPR const number_case<uint8_t> numbers<uint8_t>::vals[]; + +C4_INLINE_CONSTEXPR const number_case<int16_t> numbers<int16_t>::vals[]; +C4_INLINE_CONSTEXPR const number_case<uint16_t> numbers<uint16_t>::vals[]; + +C4_INLINE_CONSTEXPR const number_case<int32_t> numbers<int32_t>::vals[]; +C4_INLINE_CONSTEXPR const number_case<uint32_t> numbers<uint32_t>::vals[]; + +C4_INLINE_CONSTEXPR const number_case<int64_t> numbers<int64_t>::vals[]; +C4_INLINE_CONSTEXPR const number_case<uint64_t> numbers<uint64_t>::vals[]; + +C4_SUPPRESS_WARNING_MSVC_POP + +} // namespace c4 diff --git a/thirdparty/ryml/ext/c4core/test/test_preprocessor.cpp b/thirdparty/ryml/ext/c4core/test/test_preprocessor.cpp new file mode 100644 index 000000000..bd2619ae4 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_preprocessor.cpp @@ -0,0 +1,55 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/preprocessor.hpp" +#include "c4/language.hpp" +#endif + +#ifdef WE_LL_GET_THERE___MSVC_CANT_HANDLE_THE_FOREACH_MACRO___NEEDS_TO_BE_FIXED +#include <string> +#include <map> + +struct SomeStruct +{ + int32_t a; + int32_t b; + int32_t c; + int32_t d; +}; + +TEST(TestForEach, print_offsets) +{ +#define M_OFFS_(structure, field) m[#field] = offsetof(structure, field) +#define M_OFFS(field) M_OFFS_(SomeStruct, field) + + std::map< std::string, size_t > m; + + C4_FOR_EACH(M_OFFS, a, b, c); + C4_FOR_EACH(M_OFFS, d); + + EXPECT_EQ(m["a"], 0); + EXPECT_EQ(m["b"], 4); + EXPECT_EQ(m["c"], 8); + EXPECT_EQ(m["d"], 12); +} + +//----------------------------------------------------------------------------- +// C4_BEGIN_NAMESPACE()/C4_END_NAMESPACE() are implemented with C4_FOR_EACH(). +// Test these here too. + +namespace a, b, c { +int a_var = 0; +} // namespace c, b +int var = 1; // a::var +namespace b { +int var = 2; // a::b::var +namespace c { +int var = 3; // a::b::c::var +} // namespace c, b, a + +TEST(TestForEach, begin_end_namespace) +{ + EXPECT_EQ(a::b::c::a_var, 0); + EXPECT_EQ(a::var, 1); + EXPECT_EQ(a::b::var, 2); + EXPECT_EQ(a::b::c::var, 3); +} +#endif diff --git a/thirdparty/ryml/ext/c4core/test/test_singleheader/libc4core_singleheader.cpp b/thirdparty/ryml/ext/c4core/test/test_singleheader/libc4core_singleheader.cpp new file mode 100644 index 000000000..078c77d1e --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_singleheader/libc4core_singleheader.cpp @@ -0,0 +1,2 @@ +#define C4CORE_SINGLE_HDR_DEFINE_NOW +#include <c4/c4core_all.hpp> diff --git a/thirdparty/ryml/ext/c4core/test/test_span.cpp b/thirdparty/ryml/ext/c4core/test/test_span.cpp new file mode 100644 index 000000000..c492013d7 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_span.cpp @@ -0,0 +1,944 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/span.hpp" +#endif + +#include "c4/libtest/supprwarn_push.hpp" + +#include <c4/test.hpp> + +namespace c4 { + +//----------------------------------------------------------------------------- +TEST_CASE_TEMPLATE("span.default_init", SpanClass, span<int>, spanrs<int>, spanrsl<int>) +{ + SpanClass s; + CHECK_EQ(s.size(), 0); + CHECK_EQ(s.capacity(), 0); + CHECK_EQ(s.data(), nullptr); +} + + +template<template<class, class> class Span, class T, class I> +Span<const T, I> cvt_to_const(Span<T, I> const& s) +{ + Span<const T, I> ret = s; + return ret; +} + +TEST_CASE_TEMPLATE("span.convert_to_const", SpanClass, span<int>, spanrs<int>, spanrsl<int>) +{ + SpanClass s; + auto cs = cvt_to_const(s); + CHECK_EQ(s.size(), cs.size()); + CHECK_EQ(s.data(), cs.data()); + CHECK_EQ(s.end(), cs.end()); +} + + +//----------------------------------------------------------------------------- +TEST_CASE("span.empty_init") +{ + int arr[10]; + span<int> s(arr, 0); + CHECK_EQ(s.size(), 0); + CHECK_EQ(s.capacity(), 0); + CHECK_NE(s.data(), nullptr); +} + +TEST_CASE("spanrs.empty_init") +{ + int arr[10]; + + { + spanrs<int> s(arr, 0); + CHECK_EQ(s.size(), 0); + CHECK_EQ(s.capacity(), 0); + CHECK_EQ(s.data(), arr); + } + + { + spanrs<int> s(arr, 0, C4_COUNTOF(arr)); + CHECK_EQ(s.size(), 0); + CHECK_EQ(s.capacity(), 10); + CHECK_EQ(s.data(), arr); + } +} + +TEST_CASE("spanrsl.empty_init") +{ + int arr[10]; + + { + spanrsl<int> s(arr, 0); + CHECK_EQ(s.size(), 0); + CHECK_EQ(s.capacity(), 0); + CHECK_EQ(s.data(), arr); + CHECK_EQ(s.offset(), 0); + } + + { + spanrsl<int> s(arr, 0, C4_COUNTOF(arr)); + CHECK_EQ(s.size(), 0); + CHECK_EQ(s.capacity(), 10); + CHECK_EQ(s.data(), arr); + CHECK_EQ(s.offset(), 0); + } +} + +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("span.fromArray", SpanClass, + span<char>, span<int>, span<uint32_t>, + spanrs<char>, spanrs<int>, spanrs<uint32_t>, + spanrsl<char>, spanrsl<int>, spanrsl<uint32_t> + ) +{ + using ConstSpanClass = typename SpanClass::const_type; + using T = typename SpanClass::value_type; + T arr1[10]; + T arr2[20]; + + T a = 0; + for(auto &v : arr1) { v = a; ++a; } + for(auto &v : arr2) { v = a; ++a; } + + { + SpanClass s(arr1); + CHECK_EQ(s.size(), C4_COUNTOF(arr1)); + CHECK_EQ(s.capacity(), C4_COUNTOF(arr1)); + CHECK_EQ(s.data(), arr1); + } + + { + ConstSpanClass s(arr1); + CHECK_EQ(s.size(), C4_COUNTOF(arr1)); + CHECK_EQ(s.capacity(), C4_COUNTOF(arr1)); + CHECK_EQ(s.data(), arr1); + } + + { + SpanClass s = arr1; + CHECK_EQ(s.size(), C4_COUNTOF(arr1)); + CHECK_EQ(s.capacity(), C4_COUNTOF(arr1)); + CHECK_EQ(s.data(), arr1); + } + + { + ConstSpanClass s = arr1; + CHECK_EQ(s.size(), C4_COUNTOF(arr1)); + CHECK_EQ(s.capacity(), C4_COUNTOF(arr1)); + CHECK_EQ(s.data(), arr1); + } + + { + SpanClass s = arr1; + CHECK_EQ(s.size(), C4_COUNTOF(arr1)); + CHECK_EQ(s.capacity(), C4_COUNTOF(arr1)); + CHECK_EQ(s.data(), arr1); + s = arr2; + CHECK_EQ(s.size(), C4_COUNTOF(arr2)); + CHECK_EQ(s.capacity(), C4_COUNTOF(arr2)); + CHECK_EQ(s.data(), arr2); + } + + { + ConstSpanClass s = arr1; + CHECK_EQ(s.size(), C4_COUNTOF(arr1)); + CHECK_EQ(s.capacity(), C4_COUNTOF(arr1)); + CHECK_EQ(s.data(), arr1); + s = arr2; + CHECK_EQ(s.size(), C4_COUNTOF(arr2)); + CHECK_EQ(s.capacity(), C4_COUNTOF(arr2)); + CHECK_EQ(s.data(), arr2); + } +} + + +//----------------------------------------------------------------------------- +TEST_CASE("span.subspan") +{ + int arr[10]; + span<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.subspan(0)), decltype(s)>::value)); + + { + auto ss = s.subspan(0, 5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), arr); + + ss = s.subspan(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), &arr[5]); + + // fine to obtain an empty span at the end + ss = s.subspan(10); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), std::end(arr)); + // fine to obtain an empty span at the end + ss = s.subspan(10, 0); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), std::end(arr)); + } + { + int buf10[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + int buf_5[] = {-1, 0, 1, 2, 3, 4}; + int *buf5 = buf_5 + 1; // to make sure that one does not immediately follow the other in memory + + span<int> n(buf10); + span<int> m(buf5, 5); + + auto ss = n.subspan(0); + CHECK_EQ(ss.data(), buf10); + CHECK_EQ(ss.size(), 10); + ss = m.subspan(0); + CHECK_EQ(ss.data(), buf5); + CHECK_EQ(ss.size(), 5); + ss = n.subspan(0, 0); + CHECK_NE(ss.data(), nullptr); + CHECK_EQ(ss.data(), &buf10[0]); + CHECK_EQ(ss.size(), 0); + ss = m.subspan(0, 0); + CHECK_NE(ss.data(), nullptr); + CHECK_EQ(ss.data(), &buf5[0]); + CHECK_EQ(ss.size(), 0); + } +} +TEST_CASE("spanrs.subspan") +{ + int arr[10]; + spanrs<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.subspan(0)), decltype(s)>::value)); + + auto ss = s.subspan(0, 5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss = s.subspan(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), &arr[5]); + + // fine to obtain an empty span at the end + ss = s.subspan(10); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), std::end(arr)); + // fine to obtain an empty span at the end + ss = s.subspan(10, 0); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), std::end(arr)); +} +TEST_CASE("spanrsl.subspan") +{ + int arr[10]; + spanrsl<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.subspan(0)), decltype(s)>::value)); + + auto ss = s.subspan(0, 5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + CHECK_EQ(ss.offset(), 0); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + CHECK_EQ(ss.offset(), 0); + + ss = s.subspan(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), &arr[5]); + CHECK_EQ(ss.offset(), 5); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + CHECK_EQ(ss.offset(), 0); + + // fine to obtain an empty span at the end + ss = s.subspan(10); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), std::end(arr)); + // fine to obtain an empty span at the end + ss = s.subspan(10, 0); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), std::end(arr)); +} + +//----------------------------------------------------------------------------- +TEST_CASE("span.range") +{ + int arr[10]; + span<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.range(0)), decltype(s)>::value)); + + auto ss = s.range(0, 5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), arr); + + ss = s.range(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), &arr[5]); + + ss = s.range(5, 10); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), &arr[5]); + + ss = s.range(10, 10); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), std::end(arr)); + + SUBCASE("empty_span") + { + s = {}; + ss = s.range(0, 0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), nullptr); + s = arr; + ss = s.range(0, 0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr); + ss = s.range(10, 10); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr + 10); + ss = s.range(10); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr + 10); + } +} +TEST_CASE("spanrs.range") +{ + int arr[10]; + spanrs<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.range(0)), decltype(s)>::value)); + + auto ss = s.range(0, 5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss = s.range(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), &arr[5]); + + ss = s.range(5, 10); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), &arr[5]); + + ss = s.range(10, 10); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), std::end(arr)); + + SUBCASE("empty_span") + { + s = {}; + ss = s.range(0, 0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), nullptr); + s = arr; + ss = s.range(0, 0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr); + ss = s.range(10, 10); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr + 10); + ss = s.range(10); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr + 10); + } +} +TEST_CASE("spanrsl.range") +{ + int arr[10]; + spanrsl<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.range(0)), decltype(s)>::value)); + + auto ss = s.range(0, 5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss = s.range(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), &arr[5]); + + ss = s.range(5, 10); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), &arr[5]); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss = s.range(10, 10); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), std::end(arr)); + + SUBCASE("empty_span") + { + s = {}; + ss = s.range(0, 0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), nullptr); + s = arr; + ss = s.range(0, 0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr); + ss = s.range(10, 10); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr + 10); + ss = s.range(10); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr + 10); + } +} + +//----------------------------------------------------------------------------- +TEST_CASE("span.first") +{ + int arr[10]; + span<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.first(1)), decltype(s)>::value)); + + auto ss = s.first(0); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), arr); + + ss = s.first(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), arr); + + SUBCASE("empty") + { + s = {}; + ss = s.first(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), nullptr); + s = arr; + ss = s.first(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr); + } +} +TEST_CASE("spanrs.first") +{ + int arr[10]; + spanrs<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.first(1)), decltype(s)>::value)); + + auto ss = s.first(0); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss = s.first(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + SUBCASE("empty") + { + s = {}; + ss = s.first(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), nullptr); + s = arr; + ss = s.first(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr); + } +} +TEST_CASE("spanrsl.first") +{ + int arr[10]; + spanrsl<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.first(1)), decltype(s)>::value)); + + auto ss = s.first(0); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss = s.first(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + SUBCASE("empty") + { + s = {}; + ss = s.first(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), nullptr); + s = arr; + ss = s.first(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr); + } +} + +//----------------------------------------------------------------------------- +TEST_CASE("span.last") +{ + int arr[10]; + span<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.last(1)), decltype(s)>::value)); + + auto ss = s.last(0); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), arr + s.size()); + + ss = s.last(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), arr + 5); + + SUBCASE("empty") + { + s = {}; + ss = s.last(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), nullptr); + s = arr; + ss = s.last(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr + 10); + } +} +TEST_CASE("spanrs.last") +{ + int arr[10]; + spanrs<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.last(1)), decltype(s)>::value)); + + auto ss = s.last(0); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), arr + s.size()); + + ss = s.last(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), arr + 5); + + SUBCASE("empty") + { + s = {}; + ss = s.last(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), nullptr); + s = arr; + ss = s.last(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr + 10); + } +} +TEST_CASE("spanrsl.last") +{ + int arr[10]; + spanrsl<int> s(arr); + C4_STATIC_ASSERT((std::is_same<decltype(s.last(1)), decltype(s)>::value)); + + auto ss = s.last(0); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.capacity(), 0); + CHECK_EQ(ss.data(), arr + s.size()); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss = s.last(5); + CHECK_EQ(ss.size(), 5); + CHECK_EQ(ss.capacity(), 5); + CHECK_EQ(ss.data(), arr + 5); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + SUBCASE("empty") + { + s = {}; + ss = s.last(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), nullptr); + s = arr; + ss = s.last(0); + CHECK(ss.empty()); + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.data(), arr + 10); + } +} + + +//----------------------------------------------------------------------------- +TEST_CASE_TEMPLATE("span.is_subspan", SpanClass, span<int>, spanrs<int>, spanrsl<int>) +{ + int buf10[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + int buf_5[] = {-1, 0, 1, 2, 3, 4}; + int *buf5 = buf_5 + 1; // to make sure that one does not immediately follow the other in memory + + SpanClass n(buf10); + SpanClass m(buf5, 5); + + CHECK_EQ(n.data(), buf10); + CHECK_EQ(m.data(), buf5); + + CHECK_UNARY(n.is_subspan(n.subspan(0 ))); + CHECK_UNARY(n.is_subspan(n.subspan(0, 3))); + CHECK_UNARY(n.is_subspan(n.subspan(0, 0))); + + CHECK_FALSE(n.is_subspan(m.subspan(0 ))); + CHECK_FALSE(n.is_subspan(m.subspan(0, 3))); + CHECK_FALSE(n.is_subspan(m.subspan(0, 0))); +} + +//----------------------------------------------------------------------------- +TEST_CASE_TEMPLATE("span.compll", SpanClass, span<int>, spanrs<int>, spanrsl<int>) +{ + int buf10[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + SpanClass n(buf10); + + CHECK_EQ(n.compll(n.subspan(0)), n.subspan(0, 0)); + CHECK_EQ(n.is_subspan(n.compll(n.subspan(0))), true); + CHECK_EQ(n.compll(n.subspan(0, 0)), n.subspan(0, 0)); + CHECK_EQ(n.is_subspan(n.compll(n.subspan(0, 0))), true); + + CHECK_EQ(n.compll(n.subspan(0, 1)), n.subspan(0, 0)); + CHECK_EQ(n.compll(n.subspan(0, 3)), n.subspan(0, 0)); + + CHECK_EQ(n.compll(n.range(5, 10)), n.subspan(0, 5)); + CHECK_EQ(n.compll(n.range(5, 5)), n.subspan(0, 5)); + + CHECK_EQ(n.compll(n.subspan(n.size(), 0)), n); + CHECK_EQ(n.compll(n.range(n.size(), n.size())), n); +} + + +//----------------------------------------------------------------------------- + +TEST_CASE_TEMPLATE("span.complr", SpanClass, span<int>, spanrs<int>, spanrsl<int>) +{ + int buf10[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + SpanClass n(buf10); + + CHECK_EQ(n.complr(n.subspan(0)), n.subspan(0, 0)); + CHECK_EQ(n.is_subspan(n.complr(n.subspan(0))), true); + CHECK_EQ(n.complr(n.subspan(0, 0)), n.subspan(0)); + CHECK_EQ(n.is_subspan(n.complr(n.subspan(0, 0))), true); + + CHECK_EQ(n.complr(n.subspan(0, 1)), n.subspan(1)); + CHECK_EQ(n.complr(n.subspan(0, 3)), n.subspan(3)); + + CHECK_EQ(n.complr(n.subspan(5)), n.subspan(0, 0)); + CHECK_EQ(n.complr(n.range(5, 10)), n.subspan(0, 0)); + + CHECK_EQ(n.complr(n.subspan(5, 0)), n.subspan(5)); + CHECK_EQ(n.complr(n.range(5, 5)), n.subspan(5)); + + CHECK_EQ(n.complr(n.subspan(0, 0)), n); + CHECK_EQ(n.complr(n.range(0, 0)), n); +} + + +//----------------------------------------------------------------------------- +TEST_CASE("span.rtrim") +{ + int arr[10]; + span<int> s(arr); + auto ss = s; + + ss.rtrim(0); + CHECK_EQ(ss.size(), s.size()); + CHECK_EQ(ss.capacity(), s.capacity()); + CHECK_EQ(ss.data(), arr); + + ss.rtrim(5); + CHECK_EQ(ss.size(), s.size() - 5); + CHECK_EQ(ss.capacity(), s.capacity() - 5); + CHECK_EQ(ss.data(), arr); +} +TEST_CASE("spanrs.rtrim") +{ + int arr[10]; + spanrs<int> s(arr); + auto ss = s; + + ss.rtrim(0); + CHECK_EQ(ss.size(), s.size()); + CHECK_EQ(ss.capacity(), s.capacity()); + CHECK_EQ(ss.data(), arr); + + ss.rtrim(5); + CHECK_EQ(ss.size(), s.size() - 5); + CHECK_EQ(ss.capacity(), s.capacity()); + CHECK_EQ(ss.data(), arr); +} +TEST_CASE("spanrsl.rtrim") +{ + int arr[10]; + spanrsl<int> s(arr); + auto ss = s; + + ss.rtrim(0); + CHECK_EQ(ss.size(), s.size()); + CHECK_EQ(ss.capacity(), s.capacity()); + CHECK_EQ(ss.data(), arr); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss.rtrim(5); + CHECK_EQ(ss.size(), s.size() - 5); + CHECK_EQ(ss.capacity(), s.capacity()); + CHECK_EQ(ss.data(), arr); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); +} + +//----------------------------------------------------------------------------- +TEST_CASE("span.ltrim") +{ + int arr[10]; + span<int> s(arr); + auto ss = s; + + ss.ltrim(0); + CHECK_EQ(ss.size(), s.size()); + CHECK_EQ(ss.capacity(), s.capacity()); + CHECK_EQ(ss.data(), arr); + + ss.ltrim(5); + CHECK_EQ(ss.size(), s.size() - 5); + CHECK_EQ(ss.capacity(), s.capacity() - 5); + CHECK_EQ(ss.data(), arr + 5); +} +TEST_CASE("spanrs.ltrim") +{ + int arr[10]; + spanrs<int> s(arr); + auto ss = s; + + ss.ltrim(0); + CHECK_EQ(ss.size(), s.size()); + CHECK_EQ(ss.capacity(), ss.capacity()); + CHECK_EQ(ss.data(), arr); + + ss.ltrim(5); + CHECK_EQ(ss.size(), s.size() - 5); + CHECK_EQ(ss.capacity(), s.size() - 5); + CHECK_EQ(ss.data(), arr + 5); +} +TEST_CASE("spanrsl.ltrim") +{ + int arr[10]; + spanrsl<int> s(arr); + auto ss = s; + + ss.ltrim(0); + CHECK_EQ(ss.size(), s.size()); + CHECK_EQ(ss.capacity(), ss.capacity()); + CHECK_EQ(ss.data(), arr); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); + + ss.ltrim(5); + CHECK_EQ(ss.size(), s.size() - 5); + CHECK_EQ(ss.capacity(), s.size() - 5); + CHECK_EQ(ss.data(), arr + 5); + + ss = ss.original(); + CHECK_EQ(ss.size(), 10); + CHECK_EQ(ss.capacity(), 10); + CHECK_EQ(ss.data(), arr); +} + +//----------------------------------------------------------------------------- +const char larrc[11] = "0123456789"; +const char rarrc[11] = "1234567890"; +const int larri[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +const int rarri[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; +TEST_CASE("span.reverse_iter") +{ + cspan<int> s(larri); + REQUIRE_EQ(s.data(), larri); + REQUIRE_EQ(s.begin(), std::begin(larri)); + REQUIRE_EQ(s.end(), std::end(larri)); + REQUIRE_EQ(&*s.rbegin(), s.end()-1); + using rit = cspan<int>::const_reverse_iterator; + int pos = szconv<int>(s.size()) - 1; + size_t count = 0; + //for(rit b = s.rbegin(), e = s.rend(); b != e; ++b) // BUG: b != e is never true on arm-eabi-g++-7 + for(rit b = s.rbegin(), e = s.rend(); b < e; ++b) + { + CHECK_EQ(&(*b), s.data() + pos); + auto spos = szconv<size_t>(pos); + REQUIRE_EQ(&*b, &s[spos]); + REQUIRE_GE(pos, 0); + REQUIRE_LT(pos, szconv<int>(s.size())); + REQUIRE_LT(count, s.size()); + CHECK_EQ(*b, s[spos]); + --pos; + ++count; + } + CHECK_EQ(pos, -1); + CHECK_EQ(count, s.size()); +} + +//----------------------------------------------------------------------------- +TEST_CASE("span_impl.eq") +{ + CHECK_EQ(cspan <char>(larrc), cspan <char>(larrc)); + CHECK_EQ(cspanrs<char>(larrc), cspan <char>(larrc)); + CHECK_EQ(cspan <char>(larrc), cspanrs<char>(larrc)); + CHECK_EQ(cspanrs<char>(larrc), cspanrs<char>(larrc)); + + CHECK_EQ(cspan <int>(larri) , cspan <int>(larri)); + CHECK_EQ(cspanrs<int>(larri) , cspan <int>(larri)); + CHECK_EQ(cspan <int>(larri) , cspanrs<int>(larri)); + CHECK_EQ(cspanrs<int>(larri) , cspanrs<int>(larri)); +} + +TEST_CASE("span_impl.lt") +{ + CHECK_LT(cspan <char>(larrc), cspan <char>(rarrc)); + CHECK_LT(cspanrs<char>(larrc), cspan <char>(rarrc)); + CHECK_LT(cspan <char>(larrc), cspanrs<char>(rarrc)); + CHECK_LT(cspanrs<char>(larrc), cspanrs<char>(rarrc)); + + CHECK_LT(cspan <int>(larri) , cspan <int>(rarri)); + CHECK_LT(cspanrs<int>(larri) , cspan <int>(rarri)); + CHECK_LT(cspan <int>(larri) , cspanrs<int>(rarri)); + CHECK_LT(cspanrs<int>(larri) , cspanrs<int>(rarri)); +} +TEST_CASE("span_impl.gt") +{ + CHECK_GT(cspan <char>(rarrc), cspan <char>(larrc)); + CHECK_GT(cspan <char>(rarrc), cspanrs<char>(larrc)); + CHECK_GT(cspanrs<char>(rarrc), cspan <char>(larrc)); + CHECK_GT(cspanrs<char>(rarrc), cspanrs<char>(larrc)); + + CHECK_GT(cspan <int>(rarri) , cspan <int>(larri)); + CHECK_GT(cspan <int>(rarri) , cspanrs<int>(larri)); + CHECK_GT(cspanrs<int>(rarri) , cspan <int>(larri)); + CHECK_GT(cspanrs<int>(rarri) , cspanrs<int>(larri)); +} + +TEST_CASE("span_impl.ge") +{ + CHECK_GE(cspan <char>(rarrc), cspan <char>(larrc)); + CHECK_GE(cspan <char>(rarrc), cspanrs<char>(larrc)); + CHECK_GE(cspanrs<char>(rarrc), cspan <char>(larrc)); + CHECK_GE(cspanrs<char>(rarrc), cspanrs<char>(larrc)); + CHECK_GE(cspan <char>(larrc), cspan <char>(larrc)); + CHECK_GE(cspan <char>(larrc), cspanrs<char>(larrc)); + CHECK_GE(cspanrs<char>(larrc), cspan <char>(larrc)); + CHECK_GE(cspanrs<char>(larrc), cspanrs<char>(larrc)); + CHECK_GE(cspan <int>(rarri) , cspan <int>(larri)); + CHECK_GE(cspan <int>(rarri) , cspanrs<int>(larri)); + CHECK_GE(cspanrs<int>(rarri) , cspan <int>(larri)); + CHECK_GE(cspanrs<int>(rarri) , cspanrs<int>(larri)); + CHECK_GE(cspan <int>(larri) , cspan <int>(larri)); + CHECK_GE(cspan <int>(larri) , cspanrs<int>(larri)); + CHECK_GE(cspanrs<int>(larri) , cspan <int>(larri)); + CHECK_GE(cspanrs<int>(larri) , cspanrs<int>(larri)); +} +TEST_CASE("span_impl.le") +{ + CHECK_LE(cspan <char>(larrc), cspan <char>(rarrc)); + CHECK_LE(cspanrs<char>(larrc), cspan <char>(rarrc)); + CHECK_LE(cspan <char>(larrc), cspanrs<char>(rarrc)); + CHECK_LE(cspanrs<char>(larrc), cspanrs<char>(rarrc)); + CHECK_LE(cspan <char>(larrc), cspan <char>(larrc)); + CHECK_LE(cspanrs<char>(larrc), cspan <char>(larrc)); + CHECK_LE(cspan <char>(larrc), cspanrs<char>(larrc)); + CHECK_LE(cspanrs<char>(larrc), cspanrs<char>(larrc)); + CHECK_LE(cspan <int>(larri) , cspan <int>(rarri)); + CHECK_LE(cspanrs<int>(larri) , cspan <int>(rarri)); + CHECK_LE(cspan <int>(larri) , cspanrs<int>(rarri)); + CHECK_LE(cspanrs<int>(larri) , cspanrs<int>(rarri)); + CHECK_LE(cspan <int>(larri) , cspan <int>(larri)); + CHECK_LE(cspanrs<int>(larri) , cspan <int>(larri)); + CHECK_LE(cspan <int>(larri) , cspanrs<int>(larri)); + CHECK_LE(cspanrs<int>(larri) , cspanrs<int>(larri)); +} + +} // namespace c4 + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_std_string.cpp b/thirdparty/ryml/ext/c4core/test/test_std_string.cpp new file mode 100644 index 000000000..de5b3739b --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_std_string.cpp @@ -0,0 +1,125 @@ +#include "c4/test.hpp" +#ifndef C4CORE_SINGLE_HEADER +#include "c4/std/string_fwd.hpp" +#include "c4/std/string.hpp" +#endif + +namespace c4 { + +TEST_CASE("std_string.to_substr") +{ + std::string s("barnabe"); + substr ss = to_substr(s); + CHECK_EQ(ss.str, s.data()); + CHECK_EQ(ss.len, s.size()); + s[0] = 'B'; + CHECK_EQ(ss[0], 'B'); + ss[0] = 'b'; + CHECK_EQ(s[0], 'b'); +} + +TEST_CASE("std_string.to_csubstr") +{ + std::string s("barnabe"); + csubstr ss = to_csubstr(s); + CHECK_EQ(ss.str, s.data()); + CHECK_EQ(ss.len, s.size()); + s[0] = 'B'; + CHECK_EQ(ss[0], 'B'); +} + +TEST_CASE("std_string.compare_csubstr") +{ + std::string s0 = "000"; + std::string s1 = "111"; + csubstr ss0 = "000"; + csubstr ss1 = "111"; + CHECK_NE(s0.data(), ss0.data()); + CHECK_NE(s1.data(), ss1.data()); + // + CHECK_EQ(s0, ss0); + CHECK_EQ(s1, ss1); + CHECK_EQ(ss0, s0); + CHECK_EQ(ss1, s1); + // + CHECK_NE(s1, ss0); + CHECK_NE(s0, ss1); + CHECK_NE(ss1, s0); + CHECK_NE(ss0, s1); + // + CHECK_GE(s0, ss0); + CHECK_LE(s1, ss1); + CHECK_GE(ss0, s0); + CHECK_LE(ss1, s1); + CHECK_GE(s1, ss0); + CHECK_LE(s0, ss1); + CHECK_GE(ss1, s0); + CHECK_LE(ss0, s1); + // + CHECK_GT(s1, ss0); + CHECK_LT(s0, ss1); + CHECK_GT(ss1, s0); + CHECK_LT(ss0, s1); +} + +TEST_CASE("std_string.compare_substr") +{ + std::string s0 = "000"; + std::string s1 = "111"; + char buf0[] = "000"; + char buf1[] = "111"; + substr ss0 = buf0; + substr ss1 = buf1; + CHECK_NE(s0.data(), ss0.data()); + CHECK_NE(s1.data(), ss1.data()); + // + CHECK_EQ(s0, ss0); + CHECK_EQ(s1, ss1); + CHECK_EQ(ss0, s0); + CHECK_EQ(ss1, s1); + // + CHECK_NE(s1, ss0); + CHECK_NE(s0, ss1); + CHECK_NE(ss1, s0); + CHECK_NE(ss0, s1); + // + CHECK_GE(s0, ss0); + CHECK_LE(s1, ss1); + CHECK_GE(ss0, s0); + CHECK_LE(ss1, s1); + CHECK_GE(s1, ss0); + CHECK_LE(s0, ss1); + CHECK_GE(ss1, s0); + CHECK_LE(ss0, s1); + // + CHECK_GT(s1, ss0); + CHECK_LT(s0, ss1); + CHECK_GT(ss1, s0); + CHECK_LT(ss0, s1); +} + +TEST_CASE("std_string.to_chars") +{ + const std::string s0 = "000"; + char buf_[100] = {}; + substr buf = buf_; + CHECK_NE(buf.data(), s0.data()); + size_t ret = to_chars({}, s0); + CHECK_EQ(ret, s0.size()); + CHECK_NE(buf.first(ret), s0); + ret = to_chars(buf, s0); + CHECK_EQ(ret, s0.size()); + CHECK_EQ(buf.first(ret), s0); +} + +TEST_CASE("std_string.from_chars") +{ + std::string s0; + csubstr buf = "0123456798"; + CHECK_NE(buf.data(), s0.data()); + bool ok = from_chars(buf, &s0); + CHECK(ok); + CHECK_EQ(buf, s0); +} + +} // namespace c4 diff --git a/thirdparty/ryml/ext/c4core/test/test_std_vector.cpp b/thirdparty/ryml/ext/c4core/test/test_std_vector.cpp new file mode 100644 index 000000000..1cfe54f94 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_std_vector.cpp @@ -0,0 +1,133 @@ +#include "c4/test.hpp" +#ifndef C4CORE_SINGLE_HEADER +#include "c4/std/vector_fwd.hpp" +#include "c4/std/vector.hpp" +#endif + +namespace c4 { + +template<size_t N> +std::vector<char> ctor(const char (&s)[N]) +{ + return std::vector<char>(s, s+N-1); +} + +TEST_CASE("std_vector.to_csubstr") +{ + std::vector<char> s = ctor("barnabe"); + csubstr ss = to_csubstr(s); + CHECK_EQ(ss, csubstr("barnabe")); + CHECK_EQ(ss.str, s.data()); + CHECK_EQ(ss.len, s.size()); +} + +TEST_CASE("std_vector.to_substr") +{ + std::vector<char> s = ctor("barnabe"); + substr ss = to_substr(s); + CHECK_EQ(ss, csubstr("barnabe")); + CHECK_EQ(ss.str, s.data()); + CHECK_EQ(ss.len, s.size()); + // + CHECK_EQ(s[0], 'b'); + ss[0] = 'B'; + CHECK_EQ(s[0], 'B'); + ss[0] = 'A'; + CHECK_EQ(s[0], 'A'); +} + +TEST_CASE("std_vector.compare_csubstr") +{ + std::vector<char> s0 = ctor("000"); + std::vector<char> s1 = ctor("111"); + csubstr ss0 = "000"; + csubstr ss1 = "111"; + CHECK_NE(s0.data(), ss0.data()); + CHECK_NE(s1.data(), ss1.data()); + // + CHECK_EQ(s0, ss0); + CHECK_EQ(s1, ss1); + CHECK_EQ(ss0, s0); + CHECK_EQ(ss1, s1); + // + CHECK_NE(s1, ss0); + CHECK_NE(s0, ss1); + CHECK_NE(ss1, s0); + CHECK_NE(ss0, s1); + // + CHECK_GE(s0, ss0); + CHECK_LE(s1, ss1); + CHECK_GE(ss0, s0); + CHECK_LE(ss1, s1); + CHECK_GE(s1, ss0); + CHECK_LE(s0, ss1); + CHECK_GE(ss1, s0); + CHECK_LE(ss0, s1); + // + CHECK_GT(s1, ss0); + CHECK_LT(s0, ss1); + CHECK_GT(ss1, s0); + CHECK_LT(ss0, s1); +} + +TEST_CASE("std_vector.compare_substr") +{ + std::vector<char> s0 = ctor("000"); + std::vector<char> s1 = ctor("111"); + char buf0[] = "000"; + char buf1[] = "111"; + substr ss0 = buf0; + substr ss1 = buf1; + CHECK_NE(s0.data(), ss0.data()); + CHECK_NE(s1.data(), ss1.data()); + // + CHECK_EQ(s0, ss0); + CHECK_EQ(s1, ss1); + CHECK_EQ(ss0, s0); + CHECK_EQ(ss1, s1); + // + CHECK_NE(s1, ss0); + CHECK_NE(s0, ss1); + CHECK_NE(ss1, s0); + CHECK_NE(ss0, s1); + // + CHECK_GE(s0, ss0); + CHECK_LE(s1, ss1); + CHECK_GE(ss0, s0); + CHECK_LE(ss1, s1); + CHECK_GE(s1, ss0); + CHECK_LE(s0, ss1); + CHECK_GE(ss1, s0); + CHECK_LE(ss0, s1); + // + CHECK_GT(s1, ss0); + CHECK_LT(s0, ss1); + CHECK_GT(ss1, s0); + CHECK_LT(ss0, s1); +} + +TEST_CASE("std_vector.to_chars") +{ + const std::vector<char> s0 = ctor("000"); + char buf_[100] = {}; + substr buf = buf_; + CHECK_NE(buf.data(), s0.data()); + size_t ret = to_chars({}, s0); + CHECK_EQ(ret, s0.size()); + CHECK_NE(buf.first(ret), s0); + ret = to_chars(buf, s0); + CHECK_EQ(ret, s0.size()); + CHECK_EQ(buf.first(ret), s0); +} + +TEST_CASE("std_vector.from_chars") +{ + std::vector<char> s0; + csubstr buf = "0123456798"; + CHECK_NE(buf.data(), s0.data()); + bool ok = from_chars(buf, &s0); + CHECK(ok); + CHECK_EQ(buf, s0); +} + +} // namespace c4 diff --git a/thirdparty/ryml/ext/c4core/test/test_substr.cpp b/thirdparty/ryml/ext/c4core/test/test_substr.cpp new file mode 100644 index 000000000..777b4b4b0 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_substr.cpp @@ -0,0 +1,4507 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/std/std.hpp" +#include "c4/substr.hpp" +#endif + +#include <c4/test.hpp> + +#include "c4/libtest/supprwarn_push.hpp" +#include <iostream> + +namespace c4 { + +TEST_CASE("substr.ctor_from_char") +{ + char buf1[] = "{foo: 1}"; + char buf2[] = "{foo: 2}"; + substr s(buf1); + CHECK_EQ(s, "{foo: 1}"); + s = buf2; + CHECK_EQ(s, "{foo: 2}"); +} + +TEST_CASE("csubstr.ctor_from_char") +{ + char buf1[] = "{foo: 1}"; + char buf2[] = "{foo: 2}"; + csubstr s(buf1); + CHECK_EQ(s, "{foo: 1}"); + s = buf2; + CHECK_EQ(s, "{foo: 2}"); +} + +TEST_CASE("csubstr.empty_vs_null") +{ + csubstr s; + CHECK_UNARY(s.empty()); + CHECK_UNARY(s.len == 0); + CHECK_UNARY(s.str == nullptr); + CHECK_UNARY(s == nullptr); + + s = ""; + CHECK_UNARY(s.empty()); + CHECK_UNARY(s.len == 0); + CHECK_UNARY(s.str != nullptr); + CHECK_UNARY(s != nullptr); + + s = nullptr; + CHECK_UNARY(s.empty()); + CHECK_UNARY(s.len == 0); + CHECK_UNARY(s.str == nullptr); + CHECK_UNARY(s == nullptr); + + s = ""; + CHECK_UNARY(s.empty()); + CHECK_UNARY(s.len == 0); + CHECK_UNARY(s.str != nullptr); + CHECK_UNARY(s != nullptr); + + s = {}; + CHECK_UNARY(s.empty()); + CHECK_UNARY(s.len == 0); + CHECK_UNARY(s.str == nullptr); + CHECK_UNARY(s == nullptr); + + csubstr pp(nullptr); + CHECK_UNARY(pp.empty()); + CHECK_UNARY(pp.len == 0); + CHECK_UNARY(pp.str == nullptr); + CHECK_UNARY(pp == nullptr); +} + +TEST_CASE("substr.is_sub") +{ + csubstr buf = "0123456789"; + + // ref + csubstr s; + csubstr ref = buf.select("345"); + CHECK_EQ(ref, "345"); + CHECK_UNARY(buf.is_super(ref)); + CHECK_UNARY(ref.is_sub(buf)); + CHECK_FALSE(ref.is_super(buf)); + CHECK_FALSE(buf.is_sub(ref)); + + buf.clear(); + ref.clear(); + CHECK_FALSE(buf.is_super(ref)); + CHECK_FALSE(ref.is_super(buf)); + CHECK_FALSE(ref.is_sub(buf)); + CHECK_FALSE(buf.is_sub(ref)); + + buf = ""; + ref = buf; + CHECK_FALSE(buf.is_super("a")); + CHECK_UNARY(buf.is_super(ref)); +} + +TEST_CASE("substr.overlaps") +{ + csubstr buf = "0123456789"; + + // ref + csubstr s; + csubstr ref = buf.select("345"); + CHECK_EQ(ref.len, 3); + CHECK_EQ(ref, "345"); + + // all_left + s = buf.sub(0, 2); + CHECK_EQ(s, "01"); + CHECK_FALSE(ref.overlaps(s)); + CHECK_FALSE(s.overlaps(ref)); + + // all_left_tight + s = buf.sub(0, 3); + CHECK_EQ(s, "012"); + CHECK_FALSE(ref.overlaps(s)); + CHECK_FALSE(s.overlaps(ref)); + + // overlap_left + s = buf.sub(0, 4); + CHECK_EQ(s, "0123"); + CHECK_UNARY(ref.overlaps(s)); + CHECK_UNARY(s.overlaps(ref)); + + // inside_tight_left + s = buf.sub(3, 1); + CHECK_EQ(s, "3"); + CHECK_UNARY(ref.overlaps(s)); + CHECK_UNARY(s.overlaps(ref)); + s = buf.sub(3, 2); + CHECK_EQ(s, "34"); + CHECK_UNARY(ref.overlaps(s)); + CHECK_UNARY(s.overlaps(ref)); + + // all_inside_tight + s = buf.sub(4, 1); + CHECK_EQ(s, "4"); + CHECK_UNARY(ref.overlaps(s)); + CHECK_UNARY(s.overlaps(ref)); + s = buf.sub(3, 3); + CHECK_EQ(s, "345"); + CHECK_UNARY(ref.overlaps(s)); + CHECK_UNARY(s.overlaps(ref)); + + // inside_tight_right + s = buf.sub(4, 2); + CHECK_EQ(s, "45"); + CHECK_UNARY(ref.overlaps(s)); + CHECK_UNARY(s.overlaps(ref)); + s = buf.sub(5, 1); + CHECK_EQ(s, "5"); + CHECK_UNARY(ref.overlaps(s)); + CHECK_UNARY(s.overlaps(ref)); + + // overlap_right + s = buf.sub(5, 2); + CHECK_EQ(s, "56"); + CHECK_UNARY(ref.overlaps(s)); + CHECK_UNARY(s.overlaps(ref)); + s = buf.sub(5, 3); + CHECK_EQ(s, "567"); + CHECK_UNARY(ref.overlaps(s)); + CHECK_UNARY(s.overlaps(ref)); + + // all_right_tight + s = buf.sub(6, 1); + CHECK_EQ(s, "6"); + CHECK_FALSE(ref.overlaps(s)); + CHECK_FALSE(s.overlaps(ref)); + s = buf.sub(6, 2); + CHECK_EQ(s, "67"); + CHECK_FALSE(ref.overlaps(s)); + CHECK_FALSE(s.overlaps(ref)); + + // all_right + s = buf.sub(7, 1); + CHECK_EQ(s, "7"); + CHECK_FALSE(ref.overlaps(s)); + CHECK_FALSE(s.overlaps(ref)); + s = buf.sub(7, 2); + CHECK_EQ(s, "78"); + CHECK_FALSE(ref.overlaps(s)); + CHECK_FALSE(s.overlaps(ref)); + + // null vs null + csubstr n1, n2; + CHECK_EQ(n1.str, nullptr); + CHECK_EQ(n2.str, nullptr); + CHECK_EQ(n1.len, 0); + CHECK_EQ(n2.len, 0); + CHECK_FALSE(n1.overlaps(n2)); + CHECK_FALSE(n2.overlaps(n1)); +} + +TEST_CASE("substr.sub") +{ + CHECK_EQ(csubstr("10]").sub(0, 2), "10"); +} + +TEST_CASE("substr.range") +{ + csubstr s = "0123456789"; + CHECK_EQ(s.range(0, 10), "0123456789"); + CHECK_EQ(s.range(0 ), "0123456789"); + CHECK_EQ(s.range(1, 10), "123456789"); + CHECK_EQ(s.range(1 ), "123456789"); + CHECK_EQ(s.range(2, 10), "23456789"); + CHECK_EQ(s.range(2 ), "23456789"); + CHECK_EQ(s.range(3, 10), "3456789"); + CHECK_EQ(s.range(3 ), "3456789"); + CHECK_EQ(s.range(4, 10), "456789"); + CHECK_EQ(s.range(4 ), "456789"); + CHECK_EQ(s.range(5, 10), "56789"); + CHECK_EQ(s.range(5 ), "56789"); + CHECK_EQ(s.range(6, 10), "6789"); + CHECK_EQ(s.range(6 ), "6789"); + CHECK_EQ(s.range(7, 10), "789"); + CHECK_EQ(s.range(7 ), "789"); + CHECK_EQ(s.range(8, 10), "89"); + CHECK_EQ(s.range(8 ), "89"); + CHECK_EQ(s.range(9, 10), "9"); + CHECK_EQ(s.range(9 ), "9"); + CHECK_EQ(s.range(10, 10), ""); + CHECK_EQ(s.range(10 ), ""); + + CHECK_EQ(s.range(0 , 9), "012345678"); + CHECK_EQ(s.range(1 , 9), "12345678"); + CHECK_EQ(s.range(2 , 9), "2345678"); + CHECK_EQ(s.range(3 , 9), "345678"); + CHECK_EQ(s.range(4 , 9), "45678"); + CHECK_EQ(s.range(5 , 9), "5678"); + CHECK_EQ(s.range(6 , 9), "678"); + CHECK_EQ(s.range(7 , 9), "78"); + CHECK_EQ(s.range(8 , 9), "8"); + CHECK_EQ(s.range(9 , 9), ""); + + CHECK_EQ(s.range(0 , 7), "0123456"); + CHECK_EQ(s.range(1 , 7), "123456"); + CHECK_EQ(s.range(2 , 7), "23456"); + CHECK_EQ(s.range(3 , 7), "3456"); + CHECK_EQ(s.range(4 , 7), "456"); + CHECK_EQ(s.range(5 , 7), "56"); + CHECK_EQ(s.range(6 , 7), "6"); + CHECK_EQ(s.range(7 , 7), ""); + + CHECK_EQ(s.range(0 , 5), "01234"); + CHECK_EQ(s.range(1 , 5), "1234"); + CHECK_EQ(s.range(2 , 5), "234"); + CHECK_EQ(s.range(3 , 5), "34"); + CHECK_EQ(s.range(4 , 5), "4"); + CHECK_EQ(s.range(5 , 5), ""); + + CHECK_EQ(s.range(0 , 3), "012"); + CHECK_EQ(s.range(1 , 3), "12"); + CHECK_EQ(s.range(2 , 3), "2"); + CHECK_EQ(s.range(3 , 3), ""); + + CHECK_EQ(s.range(0 , 2), "01"); + CHECK_EQ(s.range(1 , 2), "1"); + CHECK_EQ(s.range(2 , 2), ""); + + CHECK_EQ(s.range(0 , 1), "0"); + CHECK_EQ(s.range(1 , 1), ""); +} + +TEST_CASE("substr.first") +{ + csubstr s = "0123456789"; + + CHECK_EQ(s.first(csubstr::npos), s); + + CHECK_EQ(s.first(10), "0123456789"); + CHECK_EQ(s.first(9), "012345678"); + CHECK_EQ(s.first(8), "01234567"); + CHECK_EQ(s.first(7), "0123456"); + CHECK_EQ(s.first(6), "012345"); + CHECK_EQ(s.first(5), "01234"); + CHECK_EQ(s.first(4), "0123"); + CHECK_EQ(s.first(3), "012"); + CHECK_EQ(s.first(2), "01"); + CHECK_EQ(s.first(1), "0"); + CHECK_EQ(s.first(0), ""); +} + +TEST_CASE("substr.last") +{ + csubstr s = "0123456789"; + + CHECK_EQ(s.last(csubstr::npos), s); + + CHECK_EQ(s.last(10), "0123456789"); + CHECK_EQ(s.last(9), "123456789"); + CHECK_EQ(s.last(8), "23456789"); + CHECK_EQ(s.last(7), "3456789"); + CHECK_EQ(s.last(6), "456789"); + CHECK_EQ(s.last(5), "56789"); + CHECK_EQ(s.last(4), "6789"); + CHECK_EQ(s.last(3), "789"); + CHECK_EQ(s.last(2), "89"); + CHECK_EQ(s.last(1), "9"); + CHECK_EQ(s.last(0), ""); +} + +TEST_CASE("substr.offs") +{ + csubstr s = "0123456789"; + + CHECK_EQ(s.offs(0, 0), s); + + CHECK_EQ(s.offs(1, 0), "123456789"); + CHECK_EQ(s.offs(0, 1), "012345678"); + CHECK_EQ(s.offs(1, 1), "12345678"); + + CHECK_EQ(s.offs(1, 2), "1234567"); + CHECK_EQ(s.offs(2, 1), "2345678"); + CHECK_EQ(s.offs(2, 2), "234567"); + + CHECK_EQ(s.offs(2, 3), "23456"); + CHECK_EQ(s.offs(3, 2), "34567"); + CHECK_EQ(s.offs(3, 3), "3456"); + + CHECK_EQ(s.offs(3, 4), "345"); + CHECK_EQ(s.offs(4, 3), "456"); + CHECK_EQ(s.offs(4, 4), "45"); + + CHECK_EQ(s.offs(4, 5), "4"); + CHECK_EQ(s.offs(5, 4), "5"); + CHECK_EQ(s.offs(5, 5), ""); +} + +TEST_CASE("substr.count") +{ + csubstr buf = "0123456789"; + + CHECK_EQ(buf.count('0'), 1); + CHECK_EQ(buf.count('0', 0), 1); + CHECK_EQ(buf.count('0', 1), 0); + CHECK_EQ(buf.count('0', buf.len), 0); + + CHECK_EQ(buf.count("01"), 1); + CHECK_EQ(buf.count("01", 0), 1); + CHECK_EQ(buf.count("01", 1), 0); + CHECK_EQ(buf.count("01", buf.len), 0); + + CHECK_EQ(buf.count('1'), 1); + CHECK_EQ(buf.count('1', 0), 1); + CHECK_EQ(buf.count('1', 1), 1); + CHECK_EQ(buf.count('1', 2), 0); + CHECK_EQ(buf.count('1', buf.len), 0); + + CHECK_EQ(buf.count("12"), 1); + CHECK_EQ(buf.count("12", 0), 1); + CHECK_EQ(buf.count("12", 1), 1); + CHECK_EQ(buf.count("12", 2), 0); + CHECK_EQ(buf.count("12", buf.len), 0); + + CHECK_EQ(buf.count('2'), 1); + CHECK_EQ(buf.count('2', 0), 1); + CHECK_EQ(buf.count('2', 1), 1); + CHECK_EQ(buf.count('2', 2), 1); + CHECK_EQ(buf.count('2', 3), 0); + CHECK_EQ(buf.count('2', buf.len), 0); + + CHECK_EQ(buf.count("23"), 1); + CHECK_EQ(buf.count("23", 0), 1); + CHECK_EQ(buf.count("23", 1), 1); + CHECK_EQ(buf.count("23", 2), 1); + CHECK_EQ(buf.count("23", 3), 0); + CHECK_EQ(buf.count("23", buf.len), 0); + + CHECK_EQ(buf.count('3'), 1); + CHECK_EQ(buf.count('3', 0), 1); + CHECK_EQ(buf.count('3', 1), 1); + CHECK_EQ(buf.count('3', 2), 1); + CHECK_EQ(buf.count('3', 3), 1); + CHECK_EQ(buf.count('3', 4), 0); + CHECK_EQ(buf.count('3', buf.len), 0); + + CHECK_EQ(buf.count("34"), 1); + CHECK_EQ(buf.count("34", 0), 1); + CHECK_EQ(buf.count("34", 1), 1); + CHECK_EQ(buf.count("34", 2), 1); + CHECK_EQ(buf.count("34", 3), 1); + CHECK_EQ(buf.count("34", 4), 0); + CHECK_EQ(buf.count("34", buf.len), 0); + + CHECK_EQ(buf.count('4'), 1); + CHECK_EQ(buf.count('4', 0), 1); + CHECK_EQ(buf.count('4', 1), 1); + CHECK_EQ(buf.count('4', 2), 1); + CHECK_EQ(buf.count('4', 3), 1); + CHECK_EQ(buf.count('4', 4), 1); + CHECK_EQ(buf.count('4', 5), 0); + CHECK_EQ(buf.count('4', buf.len), 0); + + CHECK_EQ(buf.count("45"), 1); + CHECK_EQ(buf.count("45", 0), 1); + CHECK_EQ(buf.count("45", 1), 1); + CHECK_EQ(buf.count("45", 2), 1); + CHECK_EQ(buf.count("45", 3), 1); + CHECK_EQ(buf.count("45", 4), 1); + CHECK_EQ(buf.count("45", 5), 0); + CHECK_EQ(buf.count("45", buf.len), 0); + + CHECK_EQ(buf.count('5'), 1); + CHECK_EQ(buf.count('5', 0), 1); + CHECK_EQ(buf.count('5', 1), 1); + CHECK_EQ(buf.count('5', 2), 1); + CHECK_EQ(buf.count('5', 3), 1); + CHECK_EQ(buf.count('5', 4), 1); + CHECK_EQ(buf.count('5', 5), 1); + CHECK_EQ(buf.count('5', 6), 0); + CHECK_EQ(buf.count('5', buf.len), 0); + + CHECK_EQ(buf.count("56"), 1); + CHECK_EQ(buf.count("56", 0), 1); + CHECK_EQ(buf.count("56", 1), 1); + CHECK_EQ(buf.count("56", 2), 1); + CHECK_EQ(buf.count("56", 3), 1); + CHECK_EQ(buf.count("56", 4), 1); + CHECK_EQ(buf.count("56", 5), 1); + CHECK_EQ(buf.count("56", 6), 0); + CHECK_EQ(buf.count("56", buf.len), 0); + + CHECK_EQ(buf.count('a'), 0); + CHECK_EQ(buf.count('a', 0), 0); + CHECK_EQ(buf.count('a', 1), 0); + CHECK_EQ(buf.count('a', 2), 0); + CHECK_EQ(buf.count('a', 3), 0); + CHECK_EQ(buf.count('a', 4), 0); + CHECK_EQ(buf.count('a', 5), 0); + CHECK_EQ(buf.count('a', 6), 0); + CHECK_EQ(buf.count('a', buf.len), 0); + + CHECK_EQ(buf.count("ab"), 0); + CHECK_EQ(buf.count("ab", 0), 0); + CHECK_EQ(buf.count("ab", 1), 0); + CHECK_EQ(buf.count("ab", 2), 0); + CHECK_EQ(buf.count("ab", 3), 0); + CHECK_EQ(buf.count("ab", 4), 0); + CHECK_EQ(buf.count("ab", 5), 0); + CHECK_EQ(buf.count("ab", 6), 0); + CHECK_EQ(buf.count("ab", buf.len), 0); + + buf = "00110022003300440055"; + CHECK_EQ(buf.count('0', 0), 10); + CHECK_EQ(buf.count('0', 1), 9); + CHECK_EQ(buf.count('0', 2), 8); + CHECK_EQ(buf.count('0', 3), 8); + CHECK_EQ(buf.count('0', 4), 8); + CHECK_EQ(buf.count('0', 5), 7); + CHECK_EQ(buf.count('0', 6), 6); + CHECK_EQ(buf.count('0', 7), 6); + CHECK_EQ(buf.count('0', 8), 6); + CHECK_EQ(buf.count('0', 9), 5); + CHECK_EQ(buf.count('0', 10), 4); + CHECK_EQ(buf.count('0', 11), 4); + CHECK_EQ(buf.count('0', 12), 4); + CHECK_EQ(buf.count('0', 13), 3); + CHECK_EQ(buf.count('0', 14), 2); + CHECK_EQ(buf.count('0', 15), 2); + CHECK_EQ(buf.count('0', 16), 2); + CHECK_EQ(buf.count('0', 17), 1); + CHECK_EQ(buf.count('0', 18), 0); + CHECK_EQ(buf.count('0', 19), 0); + CHECK_EQ(buf.count('0', 20), 0); + + CHECK_EQ(buf.count('1', 0), 2); + CHECK_EQ(buf.count('1', 1), 2); + CHECK_EQ(buf.count('1', 2), 2); + CHECK_EQ(buf.count('1', 3), 1); + CHECK_EQ(buf.count('1', 4), 0); + CHECK_EQ(buf.count('1', 5), 0); + + CHECK_EQ(buf.count("01" ), 1); + CHECK_EQ(buf.count("01", 2), 0); + CHECK_EQ(buf.count("10" ), 1); + CHECK_EQ(buf.count("10", 4), 0); + CHECK_EQ(buf.count("00", 0), 5); + CHECK_EQ(buf.count("00", 1), 4); + CHECK_EQ(buf.count("00", 2), 4); + CHECK_EQ(buf.count("00", 3), 4); + CHECK_EQ(buf.count("00", 4), 4); + CHECK_EQ(buf.count("00", 5), 3); + CHECK_EQ(buf.count("00", 6), 3); + CHECK_EQ(buf.count("00", 7), 3); + CHECK_EQ(buf.count("00", 8), 3); + CHECK_EQ(buf.count("00", 9), 2); + CHECK_EQ(buf.count("00", 10), 2); + CHECK_EQ(buf.count("00", 11), 2); + CHECK_EQ(buf.count("00", 12), 2); + CHECK_EQ(buf.count("00", 13), 1); + CHECK_EQ(buf.count("00", 14), 1); + CHECK_EQ(buf.count("00", 15), 1); + CHECK_EQ(buf.count("00", 16), 1); + CHECK_EQ(buf.count("00", 17), 0); + CHECK_EQ(buf.count("00", 18), 0); + CHECK_EQ(buf.count("00", 19), 0); + CHECK_EQ(buf.count("00", 20), 0); +} + +TEST_CASE("substr.select") +{ + csubstr buf = "0123456789"; + + CHECK_EQ(buf.select('0'), "0"); + CHECK_EQ(buf.select('1'), "1"); + CHECK_EQ(buf.select('2'), "2"); + CHECK_EQ(buf.select('8'), "8"); + CHECK_EQ(buf.select('9'), "9"); + + CHECK_EQ(buf.select('a').str, nullptr); + CHECK_EQ(buf.select('a').len, 0); + CHECK_EQ(buf.select('a'), ""); + + CHECK_EQ(buf.select("a").str, nullptr); + CHECK_EQ(buf.select("a").len, 0); + CHECK_EQ(buf.select("a"), ""); + + CHECK_EQ(buf.select("0"), "0"); + CHECK_EQ(buf.select("0").str, buf.str+0); + CHECK_EQ(buf.select("0").len, 1); + + CHECK_EQ(buf.select("1"), "1"); + CHECK_EQ(buf.select("1").str, buf.str+1); + CHECK_EQ(buf.select("1").len, 1); + + CHECK_EQ(buf.select("2"), "2"); + CHECK_EQ(buf.select("2").str, buf.str+2); + CHECK_EQ(buf.select("2").len, 1); + + CHECK_EQ(buf.select("9"), "9"); + CHECK_EQ(buf.select("9").str, buf.str+9); + CHECK_EQ(buf.select("9").len, 1); + + CHECK_EQ(buf.select("012"), "012"); + CHECK_EQ(buf.select("012").str, buf.str+0); + CHECK_EQ(buf.select("012").len, 3); + + CHECK_EQ(buf.select("345"), "345"); + CHECK_EQ(buf.select("345").str, buf.str+3); + CHECK_EQ(buf.select("345").len, 3); + + CHECK_EQ(buf.select("789"), "789"); + CHECK_EQ(buf.select("789").str, buf.str+7); + CHECK_EQ(buf.select("789").len, 3); + + CHECK_EQ(buf.select("89a"), ""); + CHECK_EQ(buf.select("89a").str, nullptr); + CHECK_EQ(buf.select("89a").len, 0); +} + +TEST_CASE("substr.begins_with") +{ + CHECK (csubstr(": ").begins_with(":" )); + CHECK (csubstr(": ").begins_with(':' )); + CHECK_FALSE(csubstr(":") .begins_with(": ")); + + CHECK (csubstr( "1234").begins_with('0', 0)); + CHECK (csubstr( "01234").begins_with('0', 1)); + CHECK_FALSE(csubstr( "01234").begins_with('0', 2)); + CHECK (csubstr( "001234").begins_with('0', 1)); + CHECK (csubstr( "001234").begins_with('0', 2)); + CHECK_FALSE(csubstr( "001234").begins_with('0', 3)); + CHECK (csubstr( "0001234").begins_with('0', 1)); + CHECK (csubstr( "0001234").begins_with('0', 2)); + CHECK (csubstr( "0001234").begins_with('0', 3)); + CHECK_FALSE(csubstr( "0001234").begins_with('0', 4)); + CHECK (csubstr("00001234").begins_with('0', 1)); + CHECK (csubstr("00001234").begins_with('0', 2)); + CHECK (csubstr("00001234").begins_with('0', 3)); + CHECK (csubstr("00001234").begins_with('0', 4)); + CHECK_FALSE(csubstr("00001234").begins_with('0', 5)); +} + +TEST_CASE("substr.ends_with") +{ + CHECK_UNARY(csubstr("{% if foo %}bar{% endif %}").ends_with("{% endif %}")); + + CHECK (csubstr("1234" ).ends_with('0', 0)); + CHECK (csubstr("12340" ).ends_with('0', 1)); + CHECK_FALSE(csubstr("12340" ).ends_with('0', 2)); + CHECK (csubstr("123400" ).ends_with('0', 1)); + CHECK (csubstr("123400" ).ends_with('0', 2)); + CHECK_FALSE(csubstr("123400" ).ends_with('0', 3)); + CHECK (csubstr("1234000" ).ends_with('0', 1)); + CHECK (csubstr("1234000" ).ends_with('0', 2)); + CHECK (csubstr("1234000" ).ends_with('0', 3)); + CHECK_FALSE(csubstr("1234000" ).ends_with('0', 4)); + CHECK (csubstr("12340000").ends_with('0', 1)); + CHECK (csubstr("12340000").ends_with('0', 2)); + CHECK (csubstr("12340000").ends_with('0', 3)); + CHECK (csubstr("12340000").ends_with('0', 4)); + CHECK_FALSE(csubstr("12340000").ends_with('0', 5)); +} + +TEST_CASE("substr.find") +{ + csubstr s012345 = "012345"; + CHECK(s012345.find('a') == csubstr::npos); + CHECK(s012345.find('0' ) == 0u); + CHECK(s012345.find('0', 1u) == csubstr::npos); + CHECK(s012345.find('1' ) == 1u); + CHECK(s012345.find('1', 2u) == csubstr::npos); + CHECK(s012345.find('2' ) == 2u); + CHECK(s012345.find('2', 3u) == csubstr::npos); + CHECK(s012345.find('3' ) == 3u); + CHECK(s012345.find('3', 4u) == csubstr::npos); + CHECK(s012345.find("ab" ) == csubstr::npos); + CHECK(s012345.find("01" ) == 0u); + CHECK(s012345.find("01", 1u) == csubstr::npos); + CHECK(s012345.find("12" ) == 1u); + CHECK(s012345.find("12", 2u) == csubstr::npos); + CHECK(s012345.find("23" ) == 2u); + CHECK(s012345.find("23", 3u) == csubstr::npos); +} + +TEST_CASE("substr.first_of") +{ + size_t npos = csubstr::npos; + + CHECK_EQ(csubstr("012345").first_of('a'), npos); + CHECK_EQ(csubstr("012345").first_of("ab"), npos); + + CHECK_EQ(csubstr("012345").first_of('0'), 0u); + CHECK_EQ(csubstr("012345").first_of("0"), 0u); + CHECK_EQ(csubstr("012345").first_of("01"), 0u); + CHECK_EQ(csubstr("012345").first_of("10"), 0u); + CHECK_EQ(csubstr("012345").first_of("012"), 0u); + CHECK_EQ(csubstr("012345").first_of("210"), 0u); + CHECK_EQ(csubstr("012345").first_of("0123"), 0u); + CHECK_EQ(csubstr("012345").first_of("3210"), 0u); + CHECK_EQ(csubstr("012345").first_of("01234"), 0u); + CHECK_EQ(csubstr("012345").first_of("43210"), 0u); + CHECK_EQ(csubstr("012345").first_of("012345"), 0u); + CHECK_EQ(csubstr("012345").first_of("543210"), 0u); + + CHECK_EQ(csubstr("012345").first_of('0', 2u), npos); + CHECK_EQ(csubstr("012345").first_of("0", 2u), npos); + CHECK_EQ(csubstr("012345").first_of("01", 2u), npos); + CHECK_EQ(csubstr("012345").first_of("10", 2u), npos); + CHECK_EQ(csubstr("012345").first_of("012", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("210", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("0123", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("3210", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("01234", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("43210", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("012345", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("543210", 2u), 2u); + + CHECK_EQ(csubstr("012345").first_of('5'), 5u); + CHECK_EQ(csubstr("012345").first_of("5"), 5u); + CHECK_EQ(csubstr("012345").first_of("45"), 4u); + CHECK_EQ(csubstr("012345").first_of("54"), 4u); + CHECK_EQ(csubstr("012345").first_of("345"), 3u); + CHECK_EQ(csubstr("012345").first_of("543"), 3u); + CHECK_EQ(csubstr("012345").first_of("2345"), 2u); + CHECK_EQ(csubstr("012345").first_of("5432"), 2u); + CHECK_EQ(csubstr("012345").first_of("12345"), 1u); + CHECK_EQ(csubstr("012345").first_of("54321"), 1u); + CHECK_EQ(csubstr("012345").first_of("012345"), 0u); + CHECK_EQ(csubstr("012345").first_of("543210"), 0u); + + CHECK_EQ(csubstr("012345").first_of('5', 2u), 5u); + CHECK_EQ(csubstr("012345").first_of("5", 2u), 5u); + CHECK_EQ(csubstr("012345").first_of("45", 2u), 4u); + CHECK_EQ(csubstr("012345").first_of("54", 2u), 4u); + CHECK_EQ(csubstr("012345").first_of("345", 2u), 3u); + CHECK_EQ(csubstr("012345").first_of("543", 2u), 3u); + CHECK_EQ(csubstr("012345").first_of("2345", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("5432", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("12345", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("54321", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("012345", 2u), 2u); + CHECK_EQ(csubstr("012345").first_of("543210", 2u), 2u); + + CHECK_EQ(csubstr{}.first_of('0'), npos); + CHECK_EQ(csubstr{}.first_of('0', 0u), npos); + CHECK_EQ(csubstr("012345").first_of('0', 6u), npos); + CHECK_EQ(csubstr("012345").first_of('5', 6u), npos); + CHECK_EQ(csubstr("012345").first_of("012345", 6u), npos); +} + +TEST_CASE("substr.last_of") +{ + size_t npos = csubstr::npos; + + CHECK_EQ(csubstr("012345").last_of('a'), npos); + CHECK_EQ(csubstr("012345").last_of("ab"), npos); + + CHECK_EQ(csubstr("012345").last_of('0'), 0u); + CHECK_EQ(csubstr("012345").last_of("0"), 0u); + CHECK_EQ(csubstr("012345").last_of("01"), 1u); + CHECK_EQ(csubstr("012345").last_of("10"), 1u); + CHECK_EQ(csubstr("012345").last_of("012"), 2u); + CHECK_EQ(csubstr("012345").last_of("210"), 2u); + CHECK_EQ(csubstr("012345").last_of("0123"), 3u); + CHECK_EQ(csubstr("012345").last_of("3210"), 3u); + CHECK_EQ(csubstr("012345").last_of("01234"), 4u); + CHECK_EQ(csubstr("012345").last_of("43210"), 4u); + CHECK_EQ(csubstr("012345").last_of("012345"), 5u); + CHECK_EQ(csubstr("012345").last_of("543210"), 5u); + + CHECK_EQ(csubstr("012345").last_of('0', 2u), 0u); + CHECK_EQ(csubstr("012345").last_of("0", 2u), 0u); + CHECK_EQ(csubstr("012345").last_of("01", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("10", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("012", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("210", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("0123", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("3210", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("01234", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("43210", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("012345", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("543210", 2u), 1u); + + CHECK_EQ(csubstr("012345").last_of('5'), 5u); + CHECK_EQ(csubstr("012345").last_of("5"), 5u); + CHECK_EQ(csubstr("012345").last_of("45"), 5u); + CHECK_EQ(csubstr("012345").last_of("54"), 5u); + CHECK_EQ(csubstr("012345").last_of("345"), 5u); + CHECK_EQ(csubstr("012345").last_of("543"), 5u); + CHECK_EQ(csubstr("012345").last_of("2345"), 5u); + CHECK_EQ(csubstr("012345").last_of("5432"), 5u); + CHECK_EQ(csubstr("012345").last_of("12345"), 5u); + CHECK_EQ(csubstr("012345").last_of("54321"), 5u); + CHECK_EQ(csubstr("012345").last_of("012345"), 5u); + CHECK_EQ(csubstr("012345").last_of("543210"), 5u); + + CHECK_EQ(csubstr("012345").last_of('5', 2u), npos); + CHECK_EQ(csubstr("012345").last_of("5", 2u), npos); + CHECK_EQ(csubstr("012345").last_of("45", 2u), npos); + CHECK_EQ(csubstr("012345").last_of("54", 2u), npos); + CHECK_EQ(csubstr("012345").last_of("345", 2u), npos); + CHECK_EQ(csubstr("012345").last_of("543", 2u), npos); + CHECK_EQ(csubstr("012345").last_of("2345", 2u), npos); + CHECK_EQ(csubstr("012345").last_of("5432", 2u), npos); + CHECK_EQ(csubstr("012345").last_of("12345", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("54321", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("012345", 2u), 1u); + CHECK_EQ(csubstr("012345").last_of("543210", 2u), 1u); + + CHECK_EQ(csubstr{}.last_of('?'), npos); + CHECK_EQ(csubstr("012345").last_of('0', 6u), 0u); + CHECK_EQ(csubstr("012345").last_of('5', 6u), 5u); + CHECK_EQ(csubstr("012345").last_of("012345", 6u), 5u); +} + +TEST_CASE("substr.first_not_of") +{ + size_t npos = csubstr::npos; + + CHECK_EQ(csubstr("012345").first_not_of('a'), 0u); + CHECK_EQ(csubstr("012345").first_not_of("ab"), 0u); + + CHECK_EQ(csubstr("012345").first_not_of('0'), 1u); + CHECK_EQ(csubstr("012345").first_not_of("0"), 1u); + CHECK_EQ(csubstr("012345").first_not_of("01"), 2u); + CHECK_EQ(csubstr("012345").first_not_of("10"), 2u); + CHECK_EQ(csubstr("012345").first_not_of("012"), 3u); + CHECK_EQ(csubstr("012345").first_not_of("210"), 3u); + CHECK_EQ(csubstr("012345").first_not_of("0123"), 4u); + CHECK_EQ(csubstr("012345").first_not_of("3210"), 4u); + CHECK_EQ(csubstr("012345").first_not_of("01234"), 5u); + CHECK_EQ(csubstr("012345").first_not_of("43210"), 5u); + CHECK_EQ(csubstr("012345").first_not_of("012345"), npos); + CHECK_EQ(csubstr("012345").first_not_of("543210"), npos); + + CHECK_EQ(csubstr("012345").first_not_of('0', 2u), 2u); + CHECK_EQ(csubstr("012345").first_not_of("0", 2u), 2u); + CHECK_EQ(csubstr("012345").first_not_of("01", 2u), 2u); + CHECK_EQ(csubstr("012345").first_not_of("10", 2u), 2u); + CHECK_EQ(csubstr("012345").first_not_of("012", 2u), 3u); + CHECK_EQ(csubstr("012345").first_not_of("210", 2u), 3u); + CHECK_EQ(csubstr("012345").first_not_of("0123", 2u), 4u); + CHECK_EQ(csubstr("012345").first_not_of("3210", 2u), 4u); + CHECK_EQ(csubstr("012345").first_not_of("01234", 2u), 5u); + CHECK_EQ(csubstr("012345").first_not_of("43210", 2u), 5u); + CHECK_EQ(csubstr("012345").first_not_of("012345", 2u), npos); + CHECK_EQ(csubstr("012345").first_not_of("543210", 2u), npos); + + CHECK_EQ(csubstr("012345").first_not_of('5'), 0u); + CHECK_EQ(csubstr("012345").first_not_of("5"), 0u); + CHECK_EQ(csubstr("012345").first_not_of("45"), 0u); + CHECK_EQ(csubstr("012345").first_not_of("54"), 0u); + CHECK_EQ(csubstr("012345").first_not_of("345"), 0u); + CHECK_EQ(csubstr("012345").first_not_of("543"), 0u); + CHECK_EQ(csubstr("012345").first_not_of("2345"), 0u); + CHECK_EQ(csubstr("012345").first_not_of("5432"), 0u); + CHECK_EQ(csubstr("012345").first_not_of("12345"), 0u); + CHECK_EQ(csubstr("012345").first_not_of("54321"), 0u); + CHECK_EQ(csubstr("012345").first_not_of("012345"), npos); + CHECK_EQ(csubstr("012345").first_not_of("543210"), npos); + + CHECK_EQ(csubstr("012345").first_not_of('5', 2u), 2u); + CHECK_EQ(csubstr("012345").first_not_of("5", 2u), 2u); + CHECK_EQ(csubstr("012345").first_not_of("45", 2u), 2u); + CHECK_EQ(csubstr("012345").first_not_of("54", 2u), 2u); + CHECK_EQ(csubstr("012345").first_not_of("345", 2u), 2u); + CHECK_EQ(csubstr("012345").first_not_of("543", 2u), 2u); + CHECK_EQ(csubstr("012345").first_not_of("2345", 2u), npos); + CHECK_EQ(csubstr("012345").first_not_of("5432", 2u), npos); + CHECK_EQ(csubstr("012345").first_not_of("12345", 2u), npos); + CHECK_EQ(csubstr("012345").first_not_of("54321", 2u), npos); + CHECK_EQ(csubstr("012345").first_not_of("012345", 2u), npos); + CHECK_EQ(csubstr("012345").first_not_of("543210", 2u), npos); + + CHECK_EQ(csubstr("").first_not_of('0', 0u), npos); + CHECK_EQ(csubstr("012345").first_not_of('5', 6u), npos); + CHECK_EQ(csubstr("012345").first_not_of("012345", 6u), npos); +} + +TEST_CASE("substr.last_not_of") +{ + size_t npos = csubstr::npos; + + CHECK_EQ(csubstr("012345").last_not_of('a'), 5u); + CHECK_EQ(csubstr("012345").last_not_of("ab"), 5u); + + CHECK_EQ(csubstr("012345").last_not_of('5'), 4u); + CHECK_EQ(csubstr("012345").last_not_of("5"), 4u); + CHECK_EQ(csubstr("012345").last_not_of("45"), 3u); + CHECK_EQ(csubstr("012345").last_not_of("54"), 3u); + CHECK_EQ(csubstr("012345").last_not_of("345"), 2u); + CHECK_EQ(csubstr("012345").last_not_of("543"), 2u); + CHECK_EQ(csubstr("012345").last_not_of("2345"), 1u); + CHECK_EQ(csubstr("012345").last_not_of("5432"), 1u); + CHECK_EQ(csubstr("012345").last_not_of("12345"), 0u); + CHECK_EQ(csubstr("012345").last_not_of("54321"), 0u); + CHECK_EQ(csubstr("012345").last_not_of("012345"), npos); + CHECK_EQ(csubstr("012345").last_not_of("543210"), npos); + + CHECK_EQ(csubstr("012345").last_not_of('5', 2u), 1u); + CHECK_EQ(csubstr("012345").last_not_of("5", 2u), 1u); + CHECK_EQ(csubstr("012345").last_not_of("45", 2u), 1u); + CHECK_EQ(csubstr("012345").last_not_of("54", 2u), 1u); + CHECK_EQ(csubstr("012345").last_not_of("345", 2u), 1u); + CHECK_EQ(csubstr("012345").last_not_of("543", 2u), 1u); + CHECK_EQ(csubstr("012345").last_not_of("2345", 2u), 1u); + CHECK_EQ(csubstr("012345").last_not_of("5432", 2u), 1u); + CHECK_EQ(csubstr("012345").last_not_of("12345", 2u), 0u); + CHECK_EQ(csubstr("012345").last_not_of("54321", 2u), 0u); + CHECK_EQ(csubstr("012345").last_not_of("012345", 2u), npos); + CHECK_EQ(csubstr("012345").last_not_of("543210", 2u), npos); + + CHECK_EQ(csubstr("012345").last_not_of('0'), 5u); + CHECK_EQ(csubstr("012345").last_not_of("0"), 5u); + CHECK_EQ(csubstr("012345").last_not_of("01"), 5u); + CHECK_EQ(csubstr("012345").last_not_of("10"), 5u); + CHECK_EQ(csubstr("012345").last_not_of("012"), 5u); + CHECK_EQ(csubstr("012345").last_not_of("210"), 5u); + CHECK_EQ(csubstr("012345").last_not_of("0123"), 5u); + CHECK_EQ(csubstr("012345").last_not_of("3210"), 5u); + CHECK_EQ(csubstr("012345").last_not_of("01234"), 5u); + CHECK_EQ(csubstr("012345").last_not_of("43210"), 5u); + CHECK_EQ(csubstr("012345").last_not_of("012345"), npos); + CHECK_EQ(csubstr("012345").last_not_of("543210"), npos); + + CHECK_EQ(csubstr("012345").last_not_of('0', 2u), 1u); + CHECK_EQ(csubstr("012345").last_not_of("0", 2u), 1u); + CHECK_EQ(csubstr("012345").last_not_of("01", 2u), npos); + CHECK_EQ(csubstr("012345").last_not_of("10", 2u), npos); + CHECK_EQ(csubstr("012345").last_not_of("012", 2u), npos); + CHECK_EQ(csubstr("012345").last_not_of("210", 2u), npos); + CHECK_EQ(csubstr("012345").last_not_of("0123", 2u), npos); + CHECK_EQ(csubstr("012345").last_not_of("3210", 2u), npos); + CHECK_EQ(csubstr("012345").last_not_of("01234", 2u), npos); + CHECK_EQ(csubstr("012345").last_not_of("43210", 2u), npos); + CHECK_EQ(csubstr("012345").last_not_of("012345", 2u), npos); + CHECK_EQ(csubstr("012345").last_not_of("543210", 2u), npos); + + CHECK_EQ(csubstr("").last_not_of('0', 0u), npos); + CHECK_EQ(csubstr("012345").last_not_of('5', 6u), 4u); +} + +TEST_CASE("substr.left_of") +{ + csubstr s = "012345"; + + CHECK_EQ(s.left_of(csubstr::npos), s); + CHECK_EQ(s.left_of(csubstr::npos, /*include_pos*/false), s); + CHECK_EQ(s.left_of(csubstr::npos, /*include_pos*/true), s); + + + CHECK_EQ(s.left_of(0), ""); + CHECK_EQ(s.left_of(1), "0"); + CHECK_EQ(s.left_of(2), "01"); + CHECK_EQ(s.left_of(3), "012"); + CHECK_EQ(s.left_of(4), "0123"); + CHECK_EQ(s.left_of(5), "01234"); + CHECK_EQ(s.left_of(6), "012345"); + + CHECK_EQ(s.left_of(0, /*include_pos*/false), ""); + CHECK_EQ(s.left_of(1, /*include_pos*/false), "0"); + CHECK_EQ(s.left_of(2, /*include_pos*/false), "01"); + CHECK_EQ(s.left_of(3, /*include_pos*/false), "012"); + CHECK_EQ(s.left_of(4, /*include_pos*/false), "0123"); + CHECK_EQ(s.left_of(5, /*include_pos*/false), "01234"); + CHECK_EQ(s.left_of(6, /*include_pos*/false), "012345"); + + CHECK_UNARY(s.is_super(s.left_of(0, /*include_pos*/false))); + CHECK_UNARY(s.is_super(s.left_of(1, /*include_pos*/false))); + CHECK_UNARY(s.is_super(s.left_of(2, /*include_pos*/false))); + CHECK_UNARY(s.is_super(s.left_of(3, /*include_pos*/false))); + CHECK_UNARY(s.is_super(s.left_of(4, /*include_pos*/false))); + + + CHECK_EQ(s.left_of(0, /*include_pos*/true), "0"); + CHECK_EQ(s.left_of(1, /*include_pos*/true), "01"); + CHECK_EQ(s.left_of(2, /*include_pos*/true), "012"); + CHECK_EQ(s.left_of(3, /*include_pos*/true), "0123"); + CHECK_EQ(s.left_of(4, /*include_pos*/true), "01234"); + CHECK_EQ(s.left_of(5, /*include_pos*/true), "012345"); + + CHECK_UNARY(s.is_super(s.left_of(0, /*include_pos*/true))); + CHECK_UNARY(s.is_super(s.left_of(1, /*include_pos*/true))); + CHECK_UNARY(s.is_super(s.left_of(2, /*include_pos*/true))); + CHECK_UNARY(s.is_super(s.left_of(3, /*include_pos*/true))); + CHECK_UNARY(s.is_super(s.left_of(4, /*include_pos*/true))); + + + CHECK_EQ(s.sub(5), "5"); + CHECK_EQ(s.sub(4), "45"); + CHECK_EQ(s.sub(3), "345"); + CHECK_EQ(s.sub(2), "2345"); + CHECK_EQ(s.sub(1), "12345"); + CHECK_EQ(s.sub(0), "012345"); + + CHECK_EQ(s.left_of(s.sub(5)), "01234"); + CHECK_EQ(s.left_of(s.sub(4)), "0123"); + CHECK_EQ(s.left_of(s.sub(3)), "012"); + CHECK_EQ(s.left_of(s.sub(2)), "01"); + CHECK_EQ(s.left_of(s.sub(1)), "0"); + CHECK_EQ(s.left_of(s.sub(0)), ""); + + CHECK_UNARY(s.is_super(s.left_of(s.sub(5)))); + CHECK_UNARY(s.is_super(s.left_of(s.sub(4)))); + CHECK_UNARY(s.is_super(s.left_of(s.sub(3)))); + CHECK_UNARY(s.is_super(s.left_of(s.sub(2)))); + CHECK_UNARY(s.is_super(s.left_of(s.sub(1)))); + CHECK_UNARY(s.is_super(s.left_of(s.sub(0)))); +} + +TEST_CASE("substr.right_of") +{ + csubstr s = "012345"; + + CHECK_EQ(s.right_of(csubstr::npos), ""); + CHECK_EQ(s.right_of(csubstr::npos), ""); + + CHECK_EQ(s.right_of(csubstr::npos, /*include_pos*/false), ""); + CHECK_EQ(s.right_of(csubstr::npos, /*include_pos*/true), ""); + + + CHECK_EQ(s.right_of(0), "12345"); + CHECK_EQ(s.right_of(1), "2345"); + CHECK_EQ(s.right_of(2), "345"); + CHECK_EQ(s.right_of(3), "45"); + CHECK_EQ(s.right_of(4), "5"); + CHECK_EQ(s.right_of(5), ""); + + CHECK_EQ(s.right_of(0, /*include_pos*/false), "12345"); + CHECK_EQ(s.right_of(1, /*include_pos*/false), "2345"); + CHECK_EQ(s.right_of(2, /*include_pos*/false), "345"); + CHECK_EQ(s.right_of(3, /*include_pos*/false), "45"); + CHECK_EQ(s.right_of(4, /*include_pos*/false), "5"); + CHECK_EQ(s.right_of(5, /*include_pos*/false), ""); + + CHECK_UNARY(s.is_super(s.right_of(0))); + CHECK_UNARY(s.is_super(s.right_of(1))); + CHECK_UNARY(s.is_super(s.right_of(2))); + CHECK_UNARY(s.is_super(s.right_of(3))); + CHECK_UNARY(s.is_super(s.right_of(4))); + CHECK_UNARY(s.is_super(s.right_of(5))); + + CHECK_UNARY(s.is_super(s.right_of(0, /*include_pos*/false))); + CHECK_UNARY(s.is_super(s.right_of(1, /*include_pos*/false))); + CHECK_UNARY(s.is_super(s.right_of(2, /*include_pos*/false))); + CHECK_UNARY(s.is_super(s.right_of(3, /*include_pos*/false))); + CHECK_UNARY(s.is_super(s.right_of(4, /*include_pos*/false))); + CHECK_UNARY(s.is_super(s.right_of(5, /*include_pos*/false))); + + + CHECK_EQ(s.right_of(0, /*include_pos*/true), "012345"); + CHECK_EQ(s.right_of(1, /*include_pos*/true), "12345"); + CHECK_EQ(s.right_of(2, /*include_pos*/true), "2345"); + CHECK_EQ(s.right_of(3, /*include_pos*/true), "345"); + CHECK_EQ(s.right_of(4, /*include_pos*/true), "45"); + CHECK_EQ(s.right_of(5, /*include_pos*/true), "5"); + CHECK_EQ(s.right_of(6, /*include_pos*/true), ""); + + CHECK_UNARY(s.is_super(s.right_of(0, /*include_pos*/true))); + CHECK_UNARY(s.is_super(s.right_of(1, /*include_pos*/true))); + CHECK_UNARY(s.is_super(s.right_of(2, /*include_pos*/true))); + CHECK_UNARY(s.is_super(s.right_of(3, /*include_pos*/true))); + CHECK_UNARY(s.is_super(s.right_of(4, /*include_pos*/true))); + CHECK_UNARY(s.is_super(s.right_of(5, /*include_pos*/true))); + CHECK_UNARY(s.is_super(s.right_of(6, /*include_pos*/true))); + + + CHECK_EQ(s.sub(0, 0), ""); + CHECK_EQ(s.sub(0, 1), "0"); + CHECK_EQ(s.sub(0, 2), "01"); + CHECK_EQ(s.sub(0, 3), "012"); + CHECK_EQ(s.sub(0, 4), "0123"); + CHECK_EQ(s.sub(0, 5), "01234"); + CHECK_EQ(s.sub(0, 6), "012345"); + + CHECK_EQ(s.right_of(s.sub(0, 0)), "012345"); + CHECK_EQ(s.right_of(s.sub(0, 1)), "12345"); + CHECK_EQ(s.right_of(s.sub(0, 2)), "2345"); + CHECK_EQ(s.right_of(s.sub(0, 3)), "345"); + CHECK_EQ(s.right_of(s.sub(0, 4)), "45"); + CHECK_EQ(s.right_of(s.sub(0, 5)), "5"); + CHECK_EQ(s.right_of(s.sub(0, 6)), ""); + + CHECK_UNARY(s.is_super(s.right_of(s.sub(0, 0)))); + CHECK_UNARY(s.is_super(s.right_of(s.sub(0, 1)))); + CHECK_UNARY(s.is_super(s.right_of(s.sub(0, 2)))); + CHECK_UNARY(s.is_super(s.right_of(s.sub(0, 3)))); + CHECK_UNARY(s.is_super(s.right_of(s.sub(0, 4)))); + CHECK_UNARY(s.is_super(s.right_of(s.sub(0, 5)))); + CHECK_UNARY(s.is_super(s.right_of(s.sub(0, 6)))); +} + +TEST_CASE("substr.compare_different_length") +{ + const char s1[] = "one empty doc"; + const char s2[] = "one empty doc, explicit termination"; + csubstr c1(s1), c2(s2); + CHECK_NE(c1, c2); + CHECK_NE(c1, s2); + CHECK_NE(s1, c2); + CHECK_LT(c1, c2); + CHECK_LT(c1, s2); + CHECK_LT(s1, c2); + CHECK_GT(c2, c1); + CHECK_GT(c2, s1); + CHECK_GT(s2, c1); + CHECK_NE((c1 > c2), (c1 < c2)); + CHECK_NE((c1 > s2), (c1 < s2)); + CHECK_NE((s1 > c2), (s1 < c2)); + CHECK_NE((c2 > c1), (c2 < c1)); + CHECK_NE((c2 > s1), (c2 < s1)); + CHECK_NE((s2 > c1), (s2 < c1)); + CHECK_NE((c1 == c2), (c1 != c2)); + CHECK_NE((c1 == s2), (c1 != s2)); + CHECK_NE((s1 == c2), (s1 != c2)); + CHECK_NE((c2 == c1), (c2 != c1)); + CHECK_NE((c2 == s1), (c2 != s1)); + CHECK_NE((s2 == c1), (s2 != c1)); +} + +TEST_CASE("substr.compare_null") +{ + csubstr s1, s2, sp(" "); + CHECK_EQ(s1, ""); + CHECK_EQ(s1, s2); + CHECK(!(s1 > s2)); + CHECK(!(s1 < s2)); + CHECK((s1 <= s2)); + CHECK((s1 >= s2)); + CHECK(!(s1 != s2)); + CHECK_EQ(s1.compare('-'), -1); + CHECK_EQ(sp.compare(' '), 0); + CHECK_EQ(s1.compare("-", 1u), -1); + CHECK_EQ(s1.compare("-", 0u), 0); + CHECK_EQ(s1.compare((const char*)0, 0u), 0); + CHECK_EQ(sp.compare((const char*)0, 0u), 1); + CHECK_EQ(sp.compare(" ", 0u), 1); + CHECK_EQ(sp.compare(" ", 1u), 0); +} + +TEST_CASE("substr.compare_vs_char") +{ + CHECK_EQ(csubstr().compare('1'), -1); // str==null, len==0 + CHECK_EQ(csubstr("0123").first(0).compare('1'), -1); // str!=null, len==0 + CHECK_EQ(csubstr("0123").first(1).compare('1'), -1); + + CHECK_EQ(csubstr("-"), '-'); + CHECK_NE(csubstr("+"), '-'); + + CHECK_NE(csubstr("---"), '-'); + CHECK_NE(csubstr("---"), "-"); + + CHECK_NE(csubstr("aaa"), 'a'); + CHECK_NE(csubstr("aaa"), "a"); + + CHECK_NE(csubstr("aaa"), 'b'); + CHECK_NE(csubstr("aaa"), "b"); + + CHECK_LT(csubstr("aaa"), 'b'); + CHECK_LT(csubstr("aaa"), "b"); + + CHECK_LE(csubstr("aaa"), 'b'); + CHECK_LE(csubstr("aaa"), "b"); + + CHECK_NE(csubstr("bbb"), 'a'); + CHECK_NE(csubstr("bbb"), "a"); + + CHECK_GT(csubstr("bbb"), 'a'); + CHECK_GT(csubstr("bbb"), "a"); + + CHECK_GE(csubstr("bbb"), 'a'); + CHECK_GE(csubstr("bbb"), "a"); +} + +TEST_CASE("substr.mixed_cmp") +{ + // c++20 introduced new comparison rules and clang10 fails: + // + // error: ISO C++20 considers use of overloaded operator '==' (with operand + // types 'const c4::basic_substring<char>' and 'const + // c4::basic_substring<char>') to be ambiguous despite there being a unique + // best viable function [-Werror,-Wambiguous-reversed-operator] + + char sa_[] = "a"; + char sb_[] = "b"; + csubstr csa = "a"; substr sa = sa_; + csubstr csb = "b"; substr sb = sb_; + + CHECK_EQ(csa, csa); + CHECK_EQ(sa, sa); // this fails + CHECK_EQ(csa, sa); + CHECK_EQ(sa, csa); + + CHECK_NE(sa, sb); + CHECK_NE(csa, csb); + CHECK_NE(csa, sb); + CHECK_NE(sa, csb); + + CHECK_LT(sa, sb); + CHECK_LT(csa, csb); + CHECK_LT(csa, sb); + CHECK_LT(sa, csb); + + CHECK_LE(sa, sb); + CHECK_LE(csa, csb); + CHECK_LE(csa, sb); + CHECK_LE(sa, csb); + + CHECK_LE(sa, sa); + CHECK_LE(csa, csa); + CHECK_LE(csa, sa); + CHECK_LE(sa, csa); + + CHECK_GT(sb, sa); + CHECK_GT(csb, csa); + CHECK_GT(csb, sa); + CHECK_GT( sb, csa); + + CHECK_GE(sb, sa); + CHECK_GE(csb, csa); + CHECK_GE(csb, sa); + CHECK_GE( sb, csa); + + CHECK_GE(sb, sb); + CHECK_GE(csb, csb); + CHECK_GE(csb, sb); + CHECK_GE( sb, csb); +} + +TEST_CASE("substr.eqne") +{ + char buf[128]; + for(size_t i = 0; i < 5; ++i) buf[i] = (char)('0' + i); + csubstr cmp(buf, 5); + + CHECK_EQ(csubstr("01234"), cmp); + CHECK_EQ( "01234" , cmp); + CHECK_EQ( cmp, "01234"); + CHECK_NE(csubstr("0123"), cmp); + CHECK_NE( "0123" , cmp); + CHECK_NE( cmp, "0123"); + CHECK_NE(csubstr("012345"), cmp); + CHECK_NE( "012345" , cmp); + CHECK_NE( cmp, "012345"); +} + +TEST_CASE("substr.substr2csubstr") +{ + char b[] = "some string"; + substr s(b); + csubstr sc = s; + CHECK_EQ(sc, s); + const substr cs(b); + const csubstr csc(b); +} + +template <class ...Args> +void test_first_of_any(csubstr input, bool true_or_false, size_t which, size_t pos, Args... args) +{ + csubstr::first_of_any_result r = input.first_of_any(to_csubstr(args)...); + //std::cout << input << ": " << (bool(r) ? "true" : "false") << "/which:" << r.which << "/pos:" << r.pos << "\n"; + CHECK_EQ(r, true_or_false); + if(true_or_false) + { + CHECK_UNARY(r); + } + else + { + CHECK_FALSE(r); + } + CHECK_EQ(r.which, which); + CHECK_EQ(r.pos, pos); +} + +TEST_CASE("substr.first_of_any") +{ + size_t NONE = csubstr::NONE; + size_t npos = csubstr::npos; + + test_first_of_any("foobar" , true , 0u , 3u, "bar", "barbell", "bark", "barff"); + test_first_of_any("foobar" , false, NONE, npos, "barbell", "bark", "barff"); + test_first_of_any("foobart" , false, NONE, npos, "barbell", "bark", "barff"); + + test_first_of_any("10" , false, NONE, npos, "0x", "0X", "-0x", "-0X"); + test_first_of_any("10]" , false, NONE, npos, "0x", "0X", "-0x", "-0X"); + test_first_of_any(csubstr("10]").first(2), false, NONE, npos, "0x", "0X", "-0x", "-0X"); + + + test_first_of_any("baz{% endif %}", true, 0u, 3u, "{% endif %}", "{% if " , "{% elif bar %}" , "{% else %}" ); + test_first_of_any("baz{% endif %}", true, 1u, 3u, "{% if " , "{% endif %}" , "{% elif bar %}" , "{% else %}" ); + test_first_of_any("baz{% endif %}", true, 2u, 3u, "{% if " , "{% elif bar %}" , "{% endif %}" , "{% else %}" ); + test_first_of_any("baz{% endif %}", true, 3u, 3u, "{% if " , "{% elif bar %}" , "{% else %}" , "{% endif %}"); + + test_first_of_any("baz{% e..if %}", false, NONE, npos, "{% endif %}", "{% if " , "{% elif bar %}" , "{% else %}" ); + test_first_of_any("baz{% e..if %}", false, NONE, npos, "{% if " , "{% endif %}" , "{% elif bar %}" , "{% else %}" ); + test_first_of_any("baz{% e..if %}", false, NONE, npos, "{% if " , "{% elif bar %}" , "{% endif %}" , "{% else %}" ); + test_first_of_any("baz{% e..if %}", false, NONE, npos, "{% if " , "{% elif bar %}" , "{% else %}" , "{% endif %}"); + + + test_first_of_any("bar{% else %}baz{% endif %}", true, 0u, 3u, "{% else %}" , "{% if " , "{% elif bar %}" , "{% endif %}"); + test_first_of_any("bar{% else %}baz{% endif %}", true, 1u, 3u, "{% if " , "{% else %}" , "{% elif bar %}" , "{% endif %}"); + test_first_of_any("bar{% else %}baz{% endif %}", true, 2u, 3u, "{% if " , "{% elif bar %}" , "{% else %}" , "{% endif %}"); + test_first_of_any("bar{% else %}baz{% endif %}", true, 3u, 3u, "{% if " , "{% elif bar %}" , "{% endif %}" , "{% else %}" ); + + test_first_of_any("bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% else %}" , "{% if " , "{% elif bar %}" , "{% endif %}"); + test_first_of_any("bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% if " , "{% else %}" , "{% elif bar %}" , "{% endif %}"); + test_first_of_any("bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% if " , "{% elif bar %}" , "{% else %}" , "{% endif %}"); + test_first_of_any("bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% if " , "{% elif bar %}" , "{% endif %}" , "{% else %}" ); + + + test_first_of_any("foo{% elif bar %}bar{% else %}baz{% endif %}", true, 0u, 3u, "{% elif bar %}" , "{% if " , "{% else %}" , "{% endif %}" ); + test_first_of_any("foo{% elif bar %}bar{% else %}baz{% endif %}", true, 1u, 3u, "{% if " , "{% elif bar %}" , "{% else %}" , "{% endif %}" ); + test_first_of_any("foo{% elif bar %}bar{% else %}baz{% endif %}", true, 2u, 3u, "{% if " , "{% else %}" , "{% elif bar %}" , "{% endif %}" ); + test_first_of_any("foo{% elif bar %}bar{% else %}baz{% endif %}", true, 3u, 3u, "{% if " , "{% else %}" , "{% endif %}" , "{% elif bar %}"); + + test_first_of_any("foo{% e..f bar %}bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% elif bar %}" , "{% if " , "{% else %}" , "{% endif %}" ); + test_first_of_any("foo{% e..f bar %}bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% if " , "{% elif bar %}" , "{% else %}" , "{% endif %}" ); + test_first_of_any("foo{% e..f bar %}bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% if " , "{% else %}" , "{% elif bar %}" , "{% endif %}" ); + test_first_of_any("foo{% e..f bar %}bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% if " , "{% else %}" , "{% endif %}" , "{% elif bar %}"); + + + test_first_of_any("{% if foo %}foo{% elif bar %}bar{% else %}baz{% endif %}", true, 0u, 0u, "{% if " , "{% elif bar %}" , "{% else %}" , "{% endif %}" ); + test_first_of_any("{% if foo %}foo{% elif bar %}bar{% else %}baz{% endif %}", true, 1u, 0u, "{% elif bar %}" , "{% if " , "{% else %}" , "{% endif %}" ); + test_first_of_any("{% if foo %}foo{% elif bar %}bar{% else %}baz{% endif %}", true, 2u, 0u, "{% elif bar %}" , "{% else %}" , "{% if " , "{% endif %}" ); + test_first_of_any("{% if foo %}foo{% elif bar %}bar{% else %}baz{% endif %}", true, 3u, 0u, "{% elif bar %}" , "{% else %}" , "{% endif %}", "{% if " ); + + test_first_of_any("{% .. foo %}foo{% e..f bar %}bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% if " , "{% elif bar %}" , "{% else %}" , "{% endif %}" ); + test_first_of_any("{% .. foo %}foo{% e..f bar %}bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% elif bar %}" , "{% if " , "{% else %}" , "{% endif %}" ); + test_first_of_any("{% .. foo %}foo{% e..f bar %}bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% elif bar %}" , "{% else %}" , "{% if " , "{% endif %}" ); + test_first_of_any("{% .. foo %}foo{% e..f bar %}bar{% e..e %}baz{% e..if %}", false, NONE, npos, "{% elif bar %}" , "{% else %}" , "{% endif %}", "{% if " ); +} + + +TEST_CASE("substr.pair_range_esc") +{ + const char q = '\''; + CHECK_EQ(csubstr("").pair_range_esc(q), ""); + CHECK_EQ(csubstr("'").pair_range_esc(q), ""); + CHECK_EQ(csubstr("''").pair_range_esc(q), "''"); + CHECK_EQ(csubstr("'\\'\\''").pair_range_esc(q), "'\\'\\''"); + CHECK_EQ(csubstr("asdasdasd''asdasd").pair_range_esc(q), "''"); + CHECK_EQ(csubstr("asdasdasd'abc'asdasda").pair_range_esc(q), "'abc'"); +} + +TEST_CASE("substr.pair_range") +{ + CHECK_EQ(csubstr("").pair_range('{', '}'), ""); + CHECK_EQ(csubstr("{").pair_range('{', '}'), ""); + CHECK_EQ(csubstr("}").pair_range('{', '}'), ""); + CHECK_EQ(csubstr("{}").pair_range('{', '}'), "{}"); + CHECK_EQ(csubstr("{abc}").pair_range('{', '}'), "{abc}"); + CHECK_EQ(csubstr("123{abc}456").pair_range('{', '}'), "{abc}"); +} + +TEST_CASE("substr.pair_range_nested") +{ + CHECK_EQ(csubstr("").pair_range_nested('{', '}'), ""); + CHECK_EQ(csubstr("{").pair_range_nested('{', '}'), ""); + CHECK_EQ(csubstr("}").pair_range_nested('{', '}'), ""); + CHECK_EQ(csubstr("{}").pair_range_nested('{', '}'), "{}"); + CHECK_EQ(csubstr("{abc}").pair_range_nested('{', '}'), "{abc}"); + CHECK_EQ(csubstr("123{abc}456").pair_range_nested('{', '}'), "{abc}"); + CHECK_EQ(csubstr("123{abc}456{def}").pair_range_nested('{', '}'), "{abc}"); + CHECK_EQ(csubstr( "{{}}").pair_range_nested('{', '}'), "{{}}"); + CHECK_EQ(csubstr("123{{}}456").pair_range_nested('{', '}'), "{{}}"); + CHECK_EQ(csubstr( "{a{}b{}c}").pair_range_nested('{', '}'), "{a{}b{}c}"); + CHECK_EQ(csubstr("123{a{}b{}c}456").pair_range_nested('{', '}'), "{a{}b{}c}"); + CHECK_EQ(csubstr( "{a{{}}b{{}}c}").pair_range_nested('{', '}'), "{a{{}}b{{}}c}"); + CHECK_EQ(csubstr("123{a{{}}b{{}}c}456").pair_range_nested('{', '}'), "{a{{}}b{{}}c}"); + CHECK_EQ(csubstr( "{{{}}a{{}}b{{}}c{{}}}").pair_range_nested('{', '}'), "{{{}}a{{}}b{{}}c{{}}}"); + CHECK_EQ(csubstr("123{{{}}a{{}}b{{}}c{{}}}456").pair_range_nested('{', '}'), "{{{}}a{{}}b{{}}c{{}}}"); +} + +TEST_CASE("substr.unquoted") +{ + CHECK_EQ(csubstr("").unquoted(), ""); + + CHECK_EQ(csubstr("''").unquoted(), ""); + CHECK_EQ(csubstr("\"\"").unquoted(), ""); + + CHECK_EQ(csubstr("'\''").unquoted(), "'"); + + CHECK_EQ(csubstr("aa").unquoted(), "aa"); + CHECK_EQ(csubstr("'aa'").unquoted(), "aa"); + CHECK_EQ(csubstr("\"aa\"").unquoted(), "aa"); + CHECK_EQ(csubstr("'aa\''").unquoted(), "aa'"); +} + + +TEST_CASE("substr.first_non_empty_span") +{ + CHECK_EQ(csubstr("foo bar").first_non_empty_span(), "foo"); + CHECK_EQ(csubstr(" foo bar").first_non_empty_span(), "foo"); + CHECK_EQ(csubstr("\n \r \t foo bar").first_non_empty_span(), "foo"); + CHECK_EQ(csubstr("\n \r \t foo\n\r\t bar").first_non_empty_span(), "foo"); + CHECK_EQ(csubstr("\n \r \t foo\n\r\t bar").first_non_empty_span(), "foo"); + CHECK_EQ(csubstr(",\n \r \t foo\n\r\t bar").first_non_empty_span(), ","); +} + +TEST_CASE("substr.first_uint_span") +{ + CHECK_EQ(csubstr("1234").first_uint_span(), "1234"); + CHECK_EQ(csubstr("+1234").first_uint_span(), "+1234"); + CHECK_EQ(csubstr("-1234").first_uint_span(), ""); + CHECK_EQ(csubstr("1234 asdkjh").first_uint_span(), "1234"); + CHECK_EQ(csubstr("1234\rasdkjh").first_uint_span(), "1234"); + CHECK_EQ(csubstr("1234\tasdkjh").first_uint_span(), "1234"); + CHECK_EQ(csubstr("1234\nasdkjh").first_uint_span(), "1234"); + CHECK_EQ(csubstr("1234]asdkjh").first_uint_span(), "1234"); + CHECK_EQ(csubstr("1234)asdkjh").first_uint_span(), "1234"); + CHECK_EQ(csubstr("1234gasdkjh").first_uint_span(), ""); + CHECK_EQ(csubstr("1").first_uint_span(), "1"); + CHECK_EQ(csubstr("+1").first_uint_span(), "+1"); + CHECK_EQ(csubstr("-1").first_uint_span(), ""); + CHECK_EQ(csubstr("-0").first_uint_span(), ""); + CHECK_EQ(csubstr("0").first_uint_span(), "0"); + CHECK_EQ(csubstr("+0").first_uint_span(), "+0"); + CHECK_EQ(csubstr("-0").first_uint_span(), ""); + CHECK_EQ(csubstr("1234 abc").first_uint_span(), "1234"); + CHECK_EQ(csubstr("abc 1234 abc").first_uint_span(), ""); + CHECK_EQ(csubstr("+0x1234 abc").first_uint_span(), "+0x1234"); + CHECK_EQ(csubstr("-0x1234 abc").first_uint_span(), ""); + CHECK_EQ(csubstr("0x1234 abc").first_uint_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234\rabc").first_uint_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234\nabc").first_uint_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234\tabc").first_uint_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234]abc").first_uint_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234)abc").first_uint_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234g").first_uint_span(), ""); + CHECK_EQ(csubstr("0b01").first_uint_span(), "0b01"); + CHECK_EQ(csubstr("+0b01").first_uint_span(), "+0b01"); + CHECK_EQ(csubstr("-0b01").first_uint_span(), ""); + CHECK_EQ(csubstr("0b01 asdasd").first_uint_span(), "0b01"); + CHECK_EQ(csubstr("0b01\rasdasd").first_uint_span(), "0b01"); + CHECK_EQ(csubstr("0b01\tasdasd").first_uint_span(), "0b01"); + CHECK_EQ(csubstr("0b01\nasdasd").first_uint_span(), "0b01"); + CHECK_EQ(csubstr("0b01]asdasd").first_uint_span(), "0b01"); + CHECK_EQ(csubstr("0b01)asdasd").first_uint_span(), "0b01"); + CHECK_EQ(csubstr("0b01hasdasd").first_uint_span(), ""); + CHECK_EQ(csubstr("+").first_uint_span(), ""); + CHECK_EQ(csubstr("-").first_uint_span(), ""); +} + +TEST_CASE("substr.first_int_span") +{ + CHECK_EQ(csubstr("1234").first_int_span(), "1234"); + CHECK_EQ(csubstr("+1234").first_int_span(), "+1234"); + CHECK_EQ(csubstr("-1234").first_int_span(), "-1234"); + CHECK_EQ(csubstr("-1234 asdkjh").first_int_span(), "-1234"); + CHECK_EQ(csubstr("-1234\rasdkjh").first_int_span(), "-1234"); + CHECK_EQ(csubstr("-1234\tasdkjh").first_int_span(), "-1234"); + CHECK_EQ(csubstr("-1234\nasdkjh").first_int_span(), "-1234"); + CHECK_EQ(csubstr("-1234]asdkjh").first_int_span(), "-1234"); + CHECK_EQ(csubstr("-1234)asdkjh").first_int_span(), "-1234"); + CHECK_EQ(csubstr("-1234gasdkjh").first_int_span(), ""); + CHECK_EQ(csubstr("1").first_int_span(), "1"); + CHECK_EQ(csubstr("+1").first_int_span(), "+1"); + CHECK_EQ(csubstr("-1").first_int_span(), "-1"); + CHECK_EQ(csubstr("-0").first_int_span(), "-0"); + CHECK_EQ(csubstr("0").first_int_span(), "0"); + CHECK_EQ(csubstr("+0").first_int_span(), "+0"); + CHECK_EQ(csubstr("-0").first_int_span(), "-0"); + CHECK_EQ(csubstr("1234 abc").first_int_span(), "1234"); + CHECK_EQ(csubstr("abc 1234 abc").first_int_span(), ""); + CHECK_EQ(csubstr("+0x1234 abc").first_int_span(), "+0x1234"); + CHECK_EQ(csubstr("-0x1234 abc").first_int_span(), "-0x1234"); + CHECK_EQ(csubstr("0x1234 abc").first_int_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234\rabc").first_int_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234\nabc").first_int_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234\tabc").first_int_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234]abc").first_int_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234)abc").first_int_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234gabc").first_int_span(), ""); + CHECK_EQ(csubstr("0b01").first_int_span(), "0b01"); + CHECK_EQ(csubstr("+0b01").first_int_span(), "+0b01"); + CHECK_EQ(csubstr("-0b01").first_int_span(), "-0b01"); + CHECK_EQ(csubstr("0b01 asdasd").first_int_span(), "0b01"); + CHECK_EQ(csubstr("0b01\rasdasd").first_int_span(), "0b01"); + CHECK_EQ(csubstr("0b01\tasdasd").first_int_span(), "0b01"); + CHECK_EQ(csubstr("0b01\nasdasd").first_int_span(), "0b01"); + CHECK_EQ(csubstr("0b01]asdasd").first_int_span(), "0b01"); + CHECK_EQ(csubstr("0b01)asdasd").first_int_span(), "0b01"); + CHECK_EQ(csubstr("0b01gasdasd").first_int_span(), ""); +} + +TEST_CASE("substr.first_real_span") +{ + // all integers are reals + CHECK_EQ(csubstr("1234").first_real_span(), "1234"); + CHECK_EQ(csubstr("+1234").first_real_span(), "+1234"); + CHECK_EQ(csubstr("-1234").first_real_span(), "-1234"); + CHECK_EQ(csubstr("-1234 asdkjh").first_real_span(), "-1234"); + CHECK_EQ(csubstr("-1234\rasdkjh").first_real_span(), "-1234"); + CHECK_EQ(csubstr("-1234\tasdkjh").first_real_span(), "-1234"); + CHECK_EQ(csubstr("-1234\nasdkjh").first_real_span(), "-1234"); + CHECK_EQ(csubstr("-1234]asdkjh").first_real_span(), "-1234"); + CHECK_EQ(csubstr("-1234)asdkjh").first_real_span(), "-1234"); + CHECK_EQ(csubstr("-1234gasdkjh").first_real_span(), ""); + CHECK_EQ(csubstr("1").first_real_span(), "1"); + CHECK_EQ(csubstr("+1").first_real_span(), "+1"); + CHECK_EQ(csubstr("-1").first_real_span(), "-1"); + CHECK_EQ(csubstr("-0").first_real_span(), "-0"); + CHECK_EQ(csubstr("0").first_real_span(), "0"); + CHECK_EQ(csubstr("+0").first_real_span(), "+0"); + CHECK_EQ(csubstr("-0").first_real_span(), "-0"); + CHECK_EQ(csubstr("1234 abc").first_real_span(), "1234"); + CHECK_EQ(csubstr("abc 1234 abc").first_real_span(), ""); + CHECK_EQ(csubstr("+0x1234 abc").first_real_span(), "+0x1234"); + CHECK_EQ(csubstr("-0x1234 abc").first_real_span(), "-0x1234"); + CHECK_EQ(csubstr("0x1234 abc").first_real_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234\rabc").first_real_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234\nabc").first_real_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234\tabc").first_real_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234]abc").first_real_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234)abc").first_real_span(), "0x1234"); + CHECK_EQ(csubstr("0x1234gabc").first_real_span(), ""); + CHECK_EQ(csubstr("0b01").first_real_span(), "0b01"); + CHECK_EQ(csubstr("+0b01").first_real_span(), "+0b01"); + CHECK_EQ(csubstr("-0b01").first_real_span(), "-0b01"); + CHECK_EQ(csubstr("0b01 asdasd").first_real_span(), "0b01"); + CHECK_EQ(csubstr("0b01\rasdasd").first_real_span(), "0b01"); + CHECK_EQ(csubstr("0b01\tasdasd").first_real_span(), "0b01"); + CHECK_EQ(csubstr("0b01\nasdasd").first_real_span(), "0b01"); + CHECK_EQ(csubstr("0b01]asdasd").first_real_span(), "0b01"); + CHECK_EQ(csubstr("0b01)asdasd").first_real_span(), "0b01"); + CHECK_EQ(csubstr("0b01gasdasd").first_real_span(), ""); + CHECK_EQ(csubstr("0b1.01 asdasd").first_real_span(), "0b1.01"); + CHECK_EQ(csubstr("0b1.01\rasdasd").first_real_span(), "0b1.01"); + CHECK_EQ(csubstr("0b1.01\tasdasd").first_real_span(), "0b1.01"); + CHECK_EQ(csubstr("0b1.01\nasdasd").first_real_span(), "0b1.01"); + CHECK_EQ(csubstr("0b1.01]asdasd").first_real_span(), "0b1.01"); + CHECK_EQ(csubstr("0b1.01)asdasd").first_real_span(), "0b1.01"); + CHECK_EQ(csubstr("0b1.01gasdasd").first_real_span(), ""); + CHECK_EQ(csubstr("0b1.02 asdasd").first_real_span(), ""); + CHECK_EQ(csubstr("0b1.02\rasdasd").first_real_span(), ""); + CHECK_EQ(csubstr("0b1.02\tasdasd").first_real_span(), ""); + CHECK_EQ(csubstr("0b1.02\nasdasd").first_real_span(), ""); + CHECK_EQ(csubstr("0b1.02]asdasd").first_real_span(), ""); + CHECK_EQ(csubstr("0b1.02)asdasd").first_real_span(), ""); + CHECK_EQ(csubstr("0b1.02gasdasd").first_real_span(), ""); + CHECK_EQ(csubstr("+").first_real_span(), ""); + CHECK_EQ(csubstr("-").first_real_span(), ""); + CHECK_EQ(csubstr("+0x").first_real_span(), ""); + CHECK_EQ(csubstr("-0x").first_real_span(), ""); + CHECK_EQ(csubstr("+0b").first_real_span(), ""); + CHECK_EQ(csubstr("-0b").first_real_span(), ""); + CHECK_EQ(csubstr("+0o").first_real_span(), ""); + CHECK_EQ(csubstr("-0o").first_real_span(), ""); + CHECK_EQ(csubstr("-1.234 asdkjh").first_real_span(), "-1.234"); +// CHECK_EQ(csubstr("-1.234e5 asdkjh").first_real_span(), "-1.234e5"); + CHECK_EQ(csubstr("-1.234e+5 asdkjh").first_real_span(), "-1.234e+5"); + CHECK_EQ(csubstr("-1.234e-5 asdkjh").first_real_span(), "-1.234e-5"); + CHECK_EQ(csubstr("0x1.e8480p+19 asdkjh").first_real_span(), "0x1.e8480p+19"); + CHECK_EQ(csubstr("0x1.e8480p-19 asdkjh").first_real_span(), "0x1.e8480p-19"); + CHECK_EQ(csubstr("-0x1.e8480p+19 asdkjh").first_real_span(), "-0x1.e8480p+19"); + CHECK_EQ(csubstr("-0x1.e8480p-19 asdkjh").first_real_span(), "-0x1.e8480p-19"); + CHECK_EQ(csubstr("+0x1.e8480p+19 asdkjh").first_real_span(), "+0x1.e8480p+19"); + CHECK_EQ(csubstr("+0x1.e8480p-19 asdkjh").first_real_span(), "+0x1.e8480p-19"); + CHECK_EQ(csubstr("infinity").first_real_span(), "infinity"); + CHECK_EQ(csubstr(" infinity").first_real_span(), "infinity"); + CHECK_EQ(csubstr("-infinity").first_real_span(), "-infinity"); + CHECK_EQ(csubstr(" -infinity").first_real_span(), "-infinity"); + CHECK_EQ(csubstr("+infinity").first_real_span(), "+infinity"); + CHECK_EQ(csubstr(" +infinity").first_real_span(), "+infinity"); + CHECK_EQ(csubstr("infinity ").first_real_span(), "infinity"); + CHECK_EQ(csubstr(" infinity ").first_real_span(), "infinity"); + CHECK_EQ(csubstr("-infinity ").first_real_span(), "-infinity"); + CHECK_EQ(csubstr(" -infinity ").first_real_span(), "-infinity"); + CHECK_EQ(csubstr("+infinity ").first_real_span(), "+infinity"); + CHECK_EQ(csubstr(" +infinity ").first_real_span(), "+infinity"); + CHECK_EQ(csubstr("infinity1").first_real_span(), ""); + CHECK_EQ(csubstr(" infinity1").first_real_span(), ""); + CHECK_EQ(csubstr("-infinity1").first_real_span(), ""); + CHECK_EQ(csubstr(" -infinity1").first_real_span(), ""); + CHECK_EQ(csubstr("+infinity1").first_real_span(), ""); + CHECK_EQ(csubstr(" +infinity1").first_real_span(), ""); + CHECK_EQ(csubstr("infin").first_real_span(), ""); + CHECK_EQ(csubstr(" infin").first_real_span(), ""); + CHECK_EQ(csubstr("-infin").first_real_span(), ""); + CHECK_EQ(csubstr(" -infin").first_real_span(), ""); + CHECK_EQ(csubstr("+infin").first_real_span(), ""); + CHECK_EQ(csubstr(" +infin").first_real_span(), ""); + CHECK_EQ(csubstr("inflated").first_real_span(), ""); + CHECK_EQ(csubstr(" inflated").first_real_span(), ""); + CHECK_EQ(csubstr("-inflated").first_real_span(), ""); + CHECK_EQ(csubstr(" -inflated").first_real_span(), ""); + CHECK_EQ(csubstr("+inflated").first_real_span(), ""); + CHECK_EQ(csubstr(" +inflated").first_real_span(), ""); + CHECK_EQ(csubstr("inf").first_real_span(), "inf"); + CHECK_EQ(csubstr(" inf").first_real_span(), "inf"); + CHECK_EQ(csubstr("-inf").first_real_span(), "-inf"); + CHECK_EQ(csubstr(" -inf").first_real_span(), "-inf"); + CHECK_EQ(csubstr("+inf").first_real_span(), "+inf"); + CHECK_EQ(csubstr(" +inf").first_real_span(), "+inf"); + CHECK_EQ(csubstr("inf ").first_real_span(), "inf"); + CHECK_EQ(csubstr(" inf ").first_real_span(), "inf"); + CHECK_EQ(csubstr("-inf ").first_real_span(), "-inf"); + CHECK_EQ(csubstr(" -inf ").first_real_span(), "-inf"); + CHECK_EQ(csubstr("+inf ").first_real_span(), "+inf"); + CHECK_EQ(csubstr(" +inf ").first_real_span(), "+inf"); + CHECK_EQ(csubstr("inf1").first_real_span(), ""); + CHECK_EQ(csubstr(" inf1").first_real_span(), ""); + CHECK_EQ(csubstr("-inf1").first_real_span(), ""); + CHECK_EQ(csubstr(" -inf1").first_real_span(), ""); + CHECK_EQ(csubstr("+inf1").first_real_span(), ""); + CHECK_EQ(csubstr(" +inf1").first_real_span(), ""); + CHECK_EQ(csubstr("nan").first_real_span(), "nan"); + CHECK_EQ(csubstr(" nan").first_real_span(), "nan"); + CHECK_EQ(csubstr("-nan").first_real_span(), "-nan"); + CHECK_EQ(csubstr(" -nan").first_real_span(), "-nan"); + CHECK_EQ(csubstr("+nan").first_real_span(), "+nan"); + CHECK_EQ(csubstr(" +nan").first_real_span(), "+nan"); + CHECK_EQ(csubstr("nan ").first_real_span(), "nan"); + CHECK_EQ(csubstr(" nan ").first_real_span(), "nan"); + CHECK_EQ(csubstr("-nan ").first_real_span(), "-nan"); + CHECK_EQ(csubstr(" -nan ").first_real_span(), "-nan"); + CHECK_EQ(csubstr("+nan ").first_real_span(), "+nan"); + CHECK_EQ(csubstr(" +nan ").first_real_span(), "+nan"); + CHECK_EQ(csubstr("nan1").first_real_span(), ""); + CHECK_EQ(csubstr(" nan1").first_real_span(), ""); + CHECK_EQ(csubstr("-nan1").first_real_span(), ""); + CHECK_EQ(csubstr(" -nan1").first_real_span(), ""); + CHECK_EQ(csubstr("+nan1").first_real_span(), ""); + CHECK_EQ(csubstr(" +nan1").first_real_span(), ""); +} + +// start with some obvious direct tests +TEST_CASE("substr.is_unsigned_integer") +{ + SUBCASE("empty_string") + { + CHECK_FALSE(csubstr().is_unsigned_integer()); + CHECK_FALSE(csubstr("").is_unsigned_integer()); + } + SUBCASE("signs") + { + CHECK_FALSE(csubstr("-").is_unsigned_integer()); + CHECK_FALSE(csubstr("+").is_unsigned_integer()); + CHECK_FALSE(csubstr("-1").is_unsigned_integer()); + CHECK_UNARY(csubstr("+1").is_unsigned_integer()); + } + SUBCASE("whitespace_before") + { + CHECK_FALSE(csubstr(" 0").is_unsigned_integer()); + CHECK_FALSE(csubstr(" 1").is_unsigned_integer()); + CHECK_FALSE(csubstr(" -1").is_unsigned_integer()); + CHECK_FALSE(csubstr(" 0.1").is_unsigned_integer()); + CHECK_FALSE(csubstr(" -0.1").is_unsigned_integer()); + } + SUBCASE("whitespace_after") + { + CHECK_FALSE(csubstr("0 ").is_unsigned_integer()); + CHECK_FALSE(csubstr("1 ").is_unsigned_integer()); + CHECK_FALSE(csubstr("-1 ").is_unsigned_integer()); + CHECK_FALSE(csubstr("0.1 ").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0.1 ").is_unsigned_integer()); + } + SUBCASE("whitespace_only") + { + CHECK_FALSE(csubstr(" ").is_unsigned_integer()); + CHECK_FALSE(csubstr("\t\t\t\t").is_unsigned_integer()); + CHECK_FALSE(csubstr("\n\n\n\n").is_unsigned_integer()); + CHECK_FALSE(csubstr("\r\r\r\r").is_unsigned_integer()); + } + SUBCASE("decimal") + { + CHECK_UNARY(csubstr("0").is_unsigned_integer()); + CHECK_UNARY(csubstr("1").is_unsigned_integer()); + CHECK_FALSE(csubstr("-1").is_unsigned_integer()); + CHECK_FALSE(csubstr("0.1").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0.1").is_unsigned_integer()); + } + SUBCASE("hexadecimal") + { + CHECK_FALSE(csubstr("0x").is_unsigned_integer()); + CHECK_FALSE(csubstr("0X").is_unsigned_integer()); + CHECK_UNARY(csubstr("0x1").is_unsigned_integer()); + CHECK_UNARY(csubstr("0X1").is_unsigned_integer()); + CHECK_UNARY(csubstr("0x0").is_unsigned_integer()); + CHECK_UNARY(csubstr("0X0").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xa").is_unsigned_integer()); + CHECK_UNARY(csubstr("0Xa").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xb").is_unsigned_integer()); + CHECK_UNARY(csubstr("0Xb").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xc").is_unsigned_integer()); + CHECK_UNARY(csubstr("0Xc").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xd").is_unsigned_integer()); + CHECK_UNARY(csubstr("0Xd").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xe").is_unsigned_integer()); + CHECK_UNARY(csubstr("0Xe").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xf").is_unsigned_integer()); + CHECK_UNARY(csubstr("0Xf").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xA").is_unsigned_integer()); + CHECK_UNARY(csubstr("0XA").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xB").is_unsigned_integer()); + CHECK_UNARY(csubstr("0XB").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xC").is_unsigned_integer()); + CHECK_UNARY(csubstr("0XC").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xD").is_unsigned_integer()); + CHECK_UNARY(csubstr("0XD").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xE").is_unsigned_integer()); + CHECK_UNARY(csubstr("0XE").is_unsigned_integer()); + CHECK_UNARY(csubstr("0xF").is_unsigned_integer()); + CHECK_UNARY(csubstr("0XF").is_unsigned_integer()); + CHECK_FALSE(csubstr("0xg").is_unsigned_integer()); + CHECK_FALSE(csubstr("0Xg").is_unsigned_integer()); + CHECK_FALSE(csubstr("0xG").is_unsigned_integer()); + CHECK_FALSE(csubstr("0XG").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0x1").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0X1").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0x0").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0X0").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xa").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0Xa").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xb").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0Xb").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xc").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0Xc").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xd").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0Xd").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xe").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0Xe").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xf").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0Xf").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xA").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0XA").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xB").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0XB").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xC").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0XC").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xD").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0XD").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xE").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0XE").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xF").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0XF").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xg").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0Xg").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0xG").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0XG").is_unsigned_integer()); + } + SUBCASE("binary") + { + CHECK_FALSE(csubstr("0b").is_unsigned_integer()); + CHECK_FALSE(csubstr("0B").is_unsigned_integer()); + CHECK_UNARY(csubstr("0b0").is_unsigned_integer()); + CHECK_UNARY(csubstr("0B0").is_unsigned_integer()); + CHECK_UNARY(csubstr("0b1").is_unsigned_integer()); + CHECK_UNARY(csubstr("0B1").is_unsigned_integer()); + CHECK_FALSE(csubstr("0b2").is_unsigned_integer()); + CHECK_FALSE(csubstr("0B2").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0b0").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0B0").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0b1").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0B1").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0b2").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0B2").is_unsigned_integer()); + } + SUBCASE("octal") + { + CHECK_FALSE(csubstr("0o").is_unsigned_integer()); + CHECK_FALSE(csubstr("0O").is_unsigned_integer()); + CHECK_UNARY(csubstr("0o0").is_unsigned_integer()); + CHECK_UNARY(csubstr("0O0").is_unsigned_integer()); + CHECK_UNARY(csubstr("0o1").is_unsigned_integer()); + CHECK_UNARY(csubstr("0O1").is_unsigned_integer()); + CHECK_UNARY(csubstr("0o6").is_unsigned_integer()); + CHECK_UNARY(csubstr("0O6").is_unsigned_integer()); + CHECK_UNARY(csubstr("0o6").is_unsigned_integer()); + CHECK_UNARY(csubstr("0O6").is_unsigned_integer()); + CHECK_UNARY(csubstr("0o7").is_unsigned_integer()); + CHECK_UNARY(csubstr("0O7").is_unsigned_integer()); + CHECK_FALSE(csubstr("0o8").is_unsigned_integer()); + CHECK_FALSE(csubstr("0O8").is_unsigned_integer()); + CHECK_FALSE(csubstr("0o9").is_unsigned_integer()); + CHECK_FALSE(csubstr("0O9").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0o0").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0O0").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0o1").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0O1").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0o6").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0O6").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0o6").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0O6").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0o7").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0O7").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0o8").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0O8").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0o9").is_unsigned_integer()); + CHECK_FALSE(csubstr("-0O9").is_unsigned_integer()); + } +} + +TEST_CASE("substr.is_integer") +{ + SUBCASE("empty_string") + { + CHECK_FALSE(csubstr().is_integer()); + CHECK_FALSE(csubstr("").is_integer()); + } + SUBCASE("signs") + { + CHECK_FALSE(csubstr("-").is_integer()); + CHECK_FALSE(csubstr("+").is_integer()); + CHECK_UNARY(csubstr("-1").is_integer()); + CHECK_UNARY(csubstr("+1").is_integer()); + } + SUBCASE("whitespace_before") + { + CHECK_FALSE(csubstr(" 0").is_integer()); + CHECK_FALSE(csubstr(" 1").is_integer()); + CHECK_FALSE(csubstr(" -1").is_integer()); + CHECK_FALSE(csubstr(" 0.1").is_integer()); + CHECK_FALSE(csubstr(" -0.1").is_integer()); + } + SUBCASE("whitespace_after") + { + CHECK_FALSE(csubstr("0 ").is_integer()); + CHECK_FALSE(csubstr("1 ").is_integer()); + CHECK_FALSE(csubstr("-1 ").is_integer()); + CHECK_FALSE(csubstr("0.1 ").is_integer()); + CHECK_FALSE(csubstr("-0.1 ").is_integer()); + } + SUBCASE("whitespace_only") + { + CHECK_FALSE(csubstr(" ").is_integer()); + CHECK_FALSE(csubstr("\t\t\t\t").is_integer()); + CHECK_FALSE(csubstr("\n\n\n\n").is_integer()); + CHECK_FALSE(csubstr("\r\r\r\r").is_integer()); + } + SUBCASE("decimal") + { + CHECK_UNARY(csubstr("0").is_integer()); + CHECK_UNARY(csubstr("1").is_integer()); + CHECK_UNARY(csubstr("-1").is_integer()); + CHECK_FALSE(csubstr("0.1").is_integer()); + CHECK_FALSE(csubstr("-0.1").is_integer()); + } + SUBCASE("hexadecimal") + { + CHECK_FALSE(csubstr("0x").is_integer()); + CHECK_FALSE(csubstr("0X").is_integer()); + CHECK_UNARY(csubstr("0x1").is_integer()); + CHECK_UNARY(csubstr("0X1").is_integer()); + CHECK_UNARY(csubstr("0x0").is_integer()); + CHECK_UNARY(csubstr("0X0").is_integer()); + CHECK_UNARY(csubstr("0xa").is_integer()); + CHECK_UNARY(csubstr("0Xa").is_integer()); + CHECK_UNARY(csubstr("0xb").is_integer()); + CHECK_UNARY(csubstr("0Xb").is_integer()); + CHECK_UNARY(csubstr("0xc").is_integer()); + CHECK_UNARY(csubstr("0Xc").is_integer()); + CHECK_UNARY(csubstr("0xd").is_integer()); + CHECK_UNARY(csubstr("0Xd").is_integer()); + CHECK_UNARY(csubstr("0xe").is_integer()); + CHECK_UNARY(csubstr("0Xe").is_integer()); + CHECK_UNARY(csubstr("0xf").is_integer()); + CHECK_UNARY(csubstr("0Xf").is_integer()); + CHECK_UNARY(csubstr("0xA").is_integer()); + CHECK_UNARY(csubstr("0XA").is_integer()); + CHECK_UNARY(csubstr("0xB").is_integer()); + CHECK_UNARY(csubstr("0XB").is_integer()); + CHECK_UNARY(csubstr("0xC").is_integer()); + CHECK_UNARY(csubstr("0XC").is_integer()); + CHECK_UNARY(csubstr("0xD").is_integer()); + CHECK_UNARY(csubstr("0XD").is_integer()); + CHECK_UNARY(csubstr("0xE").is_integer()); + CHECK_UNARY(csubstr("0XE").is_integer()); + CHECK_UNARY(csubstr("0xF").is_integer()); + CHECK_UNARY(csubstr("0XF").is_integer()); + CHECK_FALSE(csubstr("0xg").is_integer()); + CHECK_FALSE(csubstr("0Xg").is_integer()); + CHECK_FALSE(csubstr("0xG").is_integer()); + CHECK_FALSE(csubstr("0XG").is_integer()); + CHECK_UNARY(csubstr("-0x1").is_integer()); + CHECK_UNARY(csubstr("-0X1").is_integer()); + CHECK_UNARY(csubstr("-0x0").is_integer()); + CHECK_UNARY(csubstr("-0X0").is_integer()); + CHECK_UNARY(csubstr("-0xa").is_integer()); + CHECK_UNARY(csubstr("-0Xa").is_integer()); + CHECK_UNARY(csubstr("-0xb").is_integer()); + CHECK_UNARY(csubstr("-0Xb").is_integer()); + CHECK_UNARY(csubstr("-0xc").is_integer()); + CHECK_UNARY(csubstr("-0Xc").is_integer()); + CHECK_UNARY(csubstr("-0xd").is_integer()); + CHECK_UNARY(csubstr("-0Xd").is_integer()); + CHECK_UNARY(csubstr("-0xe").is_integer()); + CHECK_UNARY(csubstr("-0Xe").is_integer()); + CHECK_UNARY(csubstr("-0xf").is_integer()); + CHECK_UNARY(csubstr("-0Xf").is_integer()); + CHECK_UNARY(csubstr("-0xA").is_integer()); + CHECK_UNARY(csubstr("-0XA").is_integer()); + CHECK_UNARY(csubstr("-0xB").is_integer()); + CHECK_UNARY(csubstr("-0XB").is_integer()); + CHECK_UNARY(csubstr("-0xC").is_integer()); + CHECK_UNARY(csubstr("-0XC").is_integer()); + CHECK_UNARY(csubstr("-0xD").is_integer()); + CHECK_UNARY(csubstr("-0XD").is_integer()); + CHECK_UNARY(csubstr("-0xE").is_integer()); + CHECK_UNARY(csubstr("-0XE").is_integer()); + CHECK_UNARY(csubstr("-0xF").is_integer()); + CHECK_UNARY(csubstr("-0XF").is_integer()); + CHECK_FALSE(csubstr("-0xg").is_integer()); + CHECK_FALSE(csubstr("-0Xg").is_integer()); + CHECK_FALSE(csubstr("-0xG").is_integer()); + CHECK_FALSE(csubstr("-0XG").is_integer()); + } + SUBCASE("binary") + { + CHECK_FALSE(csubstr("0b").is_integer()); + CHECK_FALSE(csubstr("0B").is_integer()); + CHECK_UNARY(csubstr("0b0").is_integer()); + CHECK_UNARY(csubstr("0B0").is_integer()); + CHECK_UNARY(csubstr("0b1").is_integer()); + CHECK_UNARY(csubstr("0B1").is_integer()); + CHECK_FALSE(csubstr("0b2").is_integer()); + CHECK_FALSE(csubstr("0B2").is_integer()); + CHECK_UNARY(csubstr("-0b0").is_integer()); + CHECK_UNARY(csubstr("-0B0").is_integer()); + CHECK_UNARY(csubstr("-0b1").is_integer()); + CHECK_UNARY(csubstr("-0B1").is_integer()); + CHECK_FALSE(csubstr("-0b2").is_integer()); + CHECK_FALSE(csubstr("-0B2").is_integer()); + } + SUBCASE("octal") + { + CHECK_FALSE(csubstr("0o").is_integer()); + CHECK_FALSE(csubstr("0O").is_integer()); + CHECK_UNARY(csubstr("0o0").is_integer()); + CHECK_UNARY(csubstr("0O0").is_integer()); + CHECK_UNARY(csubstr("0o1").is_integer()); + CHECK_UNARY(csubstr("0O1").is_integer()); + CHECK_UNARY(csubstr("0o6").is_integer()); + CHECK_UNARY(csubstr("0O6").is_integer()); + CHECK_UNARY(csubstr("0o6").is_integer()); + CHECK_UNARY(csubstr("0O6").is_integer()); + CHECK_UNARY(csubstr("0o7").is_integer()); + CHECK_UNARY(csubstr("0O7").is_integer()); + CHECK_FALSE(csubstr("0o8").is_integer()); + CHECK_FALSE(csubstr("0O8").is_integer()); + CHECK_FALSE(csubstr("0o9").is_integer()); + CHECK_FALSE(csubstr("0O9").is_integer()); + CHECK_UNARY(csubstr("-0o0").is_integer()); + CHECK_UNARY(csubstr("-0O0").is_integer()); + CHECK_UNARY(csubstr("-0o1").is_integer()); + CHECK_UNARY(csubstr("-0O1").is_integer()); + CHECK_UNARY(csubstr("-0o6").is_integer()); + CHECK_UNARY(csubstr("-0O6").is_integer()); + CHECK_UNARY(csubstr("-0o6").is_integer()); + CHECK_UNARY(csubstr("-0O6").is_integer()); + CHECK_UNARY(csubstr("-0o7").is_integer()); + CHECK_UNARY(csubstr("-0O7").is_integer()); + CHECK_FALSE(csubstr("-0o8").is_integer()); + CHECK_FALSE(csubstr("-0O8").is_integer()); + CHECK_FALSE(csubstr("-0o9").is_integer()); + CHECK_FALSE(csubstr("-0O9").is_integer()); + } +} + +TEST_CASE("substr.is_real") +{ + SUBCASE("empty_string") + { + CHECK_FALSE(csubstr().is_real()); + CHECK_FALSE(csubstr("").is_real()); + } + SUBCASE("signs") + { + CHECK_FALSE(csubstr("-").is_real()); + CHECK_FALSE(csubstr("+").is_real()); + CHECK_UNARY(csubstr("-1").is_real()); + CHECK_UNARY(csubstr("+1").is_real()); + } + SUBCASE("whitespace_before") + { + CHECK_FALSE(csubstr(" 0").is_real()); + CHECK_FALSE(csubstr(" 1").is_real()); + CHECK_FALSE(csubstr(" -1").is_real()); + CHECK_FALSE(csubstr(" 0.1").is_real()); + CHECK_FALSE(csubstr(" -0.1").is_real()); + } + SUBCASE("whitespace_after") + { + CHECK_FALSE(csubstr("0 ").is_real()); + CHECK_FALSE(csubstr("1 ").is_real()); + CHECK_FALSE(csubstr("-1 ").is_real()); + CHECK_FALSE(csubstr("0.1 ").is_real()); + CHECK_FALSE(csubstr("-0.1 ").is_real()); + } + SUBCASE("whitespace_only") + { + CHECK_FALSE(csubstr(" ").is_real()); + CHECK_FALSE(csubstr("\t\t\t\t").is_real()); + CHECK_FALSE(csubstr("\n\n\n\n").is_real()); + CHECK_FALSE(csubstr("\r\r\r\r").is_real()); + } + SUBCASE("decimal") + { + CHECK_UNARY(csubstr("0").is_real()); + CHECK_UNARY(csubstr("1").is_real()); + CHECK_UNARY(csubstr("-1").is_real()); + CHECK_UNARY(csubstr("0.1").is_real()); + CHECK_UNARY(csubstr("-0.1").is_real()); + } + SUBCASE("hexadecimal") + { + CHECK_FALSE(csubstr("0x").is_real()); + CHECK_FALSE(csubstr("0X").is_real()); + CHECK_UNARY(csubstr("0x1").is_real()); + CHECK_UNARY(csubstr("0X1").is_real()); + CHECK_UNARY(csubstr("0x0").is_real()); + CHECK_UNARY(csubstr("0X0").is_real()); + CHECK_UNARY(csubstr("0xa").is_real()); + CHECK_UNARY(csubstr("0Xa").is_real()); + CHECK_UNARY(csubstr("0xb").is_real()); + CHECK_UNARY(csubstr("0Xb").is_real()); + CHECK_UNARY(csubstr("0xc").is_real()); + CHECK_UNARY(csubstr("0Xc").is_real()); + CHECK_UNARY(csubstr("0xd").is_real()); + CHECK_UNARY(csubstr("0Xd").is_real()); + CHECK_UNARY(csubstr("0xe").is_real()); + CHECK_UNARY(csubstr("0Xe").is_real()); + CHECK_UNARY(csubstr("0xf").is_real()); + CHECK_UNARY(csubstr("0Xf").is_real()); + CHECK_UNARY(csubstr("0xA").is_real()); + CHECK_UNARY(csubstr("0XA").is_real()); + CHECK_UNARY(csubstr("0xB").is_real()); + CHECK_UNARY(csubstr("0XB").is_real()); + CHECK_UNARY(csubstr("0xC").is_real()); + CHECK_UNARY(csubstr("0XC").is_real()); + CHECK_UNARY(csubstr("0xD").is_real()); + CHECK_UNARY(csubstr("0XD").is_real()); + CHECK_UNARY(csubstr("0xE").is_real()); + CHECK_UNARY(csubstr("0XE").is_real()); + CHECK_UNARY(csubstr("0xF").is_real()); + CHECK_UNARY(csubstr("0XF").is_real()); + CHECK_FALSE(csubstr("0xg").is_real()); + CHECK_FALSE(csubstr("0Xg").is_real()); + CHECK_FALSE(csubstr("0xG").is_real()); + CHECK_FALSE(csubstr("0XG").is_real()); + CHECK_UNARY(csubstr("-0x1").is_real()); + CHECK_UNARY(csubstr("-0X1").is_real()); + CHECK_UNARY(csubstr("-0x0").is_real()); + CHECK_UNARY(csubstr("-0X0").is_real()); + CHECK_UNARY(csubstr("-0xa").is_real()); + CHECK_UNARY(csubstr("-0Xa").is_real()); + CHECK_UNARY(csubstr("-0xb").is_real()); + CHECK_UNARY(csubstr("-0Xb").is_real()); + CHECK_UNARY(csubstr("-0xc").is_real()); + CHECK_UNARY(csubstr("-0Xc").is_real()); + CHECK_UNARY(csubstr("-0xd").is_real()); + CHECK_UNARY(csubstr("-0Xd").is_real()); + CHECK_UNARY(csubstr("-0xe").is_real()); + CHECK_UNARY(csubstr("-0Xe").is_real()); + CHECK_UNARY(csubstr("-0xf").is_real()); + CHECK_UNARY(csubstr("-0Xf").is_real()); + CHECK_UNARY(csubstr("-0xA").is_real()); + CHECK_UNARY(csubstr("-0XA").is_real()); + CHECK_UNARY(csubstr("-0xB").is_real()); + CHECK_UNARY(csubstr("-0XB").is_real()); + CHECK_UNARY(csubstr("-0xC").is_real()); + CHECK_UNARY(csubstr("-0XC").is_real()); + CHECK_UNARY(csubstr("-0xD").is_real()); + CHECK_UNARY(csubstr("-0XD").is_real()); + CHECK_UNARY(csubstr("-0xE").is_real()); + CHECK_UNARY(csubstr("-0XE").is_real()); + CHECK_UNARY(csubstr("-0xF").is_real()); + CHECK_UNARY(csubstr("-0XF").is_real()); + CHECK_FALSE(csubstr("-0xg").is_real()); + CHECK_FALSE(csubstr("-0Xg").is_real()); + CHECK_FALSE(csubstr("-0xG").is_real()); + CHECK_FALSE(csubstr("-0XG").is_real()); + CHECK_UNARY(csubstr("0x1.e8480p+19").is_real()); + CHECK_UNARY(csubstr("0X1.e8480P+19").is_real()); + CHECK_UNARY(csubstr("0x1.e8480P+19").is_real()); + CHECK_UNARY(csubstr("0X1.e8480p+19").is_real()); + CHECK_UNARY(csubstr("-0x1.e8480p+19").is_real()); + CHECK_UNARY(csubstr("-0X1.e8480P+19").is_real()); + CHECK_UNARY(csubstr("-0x1.e8480P+19").is_real()); + CHECK_UNARY(csubstr("-0X1.e8480p+19").is_real()); + } + SUBCASE("binary") + { + CHECK_FALSE(csubstr("0b").is_real()); + CHECK_FALSE(csubstr("0B").is_real()); + CHECK_UNARY(csubstr("0b0").is_real()); + CHECK_UNARY(csubstr("0B0").is_real()); + CHECK_UNARY(csubstr("0b1").is_real()); + CHECK_UNARY(csubstr("0B1").is_real()); + CHECK_FALSE(csubstr("0b2").is_real()); + CHECK_FALSE(csubstr("0B2").is_real()); + CHECK_UNARY(csubstr("-0b0").is_real()); + CHECK_UNARY(csubstr("-0B0").is_real()); + CHECK_UNARY(csubstr("-0b1").is_real()); + CHECK_UNARY(csubstr("-0B1").is_real()); + CHECK_FALSE(csubstr("-0b2").is_real()); + CHECK_FALSE(csubstr("-0B2").is_real()); + } + SUBCASE("octal") + { + CHECK_FALSE(csubstr("0o").is_real()); + CHECK_FALSE(csubstr("0O").is_real()); + CHECK_UNARY(csubstr("0o0").is_real()); + CHECK_UNARY(csubstr("0O0").is_real()); + CHECK_UNARY(csubstr("0o1").is_real()); + CHECK_UNARY(csubstr("0O1").is_real()); + CHECK_UNARY(csubstr("0o6").is_real()); + CHECK_UNARY(csubstr("0O6").is_real()); + CHECK_UNARY(csubstr("0o6").is_real()); + CHECK_UNARY(csubstr("0O6").is_real()); + CHECK_UNARY(csubstr("0o7").is_real()); + CHECK_UNARY(csubstr("0O7").is_real()); + CHECK_FALSE(csubstr("0o8").is_real()); + CHECK_FALSE(csubstr("0O8").is_real()); + CHECK_FALSE(csubstr("0o9").is_real()); + CHECK_FALSE(csubstr("0O9").is_real()); + CHECK_UNARY(csubstr("-0o0").is_real()); + CHECK_UNARY(csubstr("-0O0").is_real()); + CHECK_UNARY(csubstr("-0o1").is_real()); + CHECK_UNARY(csubstr("-0O1").is_real()); + CHECK_UNARY(csubstr("-0o6").is_real()); + CHECK_UNARY(csubstr("-0O6").is_real()); + CHECK_UNARY(csubstr("-0o6").is_real()); + CHECK_UNARY(csubstr("-0O6").is_real()); + CHECK_UNARY(csubstr("-0o7").is_real()); + CHECK_UNARY(csubstr("-0O7").is_real()); + CHECK_FALSE(csubstr("-0o8").is_real()); + CHECK_FALSE(csubstr("-0O8").is_real()); + CHECK_FALSE(csubstr("-0o9").is_real()); + CHECK_FALSE(csubstr("-0O9").is_real()); + } + SUBCASE("infinity") + { + CHECK_UNARY(csubstr("infinity").is_real()); + CHECK_FALSE(csubstr(" infinity").is_real()); + CHECK_UNARY(csubstr("-infinity").is_real()); + CHECK_FALSE(csubstr(" -infinity").is_real()); + CHECK_UNARY(csubstr("+infinity").is_real()); + CHECK_FALSE(csubstr(" +infinity").is_real()); + CHECK_FALSE(csubstr("infinity ").is_real()); + CHECK_FALSE(csubstr(" infinity ").is_real()); + CHECK_FALSE(csubstr("-infinity ").is_real()); + CHECK_FALSE(csubstr(" -infinity ").is_real()); + CHECK_FALSE(csubstr("+infinity ").is_real()); + CHECK_FALSE(csubstr(" +infinity ").is_real()); + CHECK_FALSE(csubstr("infinity1").is_real()); + CHECK_FALSE(csubstr(" infinity1").is_real()); + CHECK_FALSE(csubstr("-infinity1").is_real()); + CHECK_FALSE(csubstr(" -infinity1").is_real()); + CHECK_FALSE(csubstr("+infinity1").is_real()); + CHECK_FALSE(csubstr(" +infinity1").is_real()); + CHECK_FALSE(csubstr("infin").is_real()); + CHECK_FALSE(csubstr(" infin").is_real()); + CHECK_FALSE(csubstr("-infin").is_real()); + CHECK_FALSE(csubstr(" -infin").is_real()); + CHECK_FALSE(csubstr("+infin").is_real()); + CHECK_FALSE(csubstr(" +infin").is_real()); + CHECK_FALSE(csubstr("inflated").is_real()); + CHECK_FALSE(csubstr(" inflated").is_real()); + CHECK_FALSE(csubstr("-inflated").is_real()); + CHECK_FALSE(csubstr(" -inflated").is_real()); + CHECK_FALSE(csubstr("+inflated").is_real()); + CHECK_FALSE(csubstr(" +inflated").is_real()); + } + SUBCASE("inf") + { + CHECK_UNARY(csubstr("inf").is_real()); + CHECK_FALSE(csubstr(" inf").is_real()); + CHECK_UNARY(csubstr("-inf").is_real()); + CHECK_FALSE(csubstr(" -inf").is_real()); + CHECK_UNARY(csubstr("+inf").is_real()); + CHECK_FALSE(csubstr(" +inf").is_real()); + CHECK_FALSE(csubstr("inf ").is_real()); + CHECK_FALSE(csubstr(" inf ").is_real()); + CHECK_FALSE(csubstr("-inf ").is_real()); + CHECK_FALSE(csubstr(" -inf ").is_real()); + CHECK_FALSE(csubstr("+inf ").is_real()); + CHECK_FALSE(csubstr(" +inf ").is_real()); + CHECK_FALSE(csubstr("inf1").is_real()); + CHECK_FALSE(csubstr(" inf1").is_real()); + CHECK_FALSE(csubstr("-inf1").is_real()); + CHECK_FALSE(csubstr(" -inf1").is_real()); + CHECK_FALSE(csubstr("+inf1").is_real()); + CHECK_FALSE(csubstr(" +inf1").is_real()); + } + SUBCASE("nan") + { + CHECK_UNARY(csubstr("nan").is_real()); + CHECK_FALSE(csubstr(" nan").is_real()); + CHECK_UNARY(csubstr("-nan").is_real()); + CHECK_FALSE(csubstr(" -nan").is_real()); + CHECK_UNARY(csubstr("+nan").is_real()); + CHECK_FALSE(csubstr(" +nan").is_real()); + CHECK_FALSE(csubstr("nan ").is_real()); + CHECK_FALSE(csubstr(" nan ").is_real()); + CHECK_FALSE(csubstr("-nan ").is_real()); + CHECK_FALSE(csubstr(" -nan ").is_real()); + CHECK_FALSE(csubstr("+nan ").is_real()); + CHECK_FALSE(csubstr(" +nan ").is_real()); + CHECK_FALSE(csubstr("nan1").is_real()); + CHECK_FALSE(csubstr(" nan1").is_real()); + CHECK_FALSE(csubstr("-nan1").is_real()); + CHECK_FALSE(csubstr(" -nan1").is_real()); + CHECK_FALSE(csubstr("+nan1").is_real()); + CHECK_FALSE(csubstr(" +nan1").is_real()); + } +} + +typedef enum : uint8_t { kIsNone = 0, kIsUint = 1, kIsInt = 3, kIsReal = 7 } NumberClass; +struct number +{ + csubstr num; + NumberClass cls; + + template<size_t N> + number(const char (&n)[N], NumberClass c) : num(n), cls(c) {} + number(csubstr n, NumberClass c) : num(n), cls(c) {} + + void test(csubstr ref={}) + { + if(ref.empty()) + ref = num; + INFO("num=" << num); + INFO("ref=" << ref); + switch(cls) + { + case kIsUint: + { + INFO("uint"); + CHECK_EQ(num.first_uint_span(), ref); + CHECK_EQ(num.first_int_span(), ref); + CHECK_EQ(num.first_real_span(), ref); + CHECK_UNARY(num.first_uint_span().is_unsigned_integer()); + CHECK_UNARY(num.first_uint_span().is_integer()); + CHECK_UNARY(num.first_uint_span().is_number()); + break; + } + case kIsInt: + { + INFO("int"); + CHECK_EQ(num.first_uint_span(), ""); + CHECK_EQ(num.first_int_span(), ref); + CHECK_EQ(num.first_real_span(), ref); + CHECK_FALSE(num.first_int_span().is_unsigned_integer()); + CHECK_UNARY(num.first_int_span().is_integer()); + CHECK_UNARY(num.first_int_span().is_number()); + break; + } + case kIsReal: + { + INFO("real"); + CHECK_EQ(num.first_uint_span(), ""); + CHECK_EQ(num.first_int_span(), ""); + CHECK_EQ(num.first_real_span(), ref); + CHECK_FALSE(num.first_real_span().is_unsigned_integer()); + CHECK_FALSE(num.first_real_span().is_integer()); + CHECK_UNARY(num .first_real_span().is_number()); + break; + } + case kIsNone: + { + INFO("none"); + CHECK_EQ(num.first_uint_span(), ""); + CHECK_EQ(num.first_int_span(), ""); + CHECK_EQ(num.first_real_span(), ""); + CHECK_FALSE(num.is_unsigned_integer()); + CHECK_FALSE(num.is_integer()); + CHECK_FALSE(num.is_number()); + break; + } + default: + { + CHECK_UNARY(false);//FAIL(); + break; + } + } + } +}; + +const number numbers[] = { + {"", kIsNone}, + {"0x", kIsNone}, + {"0b", kIsNone}, + {"0o", kIsNone}, + {".", kIsNone}, + {"0x.", kIsNone}, + {"0b.", kIsNone}, + {"0o.", kIsNone}, + {"-", kIsNone}, + {"0x-", kIsNone}, + {"0b-", kIsNone}, + {"0o-", kIsNone}, + {"+", kIsNone}, + {"0x+", kIsNone}, + {"0b+", kIsNone}, + {"0o+", kIsNone}, + {".e", kIsNone}, + {".e+", kIsNone}, + {".e-", kIsNone}, + {"0x.p", kIsNone}, + {"0x.p+", kIsNone}, + {"0x.p-", kIsNone}, + {"0b.p", kIsNone}, + {"0b.p+", kIsNone}, + {"0b.p-", kIsNone}, + {"0o.p", kIsNone}, + {"0o.p+", kIsNone}, + {"0o.p-", kIsNone}, + {"0x.p+", kIsNone}, + {"0x0.p+", kIsNone}, + {"0x.0p+", kIsNone}, + {"0x.p+0", kIsNone}, + {"0x.p+00", kIsNone}, + {"0x0.0p+", kIsNone}, + {"0x.0p+0", kIsReal}, + {"0x0.p+0", kIsReal}, + {"0x0.0p+0", kIsReal}, + {"0x0.0p+00", kIsReal}, + {"0x00.00p+00", kIsReal}, + {"0x0p0.00p+00", kIsNone}, + {"0x00.0p0p+00", kIsNone}, + {"0x00.00p+0p0", kIsNone}, + {"0x00.00p+00p", kIsNone}, + {"0b.p+", kIsNone}, + {"0b0.p+", kIsNone}, + {"0b.0p+", kIsNone}, + {"0b.p+0", kIsNone}, + {"0b.p+00", kIsNone}, + {"0b0.0p+", kIsNone}, + {"0b.0p+0", kIsReal}, + {"0b0.p+0", kIsReal}, + {"0b0.0p+0", kIsReal}, + {"0b0.0p+00", kIsReal}, + {"0b00.00p+00", kIsReal}, + {"0b0p0.00p+00", kIsNone}, + {"0b00.0p0p+00", kIsNone}, + {"0b00.00p+0p0", kIsNone}, + {"0b00.00p+00p", kIsNone}, + {"0o.p+", kIsNone}, + {"0o0.p+", kIsNone}, + {"0o.0p+", kIsNone}, + {"0o.p+0", kIsNone}, + {"0o.p+00", kIsNone}, + {"0o0.0p+", kIsNone}, + {"0o.0p+0", kIsReal}, + {"0o0.p+0", kIsReal}, + {"0o0.0p+0", kIsReal}, + {"0o0.0p+00", kIsReal}, + {"0o00.00p+00", kIsReal}, + {"0o0p0.00p+00", kIsNone}, + {"0o00.0p0p+00", kIsNone}, + {"0o00.00p+0p0", kIsNone}, + {"0o00.00p+00p", kIsNone}, + {".e+", kIsNone}, + {"0.e+", kIsNone}, + {".0e+", kIsNone}, + {".e+0", kIsNone}, + {".e+00", kIsNone}, + {"0.0e+", kIsNone}, + {".0e+0", kIsReal}, + {"0.e+0", kIsReal}, + {"0.0e+0", kIsReal}, + {"0.0e+00", kIsReal}, + {"00.00e+00", kIsReal}, + {"0e0.00e+00", kIsNone}, + {"00.0e0e+00", kIsNone}, + {"00.00e+0e0", kIsNone}, + {"00.00e+00e", kIsNone}, + {"0x1234.", kIsReal}, + {"+0x1234.", kIsReal}, + {"-0x1234.", kIsReal}, + {"0x.1234", kIsReal}, + {"0x0.1.2.3", kIsNone}, + {"0o0.1.2.3", kIsNone}, + {"0b0.1.0.1", kIsNone}, + {"a", kIsNone}, + {"b", kIsNone}, + {"?", kIsNone}, + {"0.0.1", kIsNone}, + {"0.0.9", kIsNone}, + {"0.0.10", kIsNone}, + {"0.1.0", kIsNone}, + {"0.9.0", kIsNone}, + {"0.10.0", kIsNone}, + {"1.0.0", kIsNone}, + {"9.0.0", kIsNone}, + {"10.0.0", kIsNone}, + {".0", kIsReal}, + {"0.", kIsReal}, + {"0.0", kIsReal}, + {"1234", kIsUint}, + {"+1234", kIsUint}, + {"-1234", kIsInt}, + {"1234.0", kIsReal}, + {"+1234.0", kIsReal}, + {"-1234.0", kIsReal}, + {"0000", kIsUint}, + {"0123", kIsUint}, + {"0", kIsUint}, + {"1", kIsUint}, + {"1.", kIsReal}, + {".1", kIsReal}, + {"0x1234", kIsUint}, + {"+0x1234", kIsUint}, + {"-0x1234", kIsInt}, + {"0b01", kIsUint}, + {"1e+1", kIsReal}, + {"1e-1", kIsReal}, + {"1.e-1", kIsReal}, + {"1.e+1", kIsReal}, + {"1.0e-1", kIsReal}, + {"1.0e+1", kIsReal}, + {"1e+123", kIsReal}, + {"1e-123", kIsReal}, + {"1.e-123", kIsReal}, + {"1.e+123", kIsReal}, + {"1.0e123", kIsReal}, + {"1.0e-123", kIsReal}, + {"1.0e+123", kIsReal}, + {"0x1.e8480p+19", kIsReal}, + {"0x1.g8480p+19", kIsNone}, + {"0xg.e8480p+19", kIsNone}, + {"0b101.011p+19", kIsReal}, + {"0b101.012p+19", kIsNone}, + {"0b102.011p+19", kIsNone}, + {"0o173.045p+19", kIsReal}, + {"0o173.048p+19", kIsNone}, + {"0o178.045p+19", kIsNone}, + {"infinity", kIsReal}, + {"inf", kIsReal}, + {"nan", kIsReal}, +}; + +TEST_CASE("substr.is_number") +{ + SUBCASE("basic.hex") + { + CHECK_EQ(csubstr("0x.0p+0").first_real_span(), csubstr("0x.0p+0")); + CHECK_EQ(csubstr("0x)sdkjhsdfkju").first_int_span(), csubstr{}); + CHECK_EQ(csubstr("0x)sdkjhsdfkju").first_uint_span(), csubstr{}); + CHECK_EQ(csubstr("0x)sdkjhsdfkju").first_real_span(), csubstr{}); + CHECK_EQ(csubstr("0x0)sdkjhsdfkju").first_int_span(), csubstr("0x0")); + CHECK_EQ(csubstr("0x0)sdkjhsdfkju").first_uint_span(), csubstr("0x0")); + CHECK_EQ(csubstr("0x0)sdkjhsdfkju").first_real_span(), csubstr("0x0")); + } + SUBCASE("basic.dec") + { + CHECK_EQ(csubstr("+infinity").first_real_span(), csubstr("+infinity")); + CHECK_EQ(csubstr("-infinity").first_real_span(), csubstr("-infinity")); + CHECK_EQ(csubstr("+inf").first_real_span(), csubstr("+inf")); + CHECK_EQ(csubstr("-inf").first_real_span(), csubstr("-inf")); + CHECK_EQ(csubstr("0.e+0").first_real_span(), csubstr("0.e+0")); + CHECK_EQ(csubstr("0.e-0").first_real_span(), csubstr("0.e-0")); + } + SUBCASE("plain") + { + for(number n : numbers) + { + n.test(); + } + } + char buf[128]; + SUBCASE("leading+") + { + for(number n : numbers) + { + INFO("orig=" << n.num); + substr withplus = cat_sub(buf, '+', n.num); + NumberClass cls = n.cls; + if(withplus.begins_with("+-") || withplus.begins_with("++")) + cls = kIsNone; + number cp(withplus, cls); + cp.test(); + } + } + SUBCASE("leading-") + { + for(number n : numbers) + { + INFO("orig=" << n.num); + substr withminus = cat_sub(buf, '-', n.num); + NumberClass cls = n.cls; + if(cls == kIsUint) + cls = kIsInt; + if(withminus.begins_with("--") || withminus.begins_with("-+")) + cls = kIsNone; + number cp(withminus, cls); + cp.test(); + } + } + SUBCASE("capital_e") + { + for(number n : numbers) + { + INFO("orig=" << n.num); + substr replaced = cat_sub(buf, n.num); + replaced.replace('e', 'E'); + number cp(replaced, n.cls); + cp.test(); + } + } + SUBCASE("capital_p") + { + for(number n : numbers) + { + INFO("orig=" << n.num); + substr replaced = cat_sub(buf, n.num); + replaced.replace('p', 'P'); + number cp(replaced, n.cls); + cp.test(); + } + } + SUBCASE("capital_0x") + { + for(number n : numbers) + { + INFO("orig=" << n.num); + substr replaced = cat_sub(buf, n.num); + replaced.replace('x', 'X'); + number cp(replaced, n.cls); + cp.test(); + } + } + SUBCASE("capital_0b") + { + for(number n : numbers) + { + INFO("orig=" << n.num); + substr replaced = cat_sub(buf, n.num); + replaced.replace('b', 'B'); + number cp(replaced, n.cls); + cp.test(); + } + } + SUBCASE("capital_0o") + { + for(number n : numbers) + { + INFO("orig=" << n.num); + substr replaced = cat_sub(buf, n.num); + replaced.replace('o', 'O'); + number cp(replaced, n.cls); + cp.test(); + } + } + SUBCASE("numbers before") + { + char numbuf_[16] = {}; + substr numbuf = numbuf_; + for(number n : numbers) + { + INFO("orig=" << n.num); + for(char c : {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}) + { + numbuf.fill(c); + substr result = cat_sub(buf, numbuf, n.num); + number cp(result.sub(numbuf.len), n.cls); + cp.test(); + } + } + } + SUBCASE("numbers after") + { + char numbuf_[16] = {}; + substr numbuf = numbuf_; + for(number n : numbers) + { + INFO("orig=" << n.num); + for(char c : {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}) + { + numbuf.fill(c); + substr result = cat_sub(buf, n.num, numbuf); + number cp(result.first(n.num.len), n.cls); + cp.test(); + } + } + } + SUBCASE("delimiter after") + { + for(number n : numbers) + { + INFO("orig=" << n.num); + for(char c : {' ', '\n', ']', ')', '}', ',', ';', '\r', '\t','\0'}) + { + INFO("delimiter='" << c << "'"); + substr result = cat_sub(buf, n.num, c); + number cp(result, n.cls); + cp.test(n.num); + } + } + } + csubstr garbage = "sdkjhsdfkju"; + SUBCASE("prepend") + { + // adding anything before the number will make it not be a number + for(number n : numbers) + { + if(n.num.empty()) + continue; + INFO("orig=" << n.num); + for(int i = 0; i < 127; ++i) + { + char c = (char)i; + csubstr fmtd = cat_sub(buf, garbage, c, n.num); + number cp(fmtd, kIsNone); + cp.test(); + } + } + } + SUBCASE("append") + { + // adding after may or may not make it a number + for(number const& n : numbers) + { + INFO("orig=" << n.num); + for(int i = 0; i < 127; ++i) + { + number cp = n; + char c = (char)i; + cp.num = cat_sub(buf, n.num, c, garbage); + if(!csubstr::_is_delim_char(c)) + { + cp.cls = kIsNone; + } + cp.test(n.num); + } + } + } +} + +TEST_CASE("substr.triml") +{ + using S = csubstr; + + CHECK_EQ(S("aaabbb" ).triml('a' ), "bbb"); + CHECK_EQ(S("aaabbb" ).triml('b' ), "aaabbb"); + CHECK_EQ(S("aaabbb" ).triml('c' ), "aaabbb"); + CHECK_EQ(S("aaabbb" ).triml("ab"), ""); + CHECK_EQ(S("aaabbb" ).triml("ba"), ""); + CHECK_EQ(S("aaabbb" ).triml("cd"), "aaabbb"); + CHECK_EQ(S("aaa...bbb").triml('a' ), "...bbb"); + CHECK_EQ(S("aaa...bbb").triml('b' ), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").triml('c' ), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").triml("ab"), "...bbb"); + CHECK_EQ(S("aaa...bbb").triml("ba"), "...bbb"); + CHECK_EQ(S("aaa...bbb").triml("ab."), ""); + CHECK_EQ(S("aaa...bbb").triml("a."), "bbb"); + CHECK_EQ(S("aaa...bbb").triml(".a"), "bbb"); + CHECK_EQ(S("aaa...bbb").triml("b."), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").triml(".b"), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").triml("cd"), "aaa...bbb"); + + CHECK_EQ(S("ab" ).triml('a' ), "b"); + CHECK_EQ(S("ab" ).triml('b' ), "ab"); + CHECK_EQ(S("ab" ).triml('c' ), "ab"); + CHECK_EQ(S("ab" ).triml("ab"), ""); + CHECK_EQ(S("ab" ).triml("ba"), ""); + CHECK_EQ(S("ab" ).triml("cd"), "ab"); + CHECK_EQ(S("a...b").triml('a' ), "...b"); + CHECK_EQ(S("a...b").triml('b' ), "a...b"); + CHECK_EQ(S("a...b").triml('c' ), "a...b"); + CHECK_EQ(S("a...b").triml("ab"), "...b"); + CHECK_EQ(S("a...b").triml("ba"), "...b"); + CHECK_EQ(S("a...b").triml("ab."), ""); + CHECK_EQ(S("a...b").triml("a."), "b"); + CHECK_EQ(S("a...b").triml(".a"), "b"); + CHECK_EQ(S("a...b").triml("b."), "a...b"); + CHECK_EQ(S("a...b").triml(".b"), "a...b"); + CHECK_EQ(S("a...b").triml("cd"), "a...b"); +} + +TEST_CASE("substr.trimr") +{ + using S = csubstr; + + CHECK_EQ(S("aaabbb" ).trimr('a' ), "aaabbb"); + CHECK_EQ(S("aaabbb" ).trimr('b' ), "aaa"); + CHECK_EQ(S("aaabbb" ).trimr('c' ), "aaabbb"); + CHECK_EQ(S("aaabbb" ).trimr("ab"), ""); + CHECK_EQ(S("aaabbb" ).trimr("ba"), ""); + CHECK_EQ(S("aaabbb" ).trimr("cd"), "aaabbb"); + CHECK_EQ(S("aaa...bbb").trimr('a' ), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").trimr('b' ), "aaa..."); + CHECK_EQ(S("aaa...bbb").trimr('c' ), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").trimr("ab"), "aaa..."); + CHECK_EQ(S("aaa...bbb").trimr("ba"), "aaa..."); + CHECK_EQ(S("aaa...bbb").trimr("ab."), ""); + CHECK_EQ(S("aaa...bbb").trimr("a."), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").trimr(".a"), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").trimr("b."), "aaa"); + CHECK_EQ(S("aaa...bbb").trimr(".b"), "aaa"); + CHECK_EQ(S("aaa...bbb").trimr("cd"), "aaa...bbb"); + + CHECK_EQ(S("ab" ).trimr('a' ), "ab"); + CHECK_EQ(S("ab" ).trimr('b' ), "a"); + CHECK_EQ(S("ab" ).trimr('c' ), "ab"); + CHECK_EQ(S("ab" ).trimr("ab"), ""); + CHECK_EQ(S("ab" ).trimr("ba"), ""); + CHECK_EQ(S("ab" ).trimr("cd"), "ab"); + CHECK_EQ(S("a...b").trimr('a' ), "a...b"); + CHECK_EQ(S("a...b").trimr('b' ), "a..."); + CHECK_EQ(S("a...b").trimr('c' ), "a...b"); + CHECK_EQ(S("a...b").trimr("ab"), "a..."); + CHECK_EQ(S("a...b").trimr("ba"), "a..."); + CHECK_EQ(S("a...b").trimr("ab."), ""); + CHECK_EQ(S("a...b").trimr("a."), "a...b"); + CHECK_EQ(S("a...b").trimr(".a"), "a...b"); + CHECK_EQ(S("a...b").trimr("b."), "a"); + CHECK_EQ(S("a...b").trimr(".b"), "a"); + CHECK_EQ(S("a...b").trimr("cd"), "a...b"); +} + +TEST_CASE("substr.trim") +{ + using S = csubstr; + + CHECK_EQ(S("aaabbb" ).trim('a' ), "bbb"); + CHECK_EQ(S("aaabbb" ).trim('b' ), "aaa"); + CHECK_EQ(S("aaabbb" ).trim('c' ), "aaabbb"); + CHECK_EQ(S("aaabbb" ).trim("ab"), ""); + CHECK_EQ(S("aaabbb" ).trim("ba"), ""); + CHECK_EQ(S("aaabbb" ).trim("cd"), "aaabbb"); + CHECK_EQ(S("aaa...bbb").trim('a' ), "...bbb"); + CHECK_EQ(S("aaa...bbb").trim('b' ), "aaa..."); + CHECK_EQ(S("aaa...bbb").trim('c' ), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").trim("ab"), "..."); + CHECK_EQ(S("aaa...bbb").trim("ba"), "..."); + CHECK_EQ(S("aaa...bbb").trim('c' ), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").trim("ab."), ""); + CHECK_EQ(S("aaa...bbb").trim("." ), "aaa...bbb"); + CHECK_EQ(S("aaa...bbb").trim("a."), "bbb"); + CHECK_EQ(S("aaa...bbb").trim(".a"), "bbb"); + CHECK_EQ(S("aaa...bbb").trim("b."), "aaa"); + CHECK_EQ(S("aaa...bbb").trim(".b"), "aaa"); + CHECK_EQ(S("aaa...bbb").trim("cd"), "aaa...bbb"); + + CHECK_EQ(S("ab" ).trim('a' ), "b"); + CHECK_EQ(S("ab" ).trim('b' ), "a"); + CHECK_EQ(S("ab" ).trim('c' ), "ab"); + CHECK_EQ(S("ab" ).trim("ab"), ""); + CHECK_EQ(S("ab" ).trim("ba"), ""); + CHECK_EQ(S("ab" ).trim("cd"), "ab"); + CHECK_EQ(S("a...b").trim('a' ), "...b"); + CHECK_EQ(S("a...b").trim('b' ), "a..."); + CHECK_EQ(S("a...b").trim('c' ), "a...b"); + CHECK_EQ(S("a...b").trim("ab"), "..."); + CHECK_EQ(S("a...b").trim("ba"), "..."); + CHECK_EQ(S("a...b").trim('c' ), "a...b"); + CHECK_EQ(S("a...b").trim("ab."), ""); + CHECK_EQ(S("a...b").trim("." ), "a...b"); + CHECK_EQ(S("a...b").trim("a."), "b"); + CHECK_EQ(S("a...b").trim(".a"), "b"); + CHECK_EQ(S("a...b").trim("b."), "a"); + CHECK_EQ(S("a...b").trim(".b"), "a"); + CHECK_EQ(S("a...b").trim("cd"), "a...b"); +} + +TEST_CASE("substr.pop_right") +{ + using S = csubstr; + + CHECK_EQ(S("0/1/2" ).pop_right('/' ), "2"); + CHECK_EQ(S("0/1/2" ).pop_right('/', true), "2"); + CHECK_EQ(S("0/1/2/" ).pop_right('/' ), ""); + CHECK_EQ(S("0/1/2/" ).pop_right('/', true), "2/"); + CHECK_EQ(S("0/1/2///" ).pop_right('/' ), ""); + CHECK_EQ(S("0/1/2///" ).pop_right('/', true), "2///"); + + CHECK_EQ(S("0/1//2" ).pop_right('/' ), "2"); + CHECK_EQ(S("0/1//2" ).pop_right('/', true), "2"); + CHECK_EQ(S("0/1//2/" ).pop_right('/' ), ""); + CHECK_EQ(S("0/1//2/" ).pop_right('/', true), "2/"); + CHECK_EQ(S("0/1//2///" ).pop_right('/' ), ""); + CHECK_EQ(S("0/1//2///" ).pop_right('/', true), "2///"); + + CHECK_EQ(S("0/1///2" ).pop_right('/' ), "2"); + CHECK_EQ(S("0/1///2" ).pop_right('/', true), "2"); + CHECK_EQ(S("0/1///2/" ).pop_right('/' ), ""); + CHECK_EQ(S("0/1///2/" ).pop_right('/', true), "2/"); + CHECK_EQ(S("0/1///2///" ).pop_right('/' ), ""); + CHECK_EQ(S("0/1///2///" ).pop_right('/', true), "2///"); + + CHECK_EQ(S("/0/1/2" ).pop_right('/' ), "2"); + CHECK_EQ(S("/0/1/2" ).pop_right('/', true), "2"); + CHECK_EQ(S("/0/1/2/" ).pop_right('/' ), ""); + CHECK_EQ(S("/0/1/2/" ).pop_right('/', true), "2/"); + CHECK_EQ(S("/0/1/2///").pop_right('/' ), ""); + CHECK_EQ(S("/0/1/2///").pop_right('/', true), "2///"); + + CHECK_EQ(S("0" ).pop_right('/' ), "0"); + CHECK_EQ(S("0" ).pop_right('/', true), "0"); + CHECK_EQ(S("0/" ).pop_right('/' ), ""); + CHECK_EQ(S("0/" ).pop_right('/', true), "0/"); + CHECK_EQ(S("0///" ).pop_right('/' ), ""); + CHECK_EQ(S("0///" ).pop_right('/', true), "0///"); + + CHECK_EQ(S("/0" ).pop_right('/' ), "0"); + CHECK_EQ(S("/0" ).pop_right('/', true), "0"); + CHECK_EQ(S("/0/" ).pop_right('/' ), ""); + CHECK_EQ(S("/0/" ).pop_right('/', true), "0/"); + CHECK_EQ(S("/0///" ).pop_right('/' ), ""); + CHECK_EQ(S("/0///" ).pop_right('/', true), "0///"); + + CHECK_EQ(S("/" ).pop_right('/' ), ""); + CHECK_EQ(S("/" ).pop_right('/', true), ""); + CHECK_EQ(S("///" ).pop_right('/' ), ""); + CHECK_EQ(S("///" ).pop_right('/', true), ""); + + CHECK_EQ(S("" ).pop_right('/' ), ""); + CHECK_EQ(S("" ).pop_right('/', true), ""); + + CHECK_EQ(S("0-1-2" ).pop_right('-' ), "2"); + CHECK_EQ(S("0-1-2" ).pop_right('-', true), "2"); + CHECK_EQ(S("0-1-2-" ).pop_right('-' ), ""); + CHECK_EQ(S("0-1-2-" ).pop_right('-', true), "2-"); + CHECK_EQ(S("0-1-2---" ).pop_right('-' ), ""); + CHECK_EQ(S("0-1-2---" ).pop_right('-', true), "2---"); + + CHECK_EQ(S("0-1--2" ).pop_right('-' ), "2"); + CHECK_EQ(S("0-1--2" ).pop_right('-', true), "2"); + CHECK_EQ(S("0-1--2-" ).pop_right('-' ), ""); + CHECK_EQ(S("0-1--2-" ).pop_right('-', true), "2-"); + CHECK_EQ(S("0-1--2---" ).pop_right('-' ), ""); + CHECK_EQ(S("0-1--2---" ).pop_right('-', true), "2---"); + + CHECK_EQ(S("0-1---2" ).pop_right('-' ), "2"); + CHECK_EQ(S("0-1---2" ).pop_right('-', true), "2"); + CHECK_EQ(S("0-1---2-" ).pop_right('-' ), ""); + CHECK_EQ(S("0-1---2-" ).pop_right('-', true), "2-"); + CHECK_EQ(S("0-1---2---" ).pop_right('-' ), ""); + CHECK_EQ(S("0-1---2---" ).pop_right('-', true), "2---"); + + CHECK_EQ(S("-0-1-2" ).pop_right('-' ), "2"); + CHECK_EQ(S("-0-1-2" ).pop_right('-', true), "2"); + CHECK_EQ(S("-0-1-2-" ).pop_right('-' ), ""); + CHECK_EQ(S("-0-1-2-" ).pop_right('-', true), "2-"); + CHECK_EQ(S("-0-1-2---").pop_right('-' ), ""); + CHECK_EQ(S("-0-1-2---").pop_right('-', true), "2---"); + + CHECK_EQ(S("0" ).pop_right('-' ), "0"); + CHECK_EQ(S("0" ).pop_right('-', true), "0"); + CHECK_EQ(S("0-" ).pop_right('-' ), ""); + CHECK_EQ(S("0-" ).pop_right('-', true), "0-"); + CHECK_EQ(S("0---" ).pop_right('-' ), ""); + CHECK_EQ(S("0---" ).pop_right('-', true), "0---"); + + CHECK_EQ(S("-0" ).pop_right('-' ), "0"); + CHECK_EQ(S("-0" ).pop_right('-', true), "0"); + CHECK_EQ(S("-0-" ).pop_right('-' ), ""); + CHECK_EQ(S("-0-" ).pop_right('-', true), "0-"); + CHECK_EQ(S("-0---" ).pop_right('-' ), ""); + CHECK_EQ(S("-0---" ).pop_right('-', true), "0---"); + + CHECK_EQ(S("-" ).pop_right('-' ), ""); + CHECK_EQ(S("-" ).pop_right('-', true), ""); + CHECK_EQ(S("---" ).pop_right('-' ), ""); + CHECK_EQ(S("---" ).pop_right('-', true), ""); + + CHECK_EQ(S("" ).pop_right('-' ), ""); + CHECK_EQ(S("" ).pop_right('-', true), ""); +} + +TEST_CASE("substr.pop_left") +{ + using S = csubstr; + + CHECK_EQ(S("0/1/2" ).pop_left('/' ), "0"); + CHECK_EQ(S("0/1/2" ).pop_left('/', true), "0"); + CHECK_EQ(S("0/1/2/" ).pop_left('/' ), "0"); + CHECK_EQ(S("0/1/2/" ).pop_left('/', true), "0"); + CHECK_EQ(S("0/1/2///" ).pop_left('/' ), "0"); + CHECK_EQ(S("0/1/2///" ).pop_left('/', true), "0"); + + CHECK_EQ(S("0//1/2" ).pop_left('/' ), "0"); + CHECK_EQ(S("0//1/2" ).pop_left('/', true), "0"); + CHECK_EQ(S("0//1/2/" ).pop_left('/' ), "0"); + CHECK_EQ(S("0//1/2/" ).pop_left('/', true), "0"); + CHECK_EQ(S("0//1/2///" ).pop_left('/' ), "0"); + CHECK_EQ(S("0//1/2///" ).pop_left('/', true), "0"); + + CHECK_EQ(S("0///1/2" ).pop_left('/' ), "0"); + CHECK_EQ(S("0///1/2" ).pop_left('/', true), "0"); + CHECK_EQ(S("0///1/2/" ).pop_left('/' ), "0"); + CHECK_EQ(S("0///1/2/" ).pop_left('/', true), "0"); + CHECK_EQ(S("0///1/2///" ).pop_left('/' ), "0"); + CHECK_EQ(S("0///1/2///" ).pop_left('/', true), "0"); + + CHECK_EQ(S("/0/1/2" ).pop_left('/' ), ""); + CHECK_EQ(S("/0/1/2" ).pop_left('/', true), "/0"); + CHECK_EQ(S("/0/1/2/" ).pop_left('/' ), ""); + CHECK_EQ(S("/0/1/2/" ).pop_left('/', true), "/0"); + CHECK_EQ(S("/0/1/2///").pop_left('/' ), ""); + CHECK_EQ(S("/0/1/2///").pop_left('/', true), "/0"); + CHECK_EQ(S("///0/1/2" ).pop_left('/' ), ""); + CHECK_EQ(S("///0/1/2" ).pop_left('/', true), "///0"); + CHECK_EQ(S("///0/1/2/").pop_left('/' ), ""); + CHECK_EQ(S("///0/1/2/").pop_left('/', true), "///0"); + CHECK_EQ(S("///0/1/2/").pop_left('/' ), ""); + CHECK_EQ(S("///0/1/2/").pop_left('/', true), "///0"); + + CHECK_EQ(S("0" ).pop_left('/' ), "0"); + CHECK_EQ(S("0" ).pop_left('/', true), "0"); + CHECK_EQ(S("0/" ).pop_left('/' ), "0"); + CHECK_EQ(S("0/" ).pop_left('/', true), "0"); + CHECK_EQ(S("0///" ).pop_left('/' ), "0"); + CHECK_EQ(S("0///" ).pop_left('/', true), "0"); + + CHECK_EQ(S("/0" ).pop_left('/' ), ""); + CHECK_EQ(S("/0" ).pop_left('/', true), "/0"); + CHECK_EQ(S("/0/" ).pop_left('/' ), ""); + CHECK_EQ(S("/0/" ).pop_left('/', true), "/0"); + CHECK_EQ(S("/0///" ).pop_left('/' ), ""); + CHECK_EQ(S("/0///" ).pop_left('/', true), "/0"); + CHECK_EQ(S("///0///" ).pop_left('/' ), ""); + CHECK_EQ(S("///0///" ).pop_left('/', true), "///0"); + + CHECK_EQ(S("/" ).pop_left('/' ), ""); + CHECK_EQ(S("/" ).pop_left('/', true), ""); + CHECK_EQ(S("///" ).pop_left('/' ), ""); + CHECK_EQ(S("///" ).pop_left('/', true), ""); + + CHECK_EQ(S("" ).pop_left('/' ), ""); + CHECK_EQ(S("" ).pop_left('/', true), ""); + + CHECK_EQ(S("0-1-2" ).pop_left('-' ), "0"); + CHECK_EQ(S("0-1-2" ).pop_left('-', true), "0"); + CHECK_EQ(S("0-1-2-" ).pop_left('-' ), "0"); + CHECK_EQ(S("0-1-2-" ).pop_left('-', true), "0"); + CHECK_EQ(S("0-1-2---" ).pop_left('-' ), "0"); + CHECK_EQ(S("0-1-2---" ).pop_left('-', true), "0"); + + CHECK_EQ(S("0--1-2" ).pop_left('-' ), "0"); + CHECK_EQ(S("0--1-2" ).pop_left('-', true), "0"); + CHECK_EQ(S("0--1-2-" ).pop_left('-' ), "0"); + CHECK_EQ(S("0--1-2-" ).pop_left('-', true), "0"); + CHECK_EQ(S("0--1-2---" ).pop_left('-' ), "0"); + CHECK_EQ(S("0--1-2---" ).pop_left('-', true), "0"); + + CHECK_EQ(S("0---1-2" ).pop_left('-' ), "0"); + CHECK_EQ(S("0---1-2" ).pop_left('-', true), "0"); + CHECK_EQ(S("0---1-2-" ).pop_left('-' ), "0"); + CHECK_EQ(S("0---1-2-" ).pop_left('-', true), "0"); + CHECK_EQ(S("0---1-2---" ).pop_left('-' ), "0"); + CHECK_EQ(S("0---1-2---" ).pop_left('-', true), "0"); + + CHECK_EQ(S("-0-1-2" ).pop_left('-' ), ""); + CHECK_EQ(S("-0-1-2" ).pop_left('-', true), "-0"); + CHECK_EQ(S("-0-1-2-" ).pop_left('-' ), ""); + CHECK_EQ(S("-0-1-2-" ).pop_left('-', true), "-0"); + CHECK_EQ(S("-0-1-2---").pop_left('-' ), ""); + CHECK_EQ(S("-0-1-2---").pop_left('-', true), "-0"); + CHECK_EQ(S("---0-1-2" ).pop_left('-' ), ""); + CHECK_EQ(S("---0-1-2" ).pop_left('-', true), "---0"); + CHECK_EQ(S("---0-1-2-").pop_left('-' ), ""); + CHECK_EQ(S("---0-1-2-").pop_left('-', true), "---0"); + CHECK_EQ(S("---0-1-2-").pop_left('-' ), ""); + CHECK_EQ(S("---0-1-2-").pop_left('-', true), "---0"); + + CHECK_EQ(S("0" ).pop_left('-' ), "0"); + CHECK_EQ(S("0" ).pop_left('-', true), "0"); + CHECK_EQ(S("0-" ).pop_left('-' ), "0"); + CHECK_EQ(S("0-" ).pop_left('-', true), "0"); + CHECK_EQ(S("0---" ).pop_left('-' ), "0"); + CHECK_EQ(S("0---" ).pop_left('-', true), "0"); + + CHECK_EQ(S("-0" ).pop_left('-' ), ""); + CHECK_EQ(S("-0" ).pop_left('-', true), "-0"); + CHECK_EQ(S("-0-" ).pop_left('-' ), ""); + CHECK_EQ(S("-0-" ).pop_left('-', true), "-0"); + CHECK_EQ(S("-0---" ).pop_left('-' ), ""); + CHECK_EQ(S("-0---" ).pop_left('-', true), "-0"); + CHECK_EQ(S("---0---" ).pop_left('-' ), ""); + CHECK_EQ(S("---0---" ).pop_left('-', true), "---0"); + + CHECK_EQ(S("-" ).pop_left('-' ), ""); + CHECK_EQ(S("-" ).pop_left('-', true), ""); + CHECK_EQ(S("---" ).pop_left('-' ), ""); + CHECK_EQ(S("---" ).pop_left('-', true), ""); + + CHECK_EQ(S("" ).pop_left('-' ), ""); + CHECK_EQ(S("" ).pop_left('-', true), ""); +} + +TEST_CASE("substr.gpop_left") +{ + using S = csubstr; + + CHECK_EQ(S("0/1/2" ).gpop_left('/' ), "0/1"); + CHECK_EQ(S("0/1/2" ).gpop_left('/', true), "0/1"); + CHECK_EQ(S("0/1/2/" ).gpop_left('/' ), "0/1/2"); + CHECK_EQ(S("0/1/2/" ).gpop_left('/', true), "0/1"); + CHECK_EQ(S("0/1/2//" ).gpop_left('/' ), "0/1/2/"); + CHECK_EQ(S("0/1/2//" ).gpop_left('/', true), "0/1"); + CHECK_EQ(S("0/1/2///" ).gpop_left('/' ), "0/1/2//"); + CHECK_EQ(S("0/1/2///" ).gpop_left('/', true), "0/1"); + + CHECK_EQ(S("0/1//2" ).gpop_left('/' ), "0/1/"); + CHECK_EQ(S("0/1//2" ).gpop_left('/', true), "0/1"); + CHECK_EQ(S("0/1//2/" ).gpop_left('/' ), "0/1//2"); + CHECK_EQ(S("0/1//2/" ).gpop_left('/', true), "0/1"); + CHECK_EQ(S("0/1//2//" ).gpop_left('/' ), "0/1//2/"); + CHECK_EQ(S("0/1//2//" ).gpop_left('/', true), "0/1"); + CHECK_EQ(S("0/1//2///" ).gpop_left('/' ), "0/1//2//"); + CHECK_EQ(S("0/1//2///" ).gpop_left('/', true), "0/1"); + + CHECK_EQ(S("0/1///2" ).gpop_left('/' ), "0/1//"); + CHECK_EQ(S("0/1///2" ).gpop_left('/', true), "0/1"); + CHECK_EQ(S("0/1///2/" ).gpop_left('/' ), "0/1///2"); + CHECK_EQ(S("0/1///2/" ).gpop_left('/', true), "0/1"); + CHECK_EQ(S("0/1///2//" ).gpop_left('/' ), "0/1///2/"); + CHECK_EQ(S("0/1///2//" ).gpop_left('/', true), "0/1"); + CHECK_EQ(S("0/1///2///" ).gpop_left('/' ), "0/1///2//"); + CHECK_EQ(S("0/1///2///" ).gpop_left('/', true), "0/1"); + + CHECK_EQ(S("/0/1/2" ).gpop_left('/' ), "/0/1"); + CHECK_EQ(S("/0/1/2" ).gpop_left('/', true), "/0/1"); + CHECK_EQ(S("/0/1/2/" ).gpop_left('/' ), "/0/1/2"); + CHECK_EQ(S("/0/1/2/" ).gpop_left('/', true), "/0/1"); + CHECK_EQ(S("/0/1/2//" ).gpop_left('/' ), "/0/1/2/"); + CHECK_EQ(S("/0/1/2//" ).gpop_left('/', true), "/0/1"); + CHECK_EQ(S("/0/1/2///" ).gpop_left('/' ), "/0/1/2//"); + CHECK_EQ(S("/0/1/2///" ).gpop_left('/', true), "/0/1"); + + CHECK_EQ(S("//0/1/2" ).gpop_left('/' ), "//0/1"); + CHECK_EQ(S("//0/1/2" ).gpop_left('/', true), "//0/1"); + CHECK_EQ(S("//0/1/2/" ).gpop_left('/' ), "//0/1/2"); + CHECK_EQ(S("//0/1/2/" ).gpop_left('/', true), "//0/1"); + CHECK_EQ(S("//0/1/2//" ).gpop_left('/' ), "//0/1/2/"); + CHECK_EQ(S("//0/1/2//" ).gpop_left('/', true), "//0/1"); + CHECK_EQ(S("//0/1/2///" ).gpop_left('/' ), "//0/1/2//"); + CHECK_EQ(S("//0/1/2///" ).gpop_left('/', true), "//0/1"); + + CHECK_EQ(S("///0/1/2" ).gpop_left('/' ), "///0/1"); + CHECK_EQ(S("///0/1/2" ).gpop_left('/', true), "///0/1"); + CHECK_EQ(S("///0/1/2/" ).gpop_left('/' ), "///0/1/2"); + CHECK_EQ(S("///0/1/2/" ).gpop_left('/', true), "///0/1"); + CHECK_EQ(S("///0/1/2//" ).gpop_left('/' ), "///0/1/2/"); + CHECK_EQ(S("///0/1/2//" ).gpop_left('/', true), "///0/1"); + CHECK_EQ(S("///0/1/2///").gpop_left('/' ), "///0/1/2//"); + CHECK_EQ(S("///0/1/2///").gpop_left('/', true), "///0/1"); + + + CHECK_EQ(S("0/1" ).gpop_left('/' ), "0"); + CHECK_EQ(S("0/1" ).gpop_left('/', true), "0"); + CHECK_EQ(S("0/1/" ).gpop_left('/' ), "0/1"); + CHECK_EQ(S("0/1/" ).gpop_left('/', true), "0"); + CHECK_EQ(S("0/1//" ).gpop_left('/' ), "0/1/"); + CHECK_EQ(S("0/1//" ).gpop_left('/', true), "0"); + CHECK_EQ(S("0/1///" ).gpop_left('/' ), "0/1//"); + CHECK_EQ(S("0/1///" ).gpop_left('/', true), "0"); + + CHECK_EQ(S("0//1" ).gpop_left('/' ), "0/"); + CHECK_EQ(S("0//1" ).gpop_left('/', true), "0"); + CHECK_EQ(S("0//1/" ).gpop_left('/' ), "0//1"); + CHECK_EQ(S("0//1/" ).gpop_left('/', true), "0"); + CHECK_EQ(S("0//1//" ).gpop_left('/' ), "0//1/"); + CHECK_EQ(S("0//1//" ).gpop_left('/', true), "0"); + CHECK_EQ(S("0//1///" ).gpop_left('/' ), "0//1//"); + CHECK_EQ(S("0//1///" ).gpop_left('/', true), "0"); + + CHECK_EQ(S("0///1" ).gpop_left('/' ), "0//"); + CHECK_EQ(S("0///1" ).gpop_left('/', true), "0"); + CHECK_EQ(S("0///1/" ).gpop_left('/' ), "0///1"); + CHECK_EQ(S("0///1/" ).gpop_left('/', true), "0"); + CHECK_EQ(S("0///1//" ).gpop_left('/' ), "0///1/"); + CHECK_EQ(S("0///1//" ).gpop_left('/', true), "0"); + CHECK_EQ(S("0///1///" ).gpop_left('/' ), "0///1//"); + CHECK_EQ(S("0///1///" ).gpop_left('/', true), "0"); + + CHECK_EQ(S("/0/1" ).gpop_left('/' ), "/0"); + CHECK_EQ(S("/0/1" ).gpop_left('/', true), "/0"); + CHECK_EQ(S("/0/1/" ).gpop_left('/' ), "/0/1"); + CHECK_EQ(S("/0/1/" ).gpop_left('/', true), "/0"); + CHECK_EQ(S("/0/1//" ).gpop_left('/' ), "/0/1/"); + CHECK_EQ(S("/0/1//" ).gpop_left('/', true), "/0"); + CHECK_EQ(S("/0/1///" ).gpop_left('/' ), "/0/1//"); + CHECK_EQ(S("/0/1///" ).gpop_left('/', true), "/0"); + + CHECK_EQ(S("/0//1" ).gpop_left('/' ), "/0/"); + CHECK_EQ(S("/0//1" ).gpop_left('/', true), "/0"); + CHECK_EQ(S("/0//1/" ).gpop_left('/' ), "/0//1"); + CHECK_EQ(S("/0//1/" ).gpop_left('/', true), "/0"); + CHECK_EQ(S("/0//1//" ).gpop_left('/' ), "/0//1/"); + CHECK_EQ(S("/0//1//" ).gpop_left('/', true), "/0"); + CHECK_EQ(S("/0//1///" ).gpop_left('/' ), "/0//1//"); + CHECK_EQ(S("/0//1///" ).gpop_left('/', true), "/0"); + + CHECK_EQ(S("/0///1" ).gpop_left('/' ), "/0//"); + CHECK_EQ(S("/0///1" ).gpop_left('/', true), "/0"); + CHECK_EQ(S("/0///1/" ).gpop_left('/' ), "/0///1"); + CHECK_EQ(S("/0///1/" ).gpop_left('/', true), "/0"); + CHECK_EQ(S("/0///1//" ).gpop_left('/' ), "/0///1/"); + CHECK_EQ(S("/0///1//" ).gpop_left('/', true), "/0"); + CHECK_EQ(S("/0///1///" ).gpop_left('/' ), "/0///1//"); + CHECK_EQ(S("/0///1///" ).gpop_left('/', true), "/0"); + + CHECK_EQ(S("//0/1" ).gpop_left('/' ), "//0"); + CHECK_EQ(S("//0/1" ).gpop_left('/', true), "//0"); + CHECK_EQ(S("//0/1/" ).gpop_left('/' ), "//0/1"); + CHECK_EQ(S("//0/1/" ).gpop_left('/', true), "//0"); + CHECK_EQ(S("//0/1//" ).gpop_left('/' ), "//0/1/"); + CHECK_EQ(S("//0/1//" ).gpop_left('/', true), "//0"); + CHECK_EQ(S("//0/1///" ).gpop_left('/' ), "//0/1//"); + CHECK_EQ(S("//0/1///" ).gpop_left('/', true), "//0"); + + CHECK_EQ(S("//0//1" ).gpop_left('/' ), "//0/"); + CHECK_EQ(S("//0//1" ).gpop_left('/', true), "//0"); + CHECK_EQ(S("//0//1/" ).gpop_left('/' ), "//0//1"); + CHECK_EQ(S("//0//1/" ).gpop_left('/', true), "//0"); + CHECK_EQ(S("//0//1//" ).gpop_left('/' ), "//0//1/"); + CHECK_EQ(S("//0//1//" ).gpop_left('/', true), "//0"); + CHECK_EQ(S("//0//1///" ).gpop_left('/' ), "//0//1//"); + CHECK_EQ(S("//0//1///" ).gpop_left('/', true), "//0"); + + CHECK_EQ(S("//0///1" ).gpop_left('/' ), "//0//"); + CHECK_EQ(S("//0///1" ).gpop_left('/', true), "//0"); + CHECK_EQ(S("//0///1/" ).gpop_left('/' ), "//0///1"); + CHECK_EQ(S("//0///1/" ).gpop_left('/', true), "//0"); + CHECK_EQ(S("//0///1//" ).gpop_left('/' ), "//0///1/"); + CHECK_EQ(S("//0///1//" ).gpop_left('/', true), "//0"); + CHECK_EQ(S("//0///1///" ).gpop_left('/' ), "//0///1//"); + CHECK_EQ(S("//0///1///" ).gpop_left('/', true), "//0"); + + CHECK_EQ(S("0" ).gpop_left('/' ), ""); + CHECK_EQ(S("0" ).gpop_left('/', true), ""); + CHECK_EQ(S("0/" ).gpop_left('/' ), "0"); + CHECK_EQ(S("0/" ).gpop_left('/', true), ""); + CHECK_EQ(S("0//" ).gpop_left('/' ), "0/"); + CHECK_EQ(S("0//" ).gpop_left('/', true), ""); + CHECK_EQ(S("0///" ).gpop_left('/' ), "0//"); + CHECK_EQ(S("0///" ).gpop_left('/', true), ""); + + CHECK_EQ(S("/0" ).gpop_left('/' ), ""); + CHECK_EQ(S("/0" ).gpop_left('/', true), ""); + CHECK_EQ(S("/0/" ).gpop_left('/' ), "/0"); + CHECK_EQ(S("/0/" ).gpop_left('/', true), ""); + CHECK_EQ(S("/0//" ).gpop_left('/' ), "/0/"); + CHECK_EQ(S("/0//" ).gpop_left('/', true), ""); + CHECK_EQ(S("/0///" ).gpop_left('/' ), "/0//"); + CHECK_EQ(S("/0///" ).gpop_left('/', true), ""); + + CHECK_EQ(S("//0" ).gpop_left('/' ), "/"); + CHECK_EQ(S("//0" ).gpop_left('/', true), ""); + CHECK_EQ(S("//0/" ).gpop_left('/' ), "//0"); + CHECK_EQ(S("//0/" ).gpop_left('/', true), ""); + CHECK_EQ(S("//0//" ).gpop_left('/' ), "//0/"); + CHECK_EQ(S("//0//" ).gpop_left('/', true), ""); + CHECK_EQ(S("//0///" ).gpop_left('/' ), "//0//"); + CHECK_EQ(S("//0///" ).gpop_left('/', true), ""); + + CHECK_EQ(S("///0" ).gpop_left('/' ), "//"); + CHECK_EQ(S("///0" ).gpop_left('/', true), ""); + CHECK_EQ(S("///0/" ).gpop_left('/' ), "///0"); + CHECK_EQ(S("///0/" ).gpop_left('/', true), ""); + CHECK_EQ(S("///0//" ).gpop_left('/' ), "///0/"); + CHECK_EQ(S("///0//" ).gpop_left('/', true), ""); + CHECK_EQ(S("///0///" ).gpop_left('/' ), "///0//"); + CHECK_EQ(S("///0///" ).gpop_left('/', true), ""); + + CHECK_EQ(S("/" ).gpop_left('/' ), ""); + CHECK_EQ(S("/" ).gpop_left('/', true), ""); + CHECK_EQ(S("//" ).gpop_left('/' ), "/"); + CHECK_EQ(S("//" ).gpop_left('/', true), ""); + CHECK_EQ(S("///" ).gpop_left('/' ), "//"); + CHECK_EQ(S("///" ).gpop_left('/', true), ""); + + CHECK_EQ(S("" ).gpop_left('/' ), ""); + CHECK_EQ(S("" ).gpop_left('/', true), ""); +} + +TEST_CASE("substr.gpop_right") +{ + using S = csubstr; + + CHECK_EQ(S("0/1/2" ).gpop_right('/' ), "1/2"); + CHECK_EQ(S("0/1/2" ).gpop_right('/', true), "1/2"); + CHECK_EQ(S("0/1/2/" ).gpop_right('/' ), "1/2/"); + CHECK_EQ(S("0/1/2/" ).gpop_right('/', true), "1/2/"); + CHECK_EQ(S("0/1/2//" ).gpop_right('/' ), "1/2//"); + CHECK_EQ(S("0/1/2//" ).gpop_right('/', true), "1/2//"); + CHECK_EQ(S("0/1/2///" ).gpop_right('/' ), "1/2///"); + CHECK_EQ(S("0/1/2///" ).gpop_right('/', true), "1/2///"); + + CHECK_EQ(S("0//1/2" ).gpop_right('/' ), "/1/2"); + CHECK_EQ(S("0//1/2" ).gpop_right('/', true), "1/2"); + CHECK_EQ(S("0//1/2/" ).gpop_right('/' ), "/1/2/"); + CHECK_EQ(S("0//1/2/" ).gpop_right('/', true), "1/2/"); + CHECK_EQ(S("0//1/2//" ).gpop_right('/' ), "/1/2//"); + CHECK_EQ(S("0//1/2//" ).gpop_right('/', true), "1/2//"); + CHECK_EQ(S("0//1/2///" ).gpop_right('/' ), "/1/2///"); + CHECK_EQ(S("0//1/2///" ).gpop_right('/', true), "1/2///"); + + CHECK_EQ(S("0///1/2" ).gpop_right('/' ), "//1/2"); + CHECK_EQ(S("0///1/2" ).gpop_right('/', true), "1/2"); + CHECK_EQ(S("0///1/2/" ).gpop_right('/' ), "//1/2/"); + CHECK_EQ(S("0///1/2/" ).gpop_right('/', true), "1/2/"); + CHECK_EQ(S("0///1/2//" ).gpop_right('/' ), "//1/2//"); + CHECK_EQ(S("0///1/2//" ).gpop_right('/', true), "1/2//"); + CHECK_EQ(S("0///1/2///" ).gpop_right('/' ), "//1/2///"); + CHECK_EQ(S("0///1/2///" ).gpop_right('/', true), "1/2///"); + + + CHECK_EQ(S("/0/1/2" ).gpop_right('/' ), "0/1/2"); + CHECK_EQ(S("/0/1/2" ).gpop_right('/', true), "1/2"); + CHECK_EQ(S("/0/1/2/" ).gpop_right('/' ), "0/1/2/"); + CHECK_EQ(S("/0/1/2/" ).gpop_right('/', true), "1/2/"); + CHECK_EQ(S("/0/1/2//" ).gpop_right('/' ), "0/1/2//"); + CHECK_EQ(S("/0/1/2//" ).gpop_right('/', true), "1/2//"); + CHECK_EQ(S("/0/1/2///" ).gpop_right('/' ), "0/1/2///"); + CHECK_EQ(S("/0/1/2///" ).gpop_right('/', true), "1/2///"); + + CHECK_EQ(S("/0//1/2" ).gpop_right('/' ), "0//1/2"); + CHECK_EQ(S("/0//1/2" ).gpop_right('/', true), "1/2"); + CHECK_EQ(S("/0//1/2/" ).gpop_right('/' ), "0//1/2/"); + CHECK_EQ(S("/0//1/2/" ).gpop_right('/', true), "1/2/"); + CHECK_EQ(S("/0//1/2//" ).gpop_right('/' ), "0//1/2//"); + CHECK_EQ(S("/0//1/2//" ).gpop_right('/', true), "1/2//"); + CHECK_EQ(S("/0//1/2///" ).gpop_right('/' ), "0//1/2///"); + CHECK_EQ(S("/0//1/2///" ).gpop_right('/', true), "1/2///"); + + CHECK_EQ(S("/0///1/2" ).gpop_right('/' ), "0///1/2"); + CHECK_EQ(S("/0///1/2" ).gpop_right('/', true), "1/2"); + CHECK_EQ(S("/0///1/2/" ).gpop_right('/' ), "0///1/2/"); + CHECK_EQ(S("/0///1/2/" ).gpop_right('/', true), "1/2/"); + CHECK_EQ(S("/0///1/2//" ).gpop_right('/' ), "0///1/2//"); + CHECK_EQ(S("/0///1/2//" ).gpop_right('/', true), "1/2//"); + CHECK_EQ(S("/0///1/2///" ).gpop_right('/' ), "0///1/2///"); + CHECK_EQ(S("/0///1/2///" ).gpop_right('/', true), "1/2///"); + + + CHECK_EQ(S("//0/1/2" ).gpop_right('/' ), "/0/1/2"); + CHECK_EQ(S("//0/1/2" ).gpop_right('/', true), "1/2"); + CHECK_EQ(S("//0/1/2/" ).gpop_right('/' ), "/0/1/2/"); + CHECK_EQ(S("//0/1/2/" ).gpop_right('/', true), "1/2/"); + CHECK_EQ(S("//0/1/2//" ).gpop_right('/' ), "/0/1/2//"); + CHECK_EQ(S("//0/1/2//" ).gpop_right('/', true), "1/2//"); + CHECK_EQ(S("//0/1/2///" ).gpop_right('/' ), "/0/1/2///"); + CHECK_EQ(S("//0/1/2///" ).gpop_right('/', true), "1/2///"); + + CHECK_EQ(S("//0//1/2" ).gpop_right('/' ), "/0//1/2"); + CHECK_EQ(S("//0//1/2" ).gpop_right('/', true), "1/2"); + CHECK_EQ(S("//0//1/2/" ).gpop_right('/' ), "/0//1/2/"); + CHECK_EQ(S("//0//1/2/" ).gpop_right('/', true), "1/2/"); + CHECK_EQ(S("//0//1/2//" ).gpop_right('/' ), "/0//1/2//"); + CHECK_EQ(S("//0//1/2//" ).gpop_right('/', true), "1/2//"); + CHECK_EQ(S("//0//1/2///" ).gpop_right('/' ), "/0//1/2///"); + CHECK_EQ(S("//0//1/2///" ).gpop_right('/', true), "1/2///"); + + CHECK_EQ(S("//0///1/2" ).gpop_right('/' ), "/0///1/2"); + CHECK_EQ(S("//0///1/2" ).gpop_right('/', true), "1/2"); + CHECK_EQ(S("//0///1/2/" ).gpop_right('/' ), "/0///1/2/"); + CHECK_EQ(S("//0///1/2/" ).gpop_right('/', true), "1/2/"); + CHECK_EQ(S("//0///1/2//" ).gpop_right('/' ), "/0///1/2//"); + CHECK_EQ(S("//0///1/2//" ).gpop_right('/', true), "1/2//"); + CHECK_EQ(S("//0///1/2///" ).gpop_right('/' ), "/0///1/2///"); + CHECK_EQ(S("//0///1/2///" ).gpop_right('/', true), "1/2///"); + + + CHECK_EQ(S("0/1" ).gpop_right('/' ), "1"); + CHECK_EQ(S("0/1" ).gpop_right('/', true), "1"); + CHECK_EQ(S("0/1/" ).gpop_right('/' ), "1/"); + CHECK_EQ(S("0/1/" ).gpop_right('/', true), "1/"); + CHECK_EQ(S("0/1//" ).gpop_right('/' ), "1//"); + CHECK_EQ(S("0/1//" ).gpop_right('/', true), "1//"); + CHECK_EQ(S("0/1///" ).gpop_right('/' ), "1///"); + CHECK_EQ(S("0/1///" ).gpop_right('/', true), "1///"); + + CHECK_EQ(S("0//1" ).gpop_right('/' ), "/1"); + CHECK_EQ(S("0//1" ).gpop_right('/', true), "1"); + CHECK_EQ(S("0//1/" ).gpop_right('/' ), "/1/"); + CHECK_EQ(S("0//1/" ).gpop_right('/', true), "1/"); + CHECK_EQ(S("0//1//" ).gpop_right('/' ), "/1//"); + CHECK_EQ(S("0//1//" ).gpop_right('/', true), "1//"); + CHECK_EQ(S("0//1///" ).gpop_right('/' ), "/1///"); + CHECK_EQ(S("0//1///" ).gpop_right('/', true), "1///"); + + CHECK_EQ(S("0///1" ).gpop_right('/' ), "//1"); + CHECK_EQ(S("0///1" ).gpop_right('/', true), "1"); + CHECK_EQ(S("0///1/" ).gpop_right('/' ), "//1/"); + CHECK_EQ(S("0///1/" ).gpop_right('/', true), "1/"); + CHECK_EQ(S("0///1//" ).gpop_right('/' ), "//1//"); + CHECK_EQ(S("0///1//" ).gpop_right('/', true), "1//"); + CHECK_EQ(S("0///1///" ).gpop_right('/' ), "//1///"); + CHECK_EQ(S("0///1///" ).gpop_right('/', true), "1///"); + + + CHECK_EQ(S("/0/1" ).gpop_right('/' ), "0/1"); + CHECK_EQ(S("/0/1" ).gpop_right('/', true), "1"); + CHECK_EQ(S("/0/1/" ).gpop_right('/' ), "0/1/"); + CHECK_EQ(S("/0/1/" ).gpop_right('/', true), "1/"); + CHECK_EQ(S("/0/1//" ).gpop_right('/' ), "0/1//"); + CHECK_EQ(S("/0/1//" ).gpop_right('/', true), "1//"); + CHECK_EQ(S("/0/1///" ).gpop_right('/' ), "0/1///"); + CHECK_EQ(S("/0/1///" ).gpop_right('/', true), "1///"); + + CHECK_EQ(S("/0//1" ).gpop_right('/' ), "0//1"); + CHECK_EQ(S("/0//1" ).gpop_right('/', true), "1"); + CHECK_EQ(S("/0//1/" ).gpop_right('/' ), "0//1/"); + CHECK_EQ(S("/0//1/" ).gpop_right('/', true), "1/"); + CHECK_EQ(S("/0//1//" ).gpop_right('/' ), "0//1//"); + CHECK_EQ(S("/0//1//" ).gpop_right('/', true), "1//"); + CHECK_EQ(S("/0//1///" ).gpop_right('/' ), "0//1///"); + CHECK_EQ(S("/0//1///" ).gpop_right('/', true), "1///"); + + CHECK_EQ(S("/0///1" ).gpop_right('/' ), "0///1"); + CHECK_EQ(S("/0///1" ).gpop_right('/', true), "1"); + CHECK_EQ(S("/0///1/" ).gpop_right('/' ), "0///1/"); + CHECK_EQ(S("/0///1/" ).gpop_right('/', true), "1/"); + CHECK_EQ(S("/0///1//" ).gpop_right('/' ), "0///1//"); + CHECK_EQ(S("/0///1//" ).gpop_right('/', true), "1//"); + CHECK_EQ(S("/0///1///" ).gpop_right('/' ), "0///1///"); + CHECK_EQ(S("/0///1///" ).gpop_right('/', true), "1///"); + + + CHECK_EQ(S("//0/1" ).gpop_right('/' ), "/0/1"); + CHECK_EQ(S("//0/1" ).gpop_right('/', true), "1"); + CHECK_EQ(S("//0/1/" ).gpop_right('/' ), "/0/1/"); + CHECK_EQ(S("//0/1/" ).gpop_right('/', true), "1/"); + CHECK_EQ(S("//0/1//" ).gpop_right('/' ), "/0/1//"); + CHECK_EQ(S("//0/1//" ).gpop_right('/', true), "1//"); + CHECK_EQ(S("//0/1///" ).gpop_right('/' ), "/0/1///"); + CHECK_EQ(S("//0/1///" ).gpop_right('/', true), "1///"); + + CHECK_EQ(S("//0//1" ).gpop_right('/' ), "/0//1"); + CHECK_EQ(S("//0//1" ).gpop_right('/', true), "1"); + CHECK_EQ(S("//0//1/" ).gpop_right('/' ), "/0//1/"); + CHECK_EQ(S("//0//1/" ).gpop_right('/', true), "1/"); + CHECK_EQ(S("//0//1//" ).gpop_right('/' ), "/0//1//"); + CHECK_EQ(S("//0//1//" ).gpop_right('/', true), "1//"); + CHECK_EQ(S("//0//1///" ).gpop_right('/' ), "/0//1///"); + CHECK_EQ(S("//0//1///" ).gpop_right('/', true), "1///"); + + CHECK_EQ(S("//0///1" ).gpop_right('/' ), "/0///1"); + CHECK_EQ(S("//0///1" ).gpop_right('/', true), "1"); + CHECK_EQ(S("//0///1/" ).gpop_right('/' ), "/0///1/"); + CHECK_EQ(S("//0///1/" ).gpop_right('/', true), "1/"); + CHECK_EQ(S("//0///1//" ).gpop_right('/' ), "/0///1//"); + CHECK_EQ(S("//0///1//" ).gpop_right('/', true), "1//"); + CHECK_EQ(S("//0///1///" ).gpop_right('/' ), "/0///1///"); + CHECK_EQ(S("//0///1///" ).gpop_right('/', true), "1///"); + + + CHECK_EQ(S("0" ).gpop_right('/' ), ""); + CHECK_EQ(S("0" ).gpop_right('/', true), ""); + CHECK_EQ(S("0/" ).gpop_right('/' ), ""); + CHECK_EQ(S("0/" ).gpop_right('/', true), ""); + CHECK_EQ(S("0//" ).gpop_right('/' ), "/"); + CHECK_EQ(S("0//" ).gpop_right('/', true), ""); + CHECK_EQ(S("0///" ).gpop_right('/' ), "//"); + CHECK_EQ(S("0///" ).gpop_right('/', true), ""); + + CHECK_EQ(S("/0" ).gpop_right('/' ), "0"); + CHECK_EQ(S("/0" ).gpop_right('/', true), ""); + CHECK_EQ(S("/0/" ).gpop_right('/' ), "0/"); + CHECK_EQ(S("/0/" ).gpop_right('/', true), ""); + CHECK_EQ(S("/0//" ).gpop_right('/' ), "0//"); + CHECK_EQ(S("/0//" ).gpop_right('/', true), ""); + CHECK_EQ(S("/0///" ).gpop_right('/' ), "0///"); + CHECK_EQ(S("/0///" ).gpop_right('/', true), ""); + + CHECK_EQ(S("//0" ).gpop_right('/' ), "/0"); + CHECK_EQ(S("//0" ).gpop_right('/', true), ""); + CHECK_EQ(S("//0/" ).gpop_right('/' ), "/0/"); + CHECK_EQ(S("//0/" ).gpop_right('/', true), ""); + CHECK_EQ(S("//0//" ).gpop_right('/' ), "/0//"); + CHECK_EQ(S("//0//" ).gpop_right('/', true), ""); + CHECK_EQ(S("//0///" ).gpop_right('/' ), "/0///"); + CHECK_EQ(S("//0///" ).gpop_right('/', true), ""); + + CHECK_EQ(S("///0" ).gpop_right('/' ), "//0"); + CHECK_EQ(S("///0" ).gpop_right('/', true), ""); + CHECK_EQ(S("///0/" ).gpop_right('/' ), "//0/"); + CHECK_EQ(S("///0/" ).gpop_right('/', true), ""); + CHECK_EQ(S("///0//" ).gpop_right('/' ), "//0//"); + CHECK_EQ(S("///0//" ).gpop_right('/', true), ""); + CHECK_EQ(S("///0///" ).gpop_right('/' ), "//0///"); + CHECK_EQ(S("///0///" ).gpop_right('/', true), ""); + + CHECK_EQ(S("/" ).gpop_right('/' ), ""); + CHECK_EQ(S("/" ).gpop_right('/', true), ""); + CHECK_EQ(S("//" ).gpop_right('/' ), "/"); + CHECK_EQ(S("//" ).gpop_right('/', true), ""); + CHECK_EQ(S("///" ).gpop_right('/' ), "//"); + CHECK_EQ(S("///" ).gpop_right('/', true), ""); + + CHECK_EQ(S("" ).gpop_right('/' ), ""); + CHECK_EQ(S("" ).gpop_right('/', true), ""); +} + +TEST_CASE("substr.basename") +{ + using S = csubstr; + CHECK_EQ(S("0/1/2").basename(), "2"); + CHECK_EQ(S("0/1/2/").basename(), "2"); + CHECK_EQ(S("0/1/2///").basename(), "2"); + CHECK_EQ(S("/0/1/2").basename(), "2"); + CHECK_EQ(S("/0/1/2/").basename(), "2"); + CHECK_EQ(S("/0/1/2///").basename(), "2"); + CHECK_EQ(S("///0/1/2").basename(), "2"); + CHECK_EQ(S("///0/1/2/").basename(), "2"); + CHECK_EQ(S("///0/1/2///").basename(), "2"); + CHECK_EQ(S("/").basename(), ""); + CHECK_EQ(S("//").basename(), ""); + CHECK_EQ(S("///").basename(), ""); + CHECK_EQ(S("////").basename(), ""); + CHECK_EQ(S("").basename(), ""); +} + +TEST_CASE("substr.dirname") +{ + using S = csubstr; + CHECK_EQ(S("0/1/2").dirname(), "0/1/"); + CHECK_EQ(S("0/1/2/").dirname(), "0/1/"); + CHECK_EQ(S("/0/1/2").dirname(), "/0/1/"); + CHECK_EQ(S("/0/1/2/").dirname(), "/0/1/"); + CHECK_EQ(S("///0/1/2").dirname(), "///0/1/"); + CHECK_EQ(S("///0/1/2/").dirname(), "///0/1/"); + CHECK_EQ(S("/0").dirname(), "/"); + CHECK_EQ(S("/").dirname(), "/"); + CHECK_EQ(S("//").dirname(), "//"); + CHECK_EQ(S("///").dirname(), "///"); + CHECK_EQ(S("////").dirname(), "////"); + CHECK_EQ(S("").dirname(), ""); +} + +TEST_CASE("substr.extshort") +{ + using S = csubstr; + CHECK_EQ(S("filename.with.ext").extshort(), "ext"); + CHECK_EQ(S("filename.with.ext.").extshort(), ""); + CHECK_EQ(S(".a.b").extshort(), "b"); + CHECK_EQ(S(".a.b.").extshort(), ""); + CHECK_EQ(S(".b..").extshort(), ""); + CHECK_EQ(S("..b.").extshort(), ""); +} + +TEST_CASE("substr.extlong") +{ + using S = csubstr; + CHECK_EQ(S("filename.with.ext").extlong(), "with.ext"); + CHECK_EQ(S("filename.with.ext.").extlong(), "with.ext."); + CHECK_EQ(S(".a.b").extlong(), "a.b"); + CHECK_EQ(S(".a.b.").extlong(), "a.b."); + CHECK_EQ(S(".b..").extlong(), "b.."); + CHECK_EQ(S("..b.").extlong(), ".b."); +} + +TEST_CASE("substr.next_split") +{ + using S = csubstr; + + { + S const n; + typename S::size_type pos = 0; + S ss; + CHECK_EQ(n.next_split(':', &pos, &ss), false); + CHECK_EQ(ss.empty(), true); + CHECK_EQ(n.next_split(':', &pos, &ss), false); + CHECK_EQ(ss.empty(), true); + pos = 0; + CHECK_EQ(n.next_split(',', &pos, &ss), false); + CHECK_EQ(ss.empty(), true); + CHECK_EQ(n.next_split(',', &pos, &ss), false); + CHECK_EQ(ss.empty(), true); + } + + { + S const n("0"); + typename S::size_type pos = 0; + S ss; + CHECK_EQ(n.next_split(':', &pos, &ss), true); + CHECK_EQ(ss.empty(), false); + CHECK_EQ(n.next_split(':', &pos, &ss), false); + CHECK_EQ(ss.empty(), true); + CHECK_EQ(n.next_split(':', &pos, &ss), false); + CHECK_EQ(ss.empty(), true); + pos = 0; + CHECK_EQ(n.next_split(',', &pos, &ss), true); + CHECK_EQ(ss.empty(), false); + CHECK_EQ(n.next_split(',', &pos, &ss), false); + CHECK_EQ(ss.empty(), true); + CHECK_EQ(n.next_split(',', &pos, &ss), false); + CHECK_EQ(ss.empty(), true); + } + + { + S const n; + typename S::size_type pos = 0; + typename S::size_type count = 0; + S ss; + while(n.next_split(':', &pos, &ss)) + { + ++count; + } + CHECK_EQ(count, 0); + } + + { + S const n("0123456"); + typename S::size_type pos = 0; + typename S::size_type count = 0; + S ss; + while(n.next_split(':', &pos, &ss)) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), n.size()); + CHECK_EQ(ss.empty(), false); + break; + default: + CHECK_UNARY(false);//GTEST_FAIL(); + break; + } + ++count; + } + CHECK_EQ(count, 1); + } + + { + S const n("0123456:"); + typename S::size_type pos = 0; + typename S::size_type count = 0; + S ss; + while(n.next_split(':', &pos, &ss)) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), n.size()-1); + CHECK_EQ(ss.empty(), false); + break; + case 1: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + default: + CHECK_UNARY(false);//GTEST_FAIL(); + break; + } + ++count; + } + CHECK_EQ(count, 2); + } + + { + S const n(":0123456:"); + typename S::size_type pos = 0; + typename S::size_type count = 0; + S ss; + while(n.next_split(':', &pos, &ss)) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + case 1: + CHECK_EQ(ss.size(), n.size()-2); + CHECK_EQ(ss.empty(), false); + break; + case 2: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + default: + CHECK_UNARY(false);//GTEST_FAIL(); + break; + } + ++count; + } + CHECK_EQ(count, 3); + } + + { + S const n(":"); + typename S::size_type pos = 0; + typename S::size_type count = 0; + S ss; + while(n.next_split(':', &pos, &ss)) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + case 1: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + default: + CHECK_UNARY(false);//GTEST_FAIL(); + break; + } + ++count; + } + CHECK_EQ(count, 2); + } + + { + S const n("01:23:45:67"); + typename S::size_type pos = 0; + typename S::size_type count = 0; + S ss; + while(n.next_split(':', &pos, &ss)) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "01"); + CHECK_NE(ss, "01:"); + CHECK_NE(ss, ":01:"); + CHECK_NE(ss, ":01"); + break; + case 1: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "23"); + CHECK_NE(ss, "23:"); + CHECK_NE(ss, ":23:"); + CHECK_NE(ss, ":23"); + break; + case 2: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "45"); + CHECK_NE(ss, "45:"); + CHECK_NE(ss, ":45:"); + CHECK_NE(ss, ":45"); + break; + case 3: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "67"); + CHECK_NE(ss, "67:"); + CHECK_NE(ss, ":67:"); + CHECK_NE(ss, ":67"); + break; + default: + CHECK_UNARY(false);//GTEST_FAIL(); + break; + } + count++; + } + CHECK_EQ(count, 4); + } + + { + const S n(":01:23:45:67:"); + typename S::size_type pos = 0; + typename S::size_type count = 0; + S ss; + while(n.next_split(':', &pos, &ss)) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + case 1: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "01"); + CHECK_NE(ss, "01:"); + CHECK_NE(ss, ":01:"); + CHECK_NE(ss, ":01"); + break; + case 2: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "23"); + CHECK_NE(ss, "23:"); + CHECK_NE(ss, ":23:"); + CHECK_NE(ss, ":23"); + break; + case 3: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "45"); + CHECK_NE(ss, "45:"); + CHECK_NE(ss, ":45:"); + CHECK_NE(ss, ":45"); + break; + case 4: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "67"); + CHECK_NE(ss, "67:"); + CHECK_NE(ss, ":67:"); + CHECK_NE(ss, ":67"); + break; + case 5: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + default: + CHECK_UNARY(false);//GTEST_FAIL(); + break; + } + count++; + } + CHECK_EQ(count, 6); + } + + { + const S n("::::01:23:45:67::::"); + typename S::size_type pos = 0; + typename S::size_type count = 0; + S ss; + while(n.next_split(':', &pos, &ss)) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 1: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 2: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 3: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 4: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "01"); + CHECK_NE(ss, "01:"); + CHECK_NE(ss, ":01:"); + CHECK_NE(ss, ":01"); + break; + case 5: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "23"); + CHECK_NE(ss, "23:"); + CHECK_NE(ss, ":23:"); + CHECK_NE(ss, ":23"); + break; + case 6: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "45"); + CHECK_NE(ss, "45:"); + CHECK_NE(ss, ":45:"); + CHECK_NE(ss, ":45"); + break; + case 7: + CHECK_EQ(ss.size(), 2); + CHECK_EQ(ss, "67"); + CHECK_NE(ss, "67:"); + CHECK_NE(ss, ":67:"); + CHECK_NE(ss, ":67"); + break; + case 8: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 9: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 10: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 11: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + default: + CHECK_UNARY(false);//GTEST_FAIL(); + break; + } + count++; + } + CHECK_EQ(count, 12); + } +} + +TEST_CASE("substr.split") +{ + using S = csubstr; + + { + S const n; + { + auto spl = n.split(':'); + auto beg = spl.begin(); + auto end = spl.end(); + CHECK_UNARY(beg == end); + } + } + + { + S const n("foo:bar:baz"); + auto spl = n.split(':'); + auto beg = spl.begin(); + auto end = spl.end(); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(end->size(), 0); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + auto it = beg; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "foo"); + CHECK_UNARY(it != end); + CHECK_UNARY(it == beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + ++it; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "bar"); + CHECK_UNARY(it != end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + ++it; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "baz"); + CHECK_UNARY(it != end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + ++it; + CHECK_EQ(it->size(), 0); + CHECK_UNARY(it == end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + it = beg; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "foo"); + CHECK_UNARY(it != end); + CHECK_UNARY(it == beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + it++; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "bar"); + CHECK_UNARY(it != end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + it++; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "baz"); + CHECK_UNARY(it != end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + it++; + CHECK_EQ(it->size(), 0); + CHECK_UNARY(it == end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + } + + { + S const n("foo:bar:baz:"); + auto spl = n.split(':'); + auto beg = spl.begin(); + auto end = spl.end(); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(end->size(), 0); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + auto it = beg; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "foo"); + CHECK_UNARY(it != end); + CHECK_UNARY(it == beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + ++it; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "bar"); + CHECK_UNARY(it != end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + ++it; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "baz"); + CHECK_UNARY(it != end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + ++it; + CHECK_EQ(it->size(), 0); + CHECK_EQ(*it, ""); + CHECK_UNARY(it != end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + ++it; + CHECK_EQ(it->size(), 0); + CHECK_UNARY(it == end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + //-------------------------- + it = beg; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "foo"); + CHECK_UNARY(it != end); + CHECK_UNARY(it == beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + it++; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "bar"); + CHECK_UNARY(it != end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + it++; + CHECK_EQ(it->size(), 3); + CHECK_EQ(*it, "baz"); + CHECK_UNARY(it != end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + it++; + CHECK_EQ(it->size(), 0); + CHECK_EQ(*it, ""); + CHECK_UNARY(it != end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + it++; + CHECK_EQ(it->size(), 0); + CHECK_UNARY(it == end); + CHECK_UNARY(it != beg); + CHECK_EQ(beg->size(), 3); + CHECK_EQ(*beg, "foo"); + CHECK_UNARY(beg != end); + } + + { + S const n; + auto s = n.split(':'); + // check that multiple calls to begin() always yield the same result + CHECK_EQ(*s.begin(), ""); + CHECK_EQ(*s.begin(), ""); + CHECK_EQ(*s.begin(), ""); + // check that multiple calls to end() always yield the same result + auto e = s.end(); + CHECK_UNARY(s.end() == e); + CHECK_UNARY(s.end() == e); + // + auto it = s.begin(); + CHECK_EQ(*it, ""); + CHECK_EQ(it->empty(), true); + CHECK_EQ(it->size(), 0); + ++it; + CHECK_UNARY(it == e); + } + + { + S const n("01:23:45:67"); + auto s = n.split(':'); + // check that multiple calls to begin() always yield the same result + CHECK_EQ(*s.begin(), "01"); + CHECK_EQ(*s.begin(), "01"); + CHECK_EQ(*s.begin(), "01"); + // check that multiple calls to end() always yield the same result + auto e = s.end(); + CHECK_UNARY(s.end() == e); + CHECK_UNARY(s.end() == e); + CHECK_UNARY(s.end() == e); + // + auto it = s.begin(); + CHECK_EQ(*it, "01"); + CHECK_EQ(it->size(), 2); + ++it; + CHECK_EQ(*it, "23"); + CHECK_EQ(it->size(), 2); + ++it; + CHECK_EQ(*it, "45"); + CHECK_EQ(it->size(), 2); + ++it; + CHECK_EQ(*it, "67"); + CHECK_EQ(it->size(), 2); + ++it; + CHECK_UNARY(it == s.end()); + } + + { + S const n; + typename S::size_type count = 0; + for(auto &ss : n.split(':')) + { + ++count; + } + CHECK_EQ(count, 0); + } + + { + S const n("0123456"); + { + auto spl = n.split(':'); + auto beg = spl.begin(); + auto end = spl.end(); + CHECK_EQ(beg->size(), n.size()); + CHECK_EQ(end->size(), 0); + } + typename S::size_type count = 0; + for(auto &ss : n.split(':')) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), n.size()); + CHECK_EQ(ss.empty(), false); + break; + } + ++count; + } + CHECK_EQ(count, 1); + } + + { + S const n("foo:bar"); + typename S::size_type count = 0; + for(auto &ss : n.split(':')) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), 3); + CHECK_EQ(ss.empty(), false); + CHECK_EQ(ss, "foo"); + break; + case 1: + CHECK_EQ(ss.size(), 3); + CHECK_EQ(ss.empty(), false); + CHECK_EQ(ss, "bar"); + break; + } + ++count; + } + CHECK_EQ(count, 2); + } + + { + S const n("0123456:"); + typename S::size_type count = 0; + for(auto &ss : n.split(':')) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), n.size()-1); + CHECK_EQ(ss.empty(), false); + break; + case 1: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + } + ++count; + } + CHECK_EQ(count, 2); + } + + { + S const n(":0123456:"); + typename S::size_type count = 0; + for(auto &ss : n.split(':')) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + case 1: + CHECK_EQ(ss.size(), n.size()-2); + CHECK_EQ(ss.empty(), false); + break; + case 2: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + } + ++count; + } + CHECK_EQ(count, 3); + } + + { + S const n(":"); + typename S::size_type count = 0; + for(auto &ss : n.split(':')) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + case 1: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + } + ++count; + } + CHECK_EQ(count, 2); + } + + { + S const n("01:23:45:67"); + typename S::size_type count = 0; + for(auto &ss : n.split(':')) + { + switch(count) + { + case 0: + CHECK_EQ(ss, "01"); + CHECK_NE(ss, "01:"); + CHECK_NE(ss, ":01:"); + CHECK_NE(ss, ":01"); + break; + case 1: + CHECK_EQ(ss, "23"); + CHECK_NE(ss, "23:"); + CHECK_NE(ss, ":23:"); + CHECK_NE(ss, ":23"); + break; + case 2: + CHECK_EQ(ss, "45"); + CHECK_NE(ss, "45:"); + CHECK_NE(ss, ":45:"); + CHECK_NE(ss, ":45"); + break; + case 3: + CHECK_EQ(ss, "67"); + CHECK_NE(ss, "67:"); + CHECK_NE(ss, ":67:"); + CHECK_NE(ss, ":67"); + break; + } + count++; + } + CHECK_EQ(count, 4); + } + + { + const S n(":01:23:45:67:"); + typename S::size_type count = 0; + for(auto &ss : n.split(':')) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + case 1: + CHECK_EQ(ss, "01"); + CHECK_NE(ss, "01:"); + CHECK_NE(ss, ":01:"); + CHECK_NE(ss, ":01"); + break; + case 2: + CHECK_EQ(ss, "23"); + CHECK_NE(ss, "23:"); + CHECK_NE(ss, ":23:"); + CHECK_NE(ss, ":23"); + break; + case 3: + CHECK_EQ(ss, "45"); + CHECK_NE(ss, "45:"); + CHECK_NE(ss, ":45:"); + CHECK_NE(ss, ":45"); + break; + case 4: + CHECK_EQ(ss, "67"); + CHECK_NE(ss, "67:"); + CHECK_NE(ss, ":67:"); + CHECK_NE(ss, ":67"); + break; + case 5: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + break; + } + count++; + } + CHECK_EQ(count, 6); + } + + { + const S n("::::01:23:45:67::::"); + typename S::size_type count = 0; + for(auto &ss : n.split(':')) + { + switch(count) + { + case 0: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 1: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 2: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 3: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 4: + CHECK_EQ(ss, "01"); + CHECK_NE(ss, "01:"); + CHECK_NE(ss, ":01:"); + CHECK_NE(ss, ":01"); + break; + case 5: + CHECK_EQ(ss, "23"); + CHECK_NE(ss, "23:"); + CHECK_NE(ss, ":23:"); + CHECK_NE(ss, ":23"); + break; + case 6: + CHECK_EQ(ss, "45"); + CHECK_NE(ss, "45:"); + CHECK_NE(ss, ":45:"); + CHECK_NE(ss, ":45"); + break; + case 7: + CHECK_EQ(ss, "67"); + CHECK_NE(ss, "67:"); + CHECK_NE(ss, ":67:"); + CHECK_NE(ss, ":67"); + break; + case 8: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 9: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 10: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + case 11: + CHECK_EQ(ss.size(), 0); + CHECK_EQ(ss.empty(), true); + CHECK_NE(ss, "::"); + break; + } + count++; + } + CHECK_EQ(count, 12); + } +} + + +//----------------------------------------------------------------------------- +TEST_CASE("substr.copy_from") +{ + char buf[128] = {0}; + substr s = buf; + CHECK_EQ(s.size(), sizeof(buf)-1); + CHECK_NE(s.first(3), "123"); + s.copy_from("123"); + CHECK_EQ(s.first(3), "123"); + CHECK_EQ(s.first(6), "123\0\0\0"); + s.copy_from("+++", 3); + CHECK_EQ(s.first(6), "123+++"); + CHECK_EQ(s.first(9), "123+++\0\0\0"); + s.copy_from("456", 6); + CHECK_EQ(s.first(9), "123+++456"); + CHECK_EQ(s.first(12), "123+++456\0\0\0"); + s.copy_from("***", 3); + CHECK_EQ(s.first(9), "123***456"); + CHECK_EQ(s.first(12), "123***456\0\0\0"); + + // make sure that it's safe to pass source strings that don't fit + // in the remaining destination space + substr ss = s.first(9); + ss.copy_from("987654321", 9); // should be a no-op + CHECK_EQ(s.first(12), "123***456\0\0\0"); + ss.copy_from("987654321", 6); + CHECK_EQ(s.first(12), "123***987\0\0\0"); + ss.copy_from("987654321", 3); + CHECK_EQ(s.first(12), "123987654\0\0\0"); + ss.first(3).copy_from("987654321"); + CHECK_EQ(s.first(12), "987987654\0\0\0"); +} + + +//----------------------------------------------------------------------------- +void do_test_reverse(substr s, csubstr orig, csubstr expected) +{ + CHECK_EQ(s, orig); + s.reverse(); + CHECK_EQ(s, expected); + s.reverse(); + CHECK_EQ(s, orig); + // + CHECK_EQ(s, orig); + s.reverse_sub(0, s.len); + CHECK_EQ(s, expected); + s.reverse_sub(0, s.len); + CHECK_EQ(s, orig); + // + CHECK_EQ(s, orig); + s.reverse_range(0, s.len); + CHECK_EQ(s, expected); + s.reverse_range(0, s.len); + CHECK_EQ(s, orig); +} + +TEST_CASE("substr.reverse") +{ + char buf[] = "0123456789"; + do_test_reverse(buf, "0123456789", "9876543210"); + do_test_reverse(buf, "0123456789", "9876543210"); + + // in the middle + substr s = buf; + s.sub(2, 2).reverse(); + CHECK_EQ(s, "0132456789"); + s.sub(2, 2).reverse(); + CHECK_EQ(s, "0123456789"); + + s.sub(4, 2).reverse(); + CHECK_EQ(s, "0123546789"); + s.sub(4, 2).reverse(); + CHECK_EQ(s, "0123456789"); + + // at the beginning + s.first(3).reverse(); + CHECK_EQ(s, "2103456789"); + s.first(3).reverse(); + CHECK_EQ(s, "0123456789"); + + // at the end + s.last(3).reverse(); + CHECK_EQ(s, "0123456987"); + s.last(3).reverse(); + CHECK_EQ(s, "0123456789"); +} + + +TEST_CASE("substr.reverse_sub") +{ + char buf[] = "0123456789"; + substr s = buf; + + s.reverse_sub(0, s.len); + CHECK_EQ(s, "9876543210"); + s.reverse_sub(0, s.len); + CHECK_EQ(s, "0123456789"); + + s.reverse_sub(0, 0); + CHECK_EQ(s, "0123456789"); + s.reverse_sub(s.len, 0); + CHECK_EQ(s, "0123456789"); + + s.reverse_sub(1, 3); + CHECK_EQ(s, "0321456789"); + s.reverse_sub(1, 3); + CHECK_EQ(s, "0123456789"); +} + +TEST_CASE("substr.reverse_range") +{ + char buf[] = "0123456789"; + substr s = buf; + + s.reverse_range(0, s.len); + CHECK_EQ(s, "9876543210"); + s.reverse_range(0, s.len); + CHECK_EQ(s, "0123456789"); + + s.reverse_range(0, 0); + CHECK_EQ(s, "0123456789"); + s.reverse_range(s.len, s.len); + CHECK_EQ(s, "0123456789"); + + s.reverse_range(1, 3); + CHECK_EQ(s, "0213456789"); + s.reverse_range(1, 3); + CHECK_EQ(s, "0123456789"); +} + + +//----------------------------------------------------------------------------- +TEST_CASE("substr.erase") +{ + char buf[] = "0123456789"; + + substr s = buf; + CHECK_EQ(s.len, s.size()); + CHECK_EQ(s.len, 10); + CHECK_EQ(s, "0123456789"); + + substr ss = s.first(6); + CHECK_EQ(ss.len, 6); + for(size_t i = 0; i <= ss.len; ++i) + { + ss.erase(i, 0); // must be a no-op + CHECK_EQ(s, "0123456789"); + ss.erase_range(i, i); // must be a no-op + CHECK_EQ(s, "0123456789"); + ss.erase(ss.len-i, i); // must be a no-op + CHECK_EQ(s, "0123456789"); + } + + substr r; + ss = ss.erase(0, 1); + CHECK_EQ(ss.len, 5); + CHECK_EQ(ss, "12345"); + CHECK_EQ(s, "1234556789"); + ss = ss.erase(0, 2); + CHECK_EQ(ss.len, 3); + CHECK_EQ(ss, "345"); + CHECK_EQ(s, "3454556789"); + + csubstr s55 = s.sub(4, 2); + ss = s.erase(s55); + CHECK_EQ(s, "3454678989"); +} + + +//----------------------------------------------------------------------------- +TEST_CASE("substr.replace") +{ + char buf[] = "0.1.2.3.4.5.6.7.8.9"; + + substr s = buf; + + auto ret = s.replace('+', '.'); + CHECK_EQ(ret, 0); + + ret = s.replace('.', '.', s.len); + CHECK_EQ(s, "0.1.2.3.4.5.6.7.8.9"); + CHECK_EQ(ret, 0); + ret = s.replace('.', '.'); + CHECK_EQ(ret, 9); + CHECK_EQ(s, "0.1.2.3.4.5.6.7.8.9"); + + ret = s.replace('.', '+', s.len); + CHECK_EQ(s, "0.1.2.3.4.5.6.7.8.9"); + CHECK_EQ(ret, 0); + ret = s.replace('.', '+'); + CHECK_EQ(ret, 9); + CHECK_EQ(s, "0+1+2+3+4+5+6+7+8+9"); + + ret = s.replace("16", '.', s.len); + CHECK_EQ(s, "0+1+2+3+4+5+6+7+8+9"); + CHECK_EQ(ret, 0); + ret = s.replace("16", '.'); + CHECK_EQ(ret, 2); + CHECK_EQ(s, "0+.+2+3+4+5+.+7+8+9"); + ret = s.replace("3+2", '_'); + CHECK_EQ(ret, 11); + CHECK_EQ(s, "0_._____4_5_._7_8_9"); + + // must accept empty string + ret = s.sub(0, 0).replace('0', '1'); + CHECK_EQ(ret, 0); + CHECK_EQ(s, "0_._____4_5_._7_8_9"); + ret = s.sub(0, 0).replace("0", '1'); + CHECK_EQ(ret, 0); + CHECK_EQ(s, "0_._____4_5_._7_8_9"); +} + +TEST_CASE("substr.replace_all") +{ + char buf[] = "0.1.2.3.4.5.6.7.8.9"; + std::string tmp, out("0+1+2+3+4+5+6+7+8+9"); + + // must accept empty string + substr(buf).sub(0, 0).replace_all(to_substr(tmp), "0", "X"); + CHECK_EQ(csubstr(buf), "0.1.2.3.4.5.6.7.8.9"); + + substr r; + auto replall = [&](csubstr pattern, csubstr repl) -> substr { + tmp = out; + csubstr rtmp = to_csubstr(tmp); + out.resize(128); + substr dst = to_substr(out); + size_t sz = rtmp.replace_all(dst, pattern, repl); + CHECK_LE(sz, out.size()); + out.resize(sz); + return dst.first(sz); + }; + r = replall("0+1", "0+++++1"); + // the result must be a view of out + CHECK_FALSE(r.empty()); + CHECK_FALSE(out.empty()); + CHECK_EQ(r.size(), out.size()); + CHECK_EQ(r.front(), out.front()); + CHECK_EQ(r.back(), out.back()); + CHECK_EQ(r, "0+++++1+2+3+4+5+6+7+8+9"); + + r = replall("+", ""); + CHECK_EQ(r, "0123456789"); + + r = replall("+", ""); + CHECK_EQ(r, "0123456789"); // must not change + + r = replall("0123456789", "9876543210"); + CHECK_EQ(r, "9876543210"); + + r = replall("987", "."); + CHECK_EQ(r, ".6543210"); + + r = replall("210", "."); + CHECK_EQ(r, ".6543."); + + r = replall("6543", ":"); + CHECK_EQ(r, ".:."); + + r = replall(".:.", ""); + CHECK_EQ(r, ""); +} + +TEST_CASE("substr.short_integer") +{ + char buf[] = "-"; + CHECK_FALSE(substr(buf).is_integer()); + CHECK_FALSE(csubstr("-").is_integer()); + CHECK_FALSE(csubstr("+").is_integer()); +} + +} // namespace c4 + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_szconv.cpp b/thirdparty/ryml/ext/c4core/test/test_szconv.cpp new file mode 100644 index 000000000..d54bf48a0 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_szconv.cpp @@ -0,0 +1,166 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/szconv.hpp" +#endif + +#include "c4/libtest/supprwarn_push.hpp" +#include "c4/test.hpp" + +#define C4_EXPECT_NARROWER(yes_or_no, ty_out, ty_in) \ + CHECK_UNARY(( yes_or_no (is_narrower_size<ty_out C4_COMMA ty_in>::value))); + +namespace c4 { + +TEST_CASE("is_narrower_size.signed_types") +{ + C4_EXPECT_NARROWER( ! , int8_t , int8_t ); + C4_EXPECT_NARROWER( , int8_t , int16_t); + C4_EXPECT_NARROWER( , int8_t , int32_t); + C4_EXPECT_NARROWER( , int8_t , int64_t); + C4_EXPECT_NARROWER( , int8_t , uint8_t ); + C4_EXPECT_NARROWER( , int8_t , uint16_t); + C4_EXPECT_NARROWER( , int8_t , uint32_t); + C4_EXPECT_NARROWER( , int8_t , uint64_t); + C4_EXPECT_NARROWER( ! , int16_t , int8_t ); + C4_EXPECT_NARROWER( ! , int16_t , int16_t); + C4_EXPECT_NARROWER( , int16_t , int32_t); + C4_EXPECT_NARROWER( , int16_t , int64_t); + C4_EXPECT_NARROWER( ! , int16_t , uint8_t ); + C4_EXPECT_NARROWER( , int16_t , uint16_t); + C4_EXPECT_NARROWER( , int16_t , uint32_t); + C4_EXPECT_NARROWER( , int16_t , uint64_t); + C4_EXPECT_NARROWER( ! , int32_t , int8_t ); + C4_EXPECT_NARROWER( ! , int32_t , int16_t); + C4_EXPECT_NARROWER( ! , int32_t , int32_t); + C4_EXPECT_NARROWER( , int32_t , int64_t); + C4_EXPECT_NARROWER( ! , int32_t , uint8_t ); + C4_EXPECT_NARROWER( ! , int32_t , uint16_t); + C4_EXPECT_NARROWER( , int32_t , uint32_t); + C4_EXPECT_NARROWER( , int32_t , uint64_t); + C4_EXPECT_NARROWER( ! , int64_t , int8_t ); + C4_EXPECT_NARROWER( ! , int64_t , int16_t); + C4_EXPECT_NARROWER( ! , int64_t , int32_t); + C4_EXPECT_NARROWER( ! , int64_t , int64_t); + C4_EXPECT_NARROWER( ! , int64_t , uint8_t ); + C4_EXPECT_NARROWER( ! , int64_t , uint16_t); + C4_EXPECT_NARROWER( ! , int64_t , uint32_t); + C4_EXPECT_NARROWER( , int64_t , uint64_t); +} + +TEST_CASE("is_narrower_size.unsigned_types") +{ + C4_EXPECT_NARROWER( ! , uint8_t , int8_t ); + C4_EXPECT_NARROWER( , uint8_t , int16_t); + C4_EXPECT_NARROWER( , uint8_t , int32_t); + C4_EXPECT_NARROWER( , uint8_t , int64_t); + C4_EXPECT_NARROWER( ! , uint8_t , uint8_t ); + C4_EXPECT_NARROWER( , uint8_t , uint16_t); + C4_EXPECT_NARROWER( , uint8_t , uint32_t); + C4_EXPECT_NARROWER( , uint8_t , uint64_t); + C4_EXPECT_NARROWER( ! , uint16_t , int8_t ); + C4_EXPECT_NARROWER( ! , uint16_t , int16_t); + C4_EXPECT_NARROWER( , uint16_t , int32_t); + C4_EXPECT_NARROWER( , uint16_t , int64_t); + C4_EXPECT_NARROWER( ! , uint16_t , uint8_t ); + C4_EXPECT_NARROWER( ! , uint16_t , uint16_t); + C4_EXPECT_NARROWER( , uint16_t , uint32_t); + C4_EXPECT_NARROWER( , uint16_t , uint64_t); + C4_EXPECT_NARROWER( ! , uint32_t , int8_t ); + C4_EXPECT_NARROWER( ! , uint32_t , int16_t); + C4_EXPECT_NARROWER( ! , uint32_t , int32_t); + C4_EXPECT_NARROWER( , uint32_t , int64_t); + C4_EXPECT_NARROWER( ! , uint32_t , uint8_t ); + C4_EXPECT_NARROWER( ! , uint32_t , uint16_t); + C4_EXPECT_NARROWER( ! , uint32_t , uint32_t); + C4_EXPECT_NARROWER( , uint32_t , uint64_t); + C4_EXPECT_NARROWER( ! , uint64_t , int8_t ); + C4_EXPECT_NARROWER( ! , uint64_t , int16_t); + C4_EXPECT_NARROWER( ! , uint64_t , int32_t); + C4_EXPECT_NARROWER( ! , uint64_t , int64_t); + C4_EXPECT_NARROWER( ! , uint64_t , uint8_t ); + C4_EXPECT_NARROWER( ! , uint64_t , uint16_t); + C4_EXPECT_NARROWER( ! , uint64_t , uint32_t); + C4_EXPECT_NARROWER( ! , uint64_t , uint64_t); +} + +template<typename I, typename O> +typename std::enable_if<std::is_same<I, O>::value, void>::type +test_szconv() +{ + // nothing to do here +} + +template<typename I, typename O> +typename std::enable_if< ! std::is_same<I, O>::value, void>::type +test_szconv() +{ + C4_STATIC_ASSERT(std::is_integral<I>::value); + C4_STATIC_ASSERT(std::is_integral<O>::value); + + const I imax = std::numeric_limits<I>::max(); + const I imin = std::numeric_limits<I>::min(); + const O omax = std::numeric_limits<O>::max(); + const O omin = std::numeric_limits<O>::min(); + + CHECK_EQ(szconv<O>(I(0)), O(0)); + CHECK_EQ(szconv<I>(I(0)), I(0)); + +#if C4_USE_XASSERT + if((uint64_t)omax < (uint64_t)imax) + { + C4_EXPECT_ERROR_OCCURS(); + O out = szconv<O>(imax); + } + else if((uint64_t)omax > (uint64_t)imax) + { + C4_EXPECT_ERROR_OCCURS(); + I out = szconv<I>(omax); + } +#endif +} + +#define DO_TEST_SZCONV(ty) \ + TEST_CASE("szconv." #ty "_to_int8") \ + { \ + test_szconv<ty##_t, int8_t>(); \ + } \ + TEST_CASE("zconv." #ty "_to_uint8") \ + { \ + test_szconv<ty##_t, uint8_t>(); \ + } \ + TEST_CASE("zconv." #ty "_to_int16") \ + { \ + test_szconv<ty##_t, int16_t>(); \ + } \ + TEST_CASE("zconv." #ty "_to_uint16") \ + { \ + test_szconv<ty##_t, uint16_t>(); \ + } \ + TEST_CASE("zconv." #ty "_to_int32") \ + { \ + test_szconv<ty##_t, int32_t>(); \ + } \ + TEST_CASE("zconv." #ty "_to_uint32") \ + { \ + test_szconv<ty##_t, uint32_t>(); \ + } \ + TEST_CASE("zconv." #ty "_to_int64") \ + { \ + test_szconv<ty##_t, int64_t>(); \ + } \ + TEST_CASE("szconv." #ty "_to_uint64") \ + { \ + test_szconv<ty##_t, uint64_t>(); \ + } + +DO_TEST_SZCONV(int8) +DO_TEST_SZCONV(uint8) +DO_TEST_SZCONV(int16) +DO_TEST_SZCONV(uint16) +DO_TEST_SZCONV(int32) +DO_TEST_SZCONV(uint32) +DO_TEST_SZCONV(int64) +DO_TEST_SZCONV(uint64) + +} // namespace c4 + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_type_name.cpp b/thirdparty/ryml/ext/c4core/test/test_type_name.cpp new file mode 100644 index 000000000..422676bcf --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_type_name.cpp @@ -0,0 +1,49 @@ +#include "c4/test.hpp" + +#ifndef C4CORE_SINGLE_HEADER +#include "c4/type_name.hpp" +#endif + +class SomeTypeName {}; +struct SomeStructName {}; + +namespace c4 { + +class SomeTypeNameInsideANamespace {}; +struct SomeStructNameInsideANamespace {}; + +template<size_t N> +cspan<char> cstr(const char (&s)[N]) +{ + cspan<char> o(s, N-1); + return o; +} + +TEST_CASE("type_name.intrinsic_types") +{ + CHECK_EQ(type_name<int>(), cstr("int")); + CHECK_EQ(type_name<float>(), cstr("float")); + CHECK_EQ(type_name<double>(), cstr("double")); +} +TEST_CASE("type_name.classes") +{ + CHECK_EQ(type_name<SomeTypeName>(), cstr("SomeTypeName")); + CHECK_EQ(type_name<::SomeTypeName>(), cstr("SomeTypeName")); +} +TEST_CASE("type_name.structs") +{ + CHECK_EQ(type_name<SomeStructName>(), cstr("SomeStructName")); + CHECK_EQ(type_name<::SomeStructName>(), cstr("SomeStructName")); +} +TEST_CASE("type_name.inside_namespace") +{ + CHECK_EQ(type_name<SomeTypeNameInsideANamespace>(), cstr("c4::SomeTypeNameInsideANamespace")); + CHECK_EQ(type_name<c4::SomeTypeNameInsideANamespace>(), cstr("c4::SomeTypeNameInsideANamespace")); + CHECK_EQ(type_name<::c4::SomeTypeNameInsideANamespace>(), cstr("c4::SomeTypeNameInsideANamespace")); + + CHECK_EQ(type_name<SomeStructNameInsideANamespace>(), cstr("c4::SomeStructNameInsideANamespace")); + CHECK_EQ(type_name<c4::SomeStructNameInsideANamespace>(), cstr("c4::SomeStructNameInsideANamespace")); + CHECK_EQ(type_name<::c4::SomeStructNameInsideANamespace>(), cstr("c4::SomeStructNameInsideANamespace")); +} + +} // namespace c4 diff --git a/thirdparty/ryml/ext/c4core/test/test_types.cpp b/thirdparty/ryml/ext/c4core/test/test_types.cpp new file mode 100644 index 000000000..697ce289d --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_types.cpp @@ -0,0 +1,81 @@ +#ifndef C4CORE_SINGLE_HEADER +#include "c4/config.hpp" +#endif +#include <string> + +#include "c4/libtest/supprwarn_push.hpp" +#include "c4/test.hpp" + +namespace c4 { + +C4_STATIC_ASSERT((std::is_same< fastcref< char >, char >::value)); +C4_STATIC_ASSERT((std::is_same< fastcref< i8 >, i8 >::value)); +C4_STATIC_ASSERT((std::is_same< fastcref< u8 >, u8 >::value)); +C4_STATIC_ASSERT((std::is_same< fastcref< i16 >, i16 >::value)); +C4_STATIC_ASSERT((std::is_same< fastcref< u16 >, u16 >::value)); +C4_STATIC_ASSERT((std::is_same< fastcref< i32 >, i32 >::value)); +C4_STATIC_ASSERT((std::is_same< fastcref< u32 >, u32 >::value)); +C4_STATIC_ASSERT((std::is_same< fastcref< i64 >, i64 >::value)); +C4_STATIC_ASSERT((std::is_same< fastcref< u64 >, u64 >::value)); + +using carr64 = char[64]; +C4_STATIC_ASSERT((std::is_same< fastcref< carr64 >, carr64 const& >::value)); +C4_STATIC_ASSERT((std::is_same< fastcref< std::string >, std::string const& >::value)); + +//----------------------------------------------------------------------------- + +C4_BEGIN_HIDDEN_NAMESPACE +template< class T > struct ufonix { T a; }; +using F = ufonix< uint32_t >; +C4_END_HIDDEN_NAMESPACE + +TEST_CASE("TestSizeStructs.min_remainder") +{ + CHECK_EQ(min_remainder(4, 6), 2); + CHECK_EQ(min_remainder(6, 6), 0); + CHECK_EQ(min_remainder(8, 6), 0); +} + +TEST_CASE("TestSizeStructs.mult_remainder") +{ + CHECK_EQ(mult_remainder(6, 1), 0); + CHECK_EQ(mult_remainder(6, 2), 0); + CHECK_EQ(mult_remainder(6, 3), 0); + CHECK_EQ(mult_remainder(6, 4), 2); + CHECK_EQ(mult_remainder(6, 5), 4); + CHECK_EQ(mult_remainder(6, 6), 0); + CHECK_EQ(mult_remainder(6, 7), 1); +} +TEST_CASE("TestSizeStructs.Padded") +{ + CHECK_EQ(sizeof(F), sizeof(uint32_t)); + CHECK_EQ((sizeof(Padded< F, 0 >)), sizeof(F)); + CHECK_EQ((sizeof(Padded< F, 1 >)), sizeof(F)+1); + CHECK_EQ((sizeof(Padded< F, 2 >)), sizeof(F)+2); + CHECK_EQ((sizeof(Padded< F, 3 >)), sizeof(F)+3); +} +TEST_CASE("TestSizeStructs.MinSized") +{ + CHECK_EQ((sizeof(MinSized< F, 14 >)), 14); + CHECK_EQ((sizeof(MinSized< F, 15 >)), 15); + CHECK_EQ((sizeof(MinSized< F, 16 >)), 16); + CHECK_EQ((sizeof(MinSized< F, 17 >)), 17); +} +TEST_CASE("TestSizeStructs.MultSized") +{ + using G = ufonix< char[8] >; + CHECK_EQ((sizeof(MultSized< G, 7 >)), 14); + CHECK_EQ((sizeof(MultSized< G, 6 >)), 12); + CHECK_EQ((sizeof(MultSized< G, 5 >)), 10); + CHECK_EQ((sizeof(MultSized< G, 4 >)), 8); +} +TEST_CASE("TestSizeStructs.UbufSized") +{ + CHECK_EQ((sizeof(UbufSized<ufonix<char[63]>>)), 64); + CHECK_EQ((sizeof(UbufSized<ufonix<char[64]>>)), 64); + CHECK_EQ((sizeof(UbufSized<ufonix<char[65]>>)), 80); +} + +} // namespace c4 + +#include "c4/libtest/supprwarn_pop.hpp" diff --git a/thirdparty/ryml/ext/c4core/test/test_utf.cpp b/thirdparty/ryml/ext/c4core/test/test_utf.cpp new file mode 100644 index 000000000..ffa4fb338 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/test_utf.cpp @@ -0,0 +1,48 @@ +#include "c4/test.hpp" +#ifndef C4CORE_SINGLE_HEADER +#include "c4/std/string.hpp" +#include "c4/std/vector.hpp" +#include "c4/format.hpp" +#include "c4/utf.hpp" +#endif + +#include "c4/libtest/supprwarn_push.hpp" + +#include <cstring> + +namespace c4 { + +struct utft +{ + csubstr code_point; + csubstr character; + uint32_t character_val; + csubstr character_val_hex; +}; +constexpr const utft utf_chars[] = { +#include "./utfchars.inc" +}; + +TEST_CASE("utf.decode_code_point") +{ + size_t i = 0; + char decoded_buf[64]; + for(auto uc : utf_chars) + { + INFO("utfchars[", i, "]: codepoint=", uc.code_point, ' ', + "character=", uc.character.empty() ? csubstr{} : uc.character, ' ', + "val=", uc.character_val_hex, '(', uc.character_val, ')'); + i++; + csubstr cpstr = uc.code_point.sub(2).triml('0'); + if(cpstr.empty()) + continue; + csubstr decoded = decode_code_point(decoded_buf, cpstr); + CHECK_UNARY(uc.code_point.begins_with("U+")); + if(uc.character.empty()) + continue; + CHECK_EQ(decoded.len, uc.character.len); + CHECK_EQ(decoded, uc.character); + } +} + +} // namespace c4 diff --git a/thirdparty/ryml/ext/c4core/test/utfchars.inc b/thirdparty/ryml/ext/c4core/test/utfchars.inc new file mode 100644 index 000000000..b0b23d4c0 --- /dev/null +++ b/thirdparty/ryml/ext/c4core/test/utfchars.inc @@ -0,0 +1,6274 @@ +// https://www.utf8-chartable.de/unicode-utf8-table.pl +#define _c(cp, wysiwyg, hex) utft{csubstr{#cp}, csubstr{wysiwyg}, UINT32_C(0x##hex), csubstr{"0x" #hex}} +_c(U+0000, "\0", 00), +_c(U+0001, "", 01), +_c(U+0002, "", 02), +_c(U+0003, "", 03), +_c(U+0004, "", 04), +_c(U+0005, "", 05), +_c(U+0006, "", 06), +_c(U+0007, "", 07), +_c(U+0008, "\b", 08), +_c(U+0009, "\t", 09), +_c(U+000A, "\n", 0a), +_c(U+000B, "", 0b), +_c(U+000C, "", 0c), +_c(U+000D, "\r", 0d), +_c(U+000E, "", 0e), +_c(U+000F, "", 0f), +_c(U+0010, "", 10), +_c(U+0011, "", 11), +_c(U+0012, "", 12), +_c(U+0013, "", 13), +_c(U+0014, "", 14), +_c(U+0015, "", 15), +_c(U+0016, "", 16), +_c(U+0017, "", 17), +_c(U+0018, "", 18), +_c(U+0019, "", 19), +_c(U+001A, "", 1a), +_c(U+001B, "", 1b), +_c(U+001C, "", 1c), +_c(U+001D, "", 1d), +_c(U+001E, "", 1e), +_c(U+001F, "", 1f), +_c(U+0020, " ", 20), +_c(U+0021, "!", 21), +_c(U+0022, "\"", 22), +_c(U+0023, "#", 23), +_c(U+0024, "$", 24), +_c(U+0025, "%", 25), +_c(U+0026, "&", 26), +_c(U+0027, "'", 27), +_c(U+0028, "(", 28), +_c(U+0029, ")", 29), +_c(U+002A, "*", 2a), +_c(U+002B, "+", 2b), +_c(U+002C, ",", 2c), +_c(U+002D, "-", 2d), +_c(U+002E, ".", 2e), +_c(U+002F, "/", 2f), +_c(U+0030, "0", 30), +_c(U+0031, "1", 31), +_c(U+0032, "2", 32), +_c(U+0033, "3", 33), +_c(U+0034, "4", 34), +_c(U+0035, "5", 35), +_c(U+0036, "6", 36), +_c(U+0037, "7", 37), +_c(U+0038, "8", 38), +_c(U+0039, "9", 39), +_c(U+003A, ":", 3a), +_c(U+003B, ";", 3b), +_c(U+003C, "<", 3c), +_c(U+003D, "=", 3d), +_c(U+003E, ">", 3e), +_c(U+003F, "?", 3f), +_c(U+0040, "@", 40), +_c(U+0041, "A", 41), +_c(U+0042, "B", 42), +_c(U+0043, "C", 43), +_c(U+0044, "D", 44), +_c(U+0045, "E", 45), +_c(U+0046, "F", 46), +_c(U+0047, "G", 47), +_c(U+0048, "H", 48), +_c(U+0049, "I", 49), +_c(U+004A, "J", 4a), +_c(U+004B, "K", 4b), +_c(U+004C, "L", 4c), +_c(U+004D, "M", 4d), +_c(U+004E, "N", 4e), +_c(U+004F, "O", 4f), +_c(U+0050, "P", 50), +_c(U+0051, "Q", 51), +_c(U+0052, "R", 52), +_c(U+0053, "S", 53), +_c(U+0054, "T", 54), +_c(U+0055, "U", 55), +_c(U+0056, "V", 56), +_c(U+0057, "W", 57), +_c(U+0058, "X", 58), +_c(U+0059, "Y", 59), +_c(U+005A, "Z", 5a), +_c(U+005B, "[", 5b), +_c(U+005C, "\\", 5c), +_c(U+005D, "]", 5d), +_c(U+005E, "^", 5e), +_c(U+005F, "_", 5f), +_c(U+0060, "`", 60), +_c(U+0061, "a", 61), +_c(U+0062, "b", 62), +_c(U+0063, "c", 63), +_c(U+0064, "d", 64), +_c(U+0065, "e", 65), +_c(U+0066, "f", 66), +_c(U+0067, "g", 67), +_c(U+0068, "h", 68), +_c(U+0069, "i", 69), +_c(U+006A, "j", 6a), +_c(U+006B, "k", 6b), +_c(U+006C, "l", 6c), +_c(U+006D, "m", 6d), +_c(U+006E, "n", 6e), +_c(U+006F, "o", 6f), +_c(U+0070, "p", 70), +_c(U+0071, "q", 71), +_c(U+0072, "r", 72), +_c(U+0073, "s", 73), +_c(U+0074, "t", 74), +_c(U+0075, "u", 75), +_c(U+0076, "v", 76), +_c(U+0077, "w", 77), +_c(U+0078, "x", 78), +_c(U+0079, "y", 79), +_c(U+007A, "z", 7a), +_c(U+007B, "", 7b), +_c(U+007C, "|", 7c), +_c(U+007D, "}", 7d), +_c(U+007E, "~", 7e), +_c(U+007F, "", 7f), // del +_c(U+0080, "", c280), +_c(U+0081, "", c281), +_c(U+0082, "", c282), +_c(U+0083, "", c283), +_c(U+0084, "", c284), +_c(U+0085, "", c285), +_c(U+0086, "", c286), +_c(U+0087, "", c287), +_c(U+0088, "", c288), +_c(U+0089, "", c289), +_c(U+008A, "", c28a), +_c(U+008B, "", c28b), +_c(U+008C, "", c28c), +_c(U+008D, "", c28d), +_c(U+008E, "", c28e), +_c(U+008F, "", c28f), +_c(U+0090, "", c290), +_c(U+0091, "", c291), +_c(U+0092, "", c292), +_c(U+0093, "", c293), +_c(U+0094, "", c294), +_c(U+0095, "", c295), +_c(U+0096, "", c296), +_c(U+0097, "", c297), +_c(U+0098, "", c298), +_c(U+0099, "", c299), +_c(U+009A, "", c29a), +_c(U+009B, "", c29b), +_c(U+009C, "", c29c), +_c(U+009D, "", c29d), +_c(U+009E, "", c29e), +_c(U+009F, "", c29f), +_c(U+00A0, "", c2a0), +_c(U+00A1, "ยก", c2a1), +_c(U+00A2, "ยข", c2a2), +_c(U+00A3, "ยฃ", c2a3), +_c(U+00A4, "ยค", c2a4), +_c(U+00A5, "ยฅ", c2a5), +_c(U+00A6, "ยฆ", c2a6), +_c(U+00A7, "ยง", c2a7), +_c(U+00A8, "ยจ", c2a8), +_c(U+00A9, "ยฉ", c2a9), +_c(U+00AA, "ยช", c2aa), +_c(U+00AB, "ยซ", c2ab), +_c(U+00AC, "ยฌ", c2ac), +_c(U+00AD, "ยญ", c2ad), +_c(U+00AE, "ยฎ", c2ae), +_c(U+00AF, "ยฏ", c2af), +_c(U+00B0, "ยฐ", c2b0), +_c(U+00B1, "ยฑ", c2b1), +_c(U+00B2, "ยฒ", c2b2), +_c(U+00B3, "ยณ", c2b3), +_c(U+00B4, "ยด", c2b4), +_c(U+00B5, "ยต", c2b5), +_c(U+00B6, "ยถ", c2b6), +_c(U+00B7, "ยท", c2b7), +_c(U+00B8, "ยธ", c2b8), +_c(U+00B9, "ยน", c2b9), +_c(U+00BA, "ยบ", c2ba), +_c(U+00BB, "ยป", c2bb), +_c(U+00BC, "ยผ", c2bc), +_c(U+00BD, "ยฝ", c2bd), +_c(U+00BE, "ยพ", c2be), +_c(U+00BF, "ยฟ", c2bf), +_c(U+00C0, "ร", c380), +_c(U+00C1, "ร", c381), +_c(U+00C2, "ร", c382), +_c(U+00C3, "ร", c383), +_c(U+00C4, "ร", c384), +_c(U+00C5, "ร
", c385), +_c(U+00C6, "ร", c386), +_c(U+00C7, "ร", c387), +_c(U+00C8, "ร", c388), +_c(U+00C9, "ร", c389), +_c(U+00CA, "ร", c38a), +_c(U+00CB, "ร", c38b), +_c(U+00CC, "ร", c38c), +_c(U+00CD, "ร", c38d), +_c(U+00CE, "ร", c38e), +_c(U+00CF, "ร", c38f), +_c(U+00D0, "ร", c390), +_c(U+00D1, "ร", c391), +_c(U+00D2, "ร", c392), +_c(U+00D3, "ร", c393), +_c(U+00D4, "ร", c394), +_c(U+00D5, "ร", c395), +_c(U+00D6, "ร", c396), +_c(U+00D7, "ร", c397), +_c(U+00D8, "ร", c398), +_c(U+00D9, "ร", c399), +_c(U+00DA, "ร", c39a), +_c(U+00DB, "ร", c39b), +_c(U+00DC, "ร", c39c), +_c(U+00DD, "ร", c39d), +_c(U+00DE, "ร", c39e), +_c(U+00DF, "ร", c39f), +_c(U+00E0, "ร ", c3a0), +_c(U+00E1, "รก", c3a1), +_c(U+00E2, "รข", c3a2), +_c(U+00E3, "รฃ", c3a3), +_c(U+00E4, "รค", c3a4), +_c(U+00E5, "รฅ", c3a5), +_c(U+00E6, "รฆ", c3a6), +_c(U+00E7, "รง", c3a7), +_c(U+00E8, "รจ", c3a8), +_c(U+00E9, "รฉ", c3a9), +_c(U+00EA, "รช", c3aa), +_c(U+00EB, "รซ", c3ab), +_c(U+00EC, "รฌ", c3ac), +_c(U+00ED, "รญ", c3ad), +_c(U+00EE, "รฎ", c3ae), +_c(U+00EF, "รฏ", c3af), +_c(U+00F0, "รฐ", c3b0), +_c(U+00F1, "รฑ", c3b1), +_c(U+00F2, "รฒ", c3b2), +_c(U+00F3, "รณ", c3b3), +_c(U+00F4, "รด", c3b4), +_c(U+00F5, "รต", c3b5), +_c(U+00F6, "รถ", c3b6), +_c(U+00F7, "รท", c3b7), +_c(U+00F8, "รธ", c3b8), +_c(U+00F9, "รน", c3b9), +_c(U+00FA, "รบ", c3ba), +_c(U+00FB, "รป", c3bb), +_c(U+00FC, "รผ", c3bc), +_c(U+00FD, "รฝ", c3bd), +_c(U+00FE, "รพ", c3be), +_c(U+00FF, "รฟ", c3bf), +_c(U+0100, "ฤ", c480), +_c(U+0101, "ฤ", c481), +_c(U+0102, "ฤ", c482), +_c(U+0103, "ฤ", c483), +_c(U+0104, "ฤ", c484), +_c(U+0105, "ฤ
", c485), +_c(U+0106, "ฤ", c486), +_c(U+0107, "ฤ", c487), +_c(U+0108, "ฤ", c488), +_c(U+0109, "ฤ", c489), +_c(U+010A, "ฤ", c48a), +_c(U+010B, "ฤ", c48b), +_c(U+010C, "ฤ", c48c), +_c(U+010D, "ฤ", c48d), +_c(U+010E, "ฤ", c48e), +_c(U+010F, "ฤ", c48f), +_c(U+0110, "ฤ", c490), +_c(U+0111, "ฤ", c491), +_c(U+0112, "ฤ", c492), +_c(U+0113, "ฤ", c493), +_c(U+0114, "ฤ", c494), +_c(U+0115, "ฤ", c495), +_c(U+0116, "ฤ", c496), +_c(U+0117, "ฤ", c497), +_c(U+0118, "ฤ", c498), +_c(U+0119, "ฤ", c499), +_c(U+011A, "ฤ", c49a), +_c(U+011B, "ฤ", c49b), +_c(U+011C, "ฤ", c49c), +_c(U+011D, "ฤ", c49d), +_c(U+011E, "ฤ", c49e), +_c(U+011F, "ฤ", c49f), +_c(U+0120, "ฤ ", c4a0), +_c(U+0121, "ฤก", c4a1), +_c(U+0122, "ฤข", c4a2), +_c(U+0123, "ฤฃ", c4a3), +_c(U+0124, "ฤค", c4a4), +_c(U+0125, "ฤฅ", c4a5), +_c(U+0126, "ฤฆ", c4a6), +_c(U+0127, "ฤง", c4a7), +_c(U+0128, "ฤจ", c4a8), +_c(U+0129, "ฤฉ", c4a9), +_c(U+012A, "ฤช", c4aa), +_c(U+012B, "ฤซ", c4ab), +_c(U+012C, "ฤฌ", c4ac), +_c(U+012D, "ฤญ", c4ad), +_c(U+012E, "ฤฎ", c4ae), +_c(U+012F, "ฤฏ", c4af), +_c(U+0130, "ฤฐ", c4b0), +_c(U+0131, "ฤฑ", c4b1), +_c(U+0132, "ฤฒ", c4b2), +_c(U+0133, "ฤณ", c4b3), +_c(U+0134, "ฤด", c4b4), +_c(U+0135, "ฤต", c4b5), +_c(U+0136, "ฤถ", c4b6), +_c(U+0137, "ฤท", c4b7), +_c(U+0138, "ฤธ", c4b8), +_c(U+0139, "ฤน", c4b9), +_c(U+013A, "ฤบ", c4ba), +_c(U+013B, "ฤป", c4bb), +_c(U+013C, "ฤผ", c4bc), +_c(U+013D, "ฤฝ", c4bd), +_c(U+013E, "ฤพ", c4be), +_c(U+013F, "ฤฟ", c4bf), +_c(U+0140, "ล", c580), +_c(U+0141, "ล", c581), +_c(U+0142, "ล", c582), +_c(U+0143, "ล", c583), +_c(U+0144, "ล", c584), +_c(U+0145, "ล
", c585), +_c(U+0146, "ล", c586), +_c(U+0147, "ล", c587), +_c(U+0148, "ล", c588), +_c(U+0149, "ล", c589), +_c(U+014A, "ล", c58a), +_c(U+014B, "ล", c58b), +_c(U+014C, "ล", c58c), +_c(U+014D, "ล", c58d), +_c(U+014E, "ล", c58e), +_c(U+014F, "ล", c58f), +_c(U+0150, "ล", c590), +_c(U+0151, "ล", c591), +_c(U+0152, "ล", c592), +_c(U+0153, "ล", c593), +_c(U+0154, "ล", c594), +_c(U+0155, "ล", c595), +_c(U+0156, "ล", c596), +_c(U+0157, "ล", c597), +_c(U+0158, "ล", c598), +_c(U+0159, "ล", c599), +_c(U+015A, "ล", c59a), +_c(U+015B, "ล", c59b), +_c(U+015C, "ล", c59c), +_c(U+015D, "ล", c59d), +_c(U+015E, "ล", c59e), +_c(U+015F, "ล", c59f), +_c(U+0160, "ล ", c5a0), +_c(U+0161, "ลก", c5a1), +_c(U+0162, "ลข", c5a2), +_c(U+0163, "ลฃ", c5a3), +_c(U+0164, "ลค", c5a4), +_c(U+0165, "ลฅ", c5a5), +_c(U+0166, "ลฆ", c5a6), +_c(U+0167, "ลง", c5a7), +_c(U+0168, "ลจ", c5a8), +_c(U+0169, "ลฉ", c5a9), +_c(U+016A, "ลช", c5aa), +_c(U+016B, "ลซ", c5ab), +_c(U+016C, "ลฌ", c5ac), +_c(U+016D, "ลญ", c5ad), +_c(U+016E, "ลฎ", c5ae), +_c(U+016F, "ลฏ", c5af), +_c(U+0170, "ลฐ", c5b0), +_c(U+0171, "ลฑ", c5b1), +_c(U+0172, "ลฒ", c5b2), +_c(U+0173, "ลณ", c5b3), +_c(U+0174, "ลด", c5b4), +_c(U+0175, "ลต", c5b5), +_c(U+0176, "ลถ", c5b6), +_c(U+0177, "ลท", c5b7), +_c(U+0178, "ลธ", c5b8), +_c(U+0179, "ลน", c5b9), +_c(U+017A, "ลบ", c5ba), +_c(U+017B, "ลป", c5bb), +_c(U+017C, "ลผ", c5bc), +_c(U+017D, "ลฝ", c5bd), +_c(U+017E, "ลพ", c5be), +_c(U+017F, "ลฟ", c5bf), +_c(U+0180, "ฦ", c680), +_c(U+0181, "ฦ", c681), +_c(U+0182, "ฦ", c682), +_c(U+0183, "ฦ", c683), +_c(U+0184, "ฦ", c684), +_c(U+0185, "ฦ
", c685), +_c(U+0186, "ฦ", c686), +_c(U+0187, "ฦ", c687), +_c(U+0188, "ฦ", c688), +_c(U+0189, "ฦ", c689), +_c(U+018A, "ฦ", c68a), +_c(U+018B, "ฦ", c68b), +_c(U+018C, "ฦ", c68c), +_c(U+018D, "ฦ", c68d), +_c(U+018E, "ฦ", c68e), +_c(U+018F, "ฦ", c68f), +_c(U+0190, "ฦ", c690), +_c(U+0191, "ฦ", c691), +_c(U+0192, "ฦ", c692), +_c(U+0193, "ฦ", c693), +_c(U+0194, "ฦ", c694), +_c(U+0195, "ฦ", c695), +_c(U+0196, "ฦ", c696), +_c(U+0197, "ฦ", c697), +_c(U+0198, "ฦ", c698), +_c(U+0199, "ฦ", c699), +_c(U+019A, "ฦ", c69a), +_c(U+019B, "ฦ", c69b), +_c(U+019C, "ฦ", c69c), +_c(U+019D, "ฦ", c69d), +_c(U+019E, "ฦ", c69e), +_c(U+019F, "ฦ", c69f), +_c(U+01A0, "ฦ ", c6a0), +_c(U+01A1, "ฦก", c6a1), +_c(U+01A2, "ฦข", c6a2), +_c(U+01A3, "ฦฃ", c6a3), +_c(U+01A4, "ฦค", c6a4), +_c(U+01A5, "ฦฅ", c6a5), +_c(U+01A6, "ฦฆ", c6a6), +_c(U+01A7, "ฦง", c6a7), +_c(U+01A8, "ฦจ", c6a8), +_c(U+01A9, "ฦฉ", c6a9), +_c(U+01AA, "ฦช", c6aa), +_c(U+01AB, "ฦซ", c6ab), +_c(U+01AC, "ฦฌ", c6ac), +_c(U+01AD, "ฦญ", c6ad), +_c(U+01AE, "ฦฎ", c6ae), +_c(U+01AF, "ฦฏ", c6af), +_c(U+01B0, "ฦฐ", c6b0), +_c(U+01B1, "ฦฑ", c6b1), +_c(U+01B2, "ฦฒ", c6b2), +_c(U+01B3, "ฦณ", c6b3), +_c(U+01B4, "ฦด", c6b4), +_c(U+01B5, "ฦต", c6b5), +_c(U+01B6, "ฦถ", c6b6), +_c(U+01B7, "ฦท", c6b7), +_c(U+01B8, "ฦธ", c6b8), +_c(U+01B9, "ฦน", c6b9), +_c(U+01BA, "ฦบ", c6ba), +_c(U+01BB, "ฦป", c6bb), +_c(U+01BC, "ฦผ", c6bc), +_c(U+01BD, "ฦฝ", c6bd), +_c(U+01BE, "ฦพ", c6be), +_c(U+01BF, "ฦฟ", c6bf), +_c(U+01C0, "ว", c780), +_c(U+01C1, "ว", c781), +_c(U+01C2, "ว", c782), +_c(U+01C3, "ว", c783), +_c(U+01C4, "ว", c784), +_c(U+01C5, "ว
", c785), +_c(U+01C6, "ว", c786), +_c(U+01C7, "ว", c787), +_c(U+01C8, "ว", c788), +_c(U+01C9, "ว", c789), +_c(U+01CA, "ว", c78a), +_c(U+01CB, "ว", c78b), +_c(U+01CC, "ว", c78c), +_c(U+01CD, "ว", c78d), +_c(U+01CE, "ว", c78e), +_c(U+01CF, "ว", c78f), +_c(U+01D0, "ว", c790), +_c(U+01D1, "ว", c791), +_c(U+01D2, "ว", c792), +_c(U+01D3, "ว", c793), +_c(U+01D4, "ว", c794), +_c(U+01D5, "ว", c795), +_c(U+01D6, "ว", c796), +_c(U+01D7, "ว", c797), +_c(U+01D8, "ว", c798), +_c(U+01D9, "ว", c799), +_c(U+01DA, "ว", c79a), +_c(U+01DB, "ว", c79b), +_c(U+01DC, "ว", c79c), +_c(U+01DD, "ว", c79d), +_c(U+01DE, "ว", c79e), +_c(U+01DF, "ว", c79f), +_c(U+01E0, "ว ", c7a0), +_c(U+01E1, "วก", c7a1), +_c(U+01E2, "วข", c7a2), +_c(U+01E3, "วฃ", c7a3), +_c(U+01E4, "วค", c7a4), +_c(U+01E5, "วฅ", c7a5), +_c(U+01E6, "วฆ", c7a6), +_c(U+01E7, "วง", c7a7), +_c(U+01E8, "วจ", c7a8), +_c(U+01E9, "วฉ", c7a9), +_c(U+01EA, "วช", c7aa), +_c(U+01EB, "วซ", c7ab), +_c(U+01EC, "วฌ", c7ac), +_c(U+01ED, "วญ", c7ad), +_c(U+01EE, "วฎ", c7ae), +_c(U+01EF, "วฏ", c7af), +_c(U+01F0, "วฐ", c7b0), +_c(U+01F1, "วฑ", c7b1), +_c(U+01F2, "วฒ", c7b2), +_c(U+01F3, "วณ", c7b3), +_c(U+01F4, "วด", c7b4), +_c(U+01F5, "วต", c7b5), +_c(U+01F6, "วถ", c7b6), +_c(U+01F7, "วท", c7b7), +_c(U+01F8, "วธ", c7b8), +_c(U+01F9, "วน", c7b9), +_c(U+01FA, "วบ", c7ba), +_c(U+01FB, "วป", c7bb), +_c(U+01FC, "วผ", c7bc), +_c(U+01FD, "วฝ", c7bd), +_c(U+01FE, "วพ", c7be), +_c(U+01FF, "วฟ", c7bf), +_c(U+0200, "ศ", c880), +_c(U+0201, "ศ", c881), +_c(U+0202, "ศ", c882), +_c(U+0203, "ศ", c883), +_c(U+0204, "ศ", c884), +_c(U+0205, "ศ
", c885), +_c(U+0206, "ศ", c886), +_c(U+0207, "ศ", c887), +_c(U+0208, "ศ", c888), +_c(U+0209, "ศ", c889), +_c(U+020A, "ศ", c88a), +_c(U+020B, "ศ", c88b), +_c(U+020C, "ศ", c88c), +_c(U+020D, "ศ", c88d), +_c(U+020E, "ศ", c88e), +_c(U+020F, "ศ", c88f), +_c(U+0210, "ศ", c890), +_c(U+0211, "ศ", c891), +_c(U+0212, "ศ", c892), +_c(U+0213, "ศ", c893), +_c(U+0214, "ศ", c894), +_c(U+0215, "ศ", c895), +_c(U+0216, "ศ", c896), +_c(U+0217, "ศ", c897), +_c(U+0218, "ศ", c898), +_c(U+0219, "ศ", c899), +_c(U+021A, "ศ", c89a), +_c(U+021B, "ศ", c89b), +_c(U+021C, "ศ", c89c), +_c(U+021D, "ศ", c89d), +_c(U+021E, "ศ", c89e), +_c(U+021F, "ศ", c89f), +_c(U+0220, "ศ ", c8a0), +_c(U+0221, "ศก", c8a1), +_c(U+0222, "ศข", c8a2), +_c(U+0223, "ศฃ", c8a3), +_c(U+0224, "ศค", c8a4), +_c(U+0225, "ศฅ", c8a5), +_c(U+0226, "ศฆ", c8a6), +_c(U+0227, "ศง", c8a7), +_c(U+0228, "ศจ", c8a8), +_c(U+0229, "ศฉ", c8a9), +_c(U+022A, "ศช", c8aa), +_c(U+022B, "ศซ", c8ab), +_c(U+022C, "ศฌ", c8ac), +_c(U+022D, "ศญ", c8ad), +_c(U+022E, "ศฎ", c8ae), +_c(U+022F, "ศฏ", c8af), +_c(U+0230, "ศฐ", c8b0), +_c(U+0231, "ศฑ", c8b1), +_c(U+0232, "ศฒ", c8b2), +_c(U+0233, "ศณ", c8b3), +_c(U+0234, "ศด", c8b4), +_c(U+0235, "ศต", c8b5), +_c(U+0236, "ศถ", c8b6), +_c(U+0237, "ศท", c8b7), +_c(U+0238, "ศธ", c8b8), +_c(U+0239, "ศน", c8b9), +_c(U+023A, "ศบ", c8ba), +_c(U+023B, "ศป", c8bb), +_c(U+023C, "ศผ", c8bc), +_c(U+023D, "ศฝ", c8bd), +_c(U+023E, "ศพ", c8be), +_c(U+023F, "ศฟ", c8bf), +_c(U+0240, "ษ", c980), +_c(U+0241, "ษ", c981), +_c(U+0242, "ษ", c982), +_c(U+0243, "ษ", c983), +_c(U+0244, "ษ", c984), +_c(U+0245, "ษ
", c985), +_c(U+0246, "ษ", c986), +_c(U+0247, "ษ", c987), +_c(U+0248, "ษ", c988), +_c(U+0249, "ษ", c989), +_c(U+024A, "ษ", c98a), +_c(U+024B, "ษ", c98b), +_c(U+024C, "ษ", c98c), +_c(U+024D, "ษ", c98d), +_c(U+024E, "ษ", c98e), +_c(U+024F, "ษ", c98f), +_c(U+0250, "ษ", c990), +_c(U+0251, "ษ", c991), +_c(U+0252, "ษ", c992), +_c(U+0253, "ษ", c993), +_c(U+0254, "ษ", c994), +_c(U+0255, "ษ", c995), +_c(U+0256, "ษ", c996), +_c(U+0257, "ษ", c997), +_c(U+0258, "ษ", c998), +_c(U+0259, "ษ", c999), +_c(U+025A, "ษ", c99a), +_c(U+025B, "ษ", c99b), +_c(U+025C, "ษ", c99c), +_c(U+025D, "ษ", c99d), +_c(U+025E, "ษ", c99e), +_c(U+025F, "ษ", c99f), +_c(U+0260, "ษ ", c9a0), +_c(U+0261, "ษก", c9a1), +_c(U+0262, "ษข", c9a2), +_c(U+0263, "ษฃ", c9a3), +_c(U+0264, "ษค", c9a4), +_c(U+0265, "ษฅ", c9a5), +_c(U+0266, "ษฆ", c9a6), +_c(U+0267, "ษง", c9a7), +_c(U+0268, "ษจ", c9a8), +_c(U+0269, "ษฉ", c9a9), +_c(U+026A, "ษช", c9aa), +_c(U+026B, "ษซ", c9ab), +_c(U+026C, "ษฌ", c9ac), +_c(U+026D, "ษญ", c9ad), +_c(U+026E, "ษฎ", c9ae), +_c(U+026F, "ษฏ", c9af), +_c(U+0270, "ษฐ", c9b0), +_c(U+0271, "ษฑ", c9b1), +_c(U+0272, "ษฒ", c9b2), +_c(U+0273, "ษณ", c9b3), +_c(U+0274, "ษด", c9b4), +_c(U+0275, "ษต", c9b5), +_c(U+0276, "ษถ", c9b6), +_c(U+0277, "ษท", c9b7), +_c(U+0278, "ษธ", c9b8), +_c(U+0279, "ษน", c9b9), +_c(U+027A, "ษบ", c9ba), +_c(U+027B, "ษป", c9bb), +_c(U+027C, "ษผ", c9bc), +_c(U+027D, "ษฝ", c9bd), +_c(U+027E, "ษพ", c9be), +_c(U+027F, "ษฟ", c9bf), +_c(U+0280, "ส", ca80), +_c(U+0281, "ส", ca81), +_c(U+0282, "ส", ca82), +_c(U+0283, "ส", ca83), +_c(U+0284, "ส", ca84), +_c(U+0285, "ส
", ca85), +_c(U+0286, "ส", ca86), +_c(U+0287, "ส", ca87), +_c(U+0288, "ส", ca88), +_c(U+0289, "ส", ca89), +_c(U+028A, "ส", ca8a), +_c(U+028B, "ส", ca8b), +_c(U+028C, "ส", ca8c), +_c(U+028D, "ส", ca8d), +_c(U+028E, "ส", ca8e), +_c(U+028F, "ส", ca8f), +_c(U+0290, "ส", ca90), +_c(U+0291, "ส", ca91), +_c(U+0292, "ส", ca92), +_c(U+0293, "ส", ca93), +_c(U+0294, "ส", ca94), +_c(U+0295, "ส", ca95), +_c(U+0296, "ส", ca96), +_c(U+0297, "ส", ca97), +_c(U+0298, "ส", ca98), +_c(U+0299, "ส", ca99), +_c(U+029A, "ส", ca9a), +_c(U+029B, "ส", ca9b), +_c(U+029C, "ส", ca9c), +_c(U+029D, "ส", ca9d), +_c(U+029E, "ส", ca9e), +_c(U+029F, "ส", ca9f), +_c(U+02A0, "ส ", caa0), +_c(U+02A1, "สก", caa1), +_c(U+02A2, "สข", caa2), +_c(U+02A3, "สฃ", caa3), +_c(U+02A4, "สค", caa4), +_c(U+02A5, "สฅ", caa5), +_c(U+02A6, "สฆ", caa6), +_c(U+02A7, "สง", caa7), +_c(U+02A8, "สจ", caa8), +_c(U+02A9, "สฉ", caa9), +_c(U+02AA, "สช", caaa), +_c(U+02AB, "สซ", caab), +_c(U+02AC, "สฌ", caac), +_c(U+02AD, "สญ", caad), +_c(U+02AE, "สฎ", caae), +_c(U+02AF, "สฏ", caaf), +_c(U+02B0, "สฐ", cab0), +_c(U+02B1, "สฑ", cab1), +_c(U+02B2, "สฒ", cab2), +_c(U+02B3, "สณ", cab3), +_c(U+02B4, "สด", cab4), +_c(U+02B5, "สต", cab5), +_c(U+02B6, "สถ", cab6), +_c(U+02B7, "สท", cab7), +_c(U+02B8, "สธ", cab8), +_c(U+02B9, "สน", cab9), +_c(U+02BA, "สบ", caba), +_c(U+02BB, "สป", cabb), +_c(U+02BC, "สผ", cabc), +_c(U+02BD, "สฝ", cabd), +_c(U+02BE, "สพ", cabe), +_c(U+02BF, "สฟ", cabf), +_c(U+02C0, "ห", cb80), +_c(U+02C1, "ห", cb81), +_c(U+02C2, "ห", cb82), +_c(U+02C3, "ห", cb83), +_c(U+02C4, "ห", cb84), +_c(U+02C5, "ห
", cb85), +_c(U+02C6, "ห", cb86), +_c(U+02C7, "ห", cb87), +_c(U+02C8, "ห", cb88), +_c(U+02C9, "ห", cb89), +_c(U+02CA, "ห", cb8a), +_c(U+02CB, "ห", cb8b), +_c(U+02CC, "ห", cb8c), +_c(U+02CD, "ห", cb8d), +_c(U+02CE, "ห", cb8e), +_c(U+02CF, "ห", cb8f), +_c(U+02D0, "ห", cb90), +_c(U+02D1, "ห", cb91), +_c(U+02D2, "ห", cb92), +_c(U+02D3, "ห", cb93), +_c(U+02D4, "ห", cb94), +_c(U+02D5, "ห", cb95), +_c(U+02D6, "ห", cb96), +_c(U+02D7, "ห", cb97), +_c(U+02D8, "ห", cb98), +_c(U+02D9, "ห", cb99), +_c(U+02DA, "ห", cb9a), +_c(U+02DB, "ห", cb9b), +_c(U+02DC, "ห", cb9c), +_c(U+02DD, "ห", cb9d), +_c(U+02DE, "ห", cb9e), +_c(U+02DF, "ห", cb9f), +_c(U+02E0, "ห ", cba0), +_c(U+02E1, "หก", cba1), +_c(U+02E2, "หข", cba2), +_c(U+02E3, "หฃ", cba3), +_c(U+02E4, "หค", cba4), +_c(U+02E5, "หฅ", cba5), +_c(U+02E6, "หฆ", cba6), +_c(U+02E7, "หง", cba7), +_c(U+02E8, "หจ", cba8), +_c(U+02E9, "หฉ", cba9), +_c(U+02EA, "หช", cbaa), +_c(U+02EB, "หซ", cbab), +_c(U+02EC, "หฌ", cbac), +_c(U+02ED, "หญ", cbad), +_c(U+02EE, "หฎ", cbae), +_c(U+02EF, "หฏ", cbaf), +_c(U+02F0, "หฐ", cbb0), +_c(U+02F1, "หฑ", cbb1), +_c(U+02F2, "หฒ", cbb2), +_c(U+02F3, "หณ", cbb3), +_c(U+02F4, "หด", cbb4), +_c(U+02F5, "หต", cbb5), +_c(U+02F6, "หถ", cbb6), +_c(U+02F7, "หท", cbb7), +_c(U+02F8, "หธ", cbb8), +_c(U+02F9, "หน", cbb9), +_c(U+02FA, "หบ", cbba), +_c(U+02FB, "หป", cbbb), +_c(U+02FC, "หผ", cbbc), +_c(U+02FD, "หฝ", cbbd), +_c(U+02FE, "หพ", cbbe), +//_c(U+02FF, "หฟ", cbbf), +//_c(U+0300, ฬ"ฬ ", cc80), +//_c(U+0301, ฬ" ", cc81), +//_c(U+0302, ฬ" ", cc82), +//_c(U+0303, ฬ" ", cc83), +//_c(U+0304, ฬ" ", cc84), +//_c(U+0305, "ฬ
" , cc85), +//_c(U+0306, ฬ" ", cc86), +//_c(U+0307, ฬ" ", cc87), +//_c(U+0308, ฬ" ", cc88), +//_c(U+0309, ฬ" ", cc89), +//_c(U+030A, ฬ" ", cc8a), +//_c(U+030B, ฬ" ", cc8b), +//_c(U+030C, ฬ" ", cc8c), +//_c(U+030D, "ฬ" , cc8d), +//_c(U+030E, "ฬ" , cc8e), +//_c(U+030F, ฬ" ", cc8f), +//_c(U+0310, "ฬ" , cc90), +//_c(U+0311, ฬ" ", cc91), +//_c(U+0312, ฬ" ", cc92), +//_c(U+0313, "ฬ" , cc93), +//_c(U+0314, "ฬ" , cc94), +//_c(U+0315, "ฬ" , cc95), +//_c(U+0316, "ฬ" , cc96), +//_c(U+0317, "ฬ" , cc97), +//_c(U+0318, "ฬ" , cc98), +//_c(U+0319, "ฬ" , cc99), +//_c(U+031A, "ฬ" , cc9a), +//_c(U+031B, ฬ" ", cc9b), +//_c(U+031C, "ฬ" , cc9c), +//_c(U+031D, "ฬ" , cc9d), +//_c(U+031E, "ฬ" , cc9e), +_c(U+031F, "ฬ" , cc9f), +_c(U+0320, "ฬ " , cca0), +_c(U+0321, "ฬก" , cca1), +_c(U+0322, "ฬข" , cca2), +//_c(U+0323, ฬฃ" ", cca3), +//_c(U+0324, ฬค" ", cca4), +_c(U+0325, "ฬฅ" , cca5), +//_c(U+0326, ฬฆ" ", cca6), +//_c(U+0327, ฬง" ", cca7), +//_c(U+0328, ฬจ" ", cca8), +//_c(U+0329, "ฬฉ" , cca9), +_c(U+032A, "ฬช" , ccaa), +_c(U+032B, "ฬซ" , ccab), +_c(U+032C, "ฬฌ" , ccac), +_c(U+032D, "ฬญ" , ccad), +//_c(U+032E, ฬฎ" ", ccae), +_c(U+032F, "ฬฏ" , ccaf), +_c(U+0330, "ฬฐ" , ccb0), +//_c(U+0331, ฬฑ" ", ccb1), +_c(U+0332, "ฬฒ" , ccb2), +_c(U+0333, "ฬณ" , ccb3), +_c(U+0334, "ฬด" , ccb4), +//_c(U+0335, ฬต" ", ccb5), +//_c(U+0336, ฬถ" ", ccb6), +_c(U+0337, "ฬท" , ccb7), +_c(U+0338, "ฬธ" , ccb8), +_c(U+0339, "ฬน" , ccb9), +_c(U+033A, "ฬบ" , ccba), +_c(U+033B, "ฬป" , ccbb), +_c(U+033C, "ฬผ" , ccbc), +_c(U+033D, "ฬฝ" , ccbd), +_c(U+033E, "ฬพ" , ccbe), +_c(U+033F, "ฬฟ" , ccbf), +_c(U+0340, "อ" , cd80), +_c(U+0341, "อ" , cd81), +_c(U+0342, "อ" , cd82), +_c(U+0343, "อ" , cd83), +_c(U+0344, "อ" , cd84), +_c(U+0345, "อ
" , cd85), +_c(U+0346, "อ" , cd86), +_c(U+0347, "อ" , cd87), +_c(U+0348, "อ" , cd88), +_c(U+0349, "อ" , cd89), +_c(U+034A, "อ" , cd8a), +_c(U+034B, "อ" , cd8b), +_c(U+034C, "อ" , cd8c), +_c(U+034D, "อ" , cd8d), +_c(U+034E, "อ" , cd8e), +_c(U+034F, "อ" , cd8f), +_c(U+0350, "อ" , cd90), +_c(U+0351, "อ" , cd91), +_c(U+0352, "อ" , cd92), +_c(U+0353, "อ" , cd93), +_c(U+0354, "อ" , cd94), +_c(U+0355, "อ" , cd95), +_c(U+0356, "อ" , cd96), +_c(U+0357, "อ" , cd97), +_c(U+0358, "อ" , cd98), +_c(U+0359, "อ" , cd99), +_c(U+035A, "อ" , cd9a), +_c(U+035B, "อ" , cd9b), +_c(U+035C, "อ" , cd9c), +_c(U+035D, "อ" , cd9d), +_c(U+035E, "อ" , cd9e), +_c(U+035F, "อ" , cd9f), +_c(U+0360, "อ " , cda0), +_c(U+0361, "อก" , cda1), +_c(U+0362, "อข" , cda2), +_c(U+0363, "อฃ" , cda3), +_c(U+0364, "อค" , cda4), +_c(U+0365, "อฅ" , cda5), +_c(U+0366, "อฆ" , cda6), +_c(U+0367, "อง" , cda7), +_c(U+0368, "อจ" , cda8), +_c(U+0369, "อฉ" , cda9), +_c(U+036A, "อช" , cdaa), +_c(U+036B, "อซ" , cdab), +_c(U+036C, "อฌ" , cdac), +_c(U+036D, "อญ" , cdad), +_c(U+036E, "อฎ" , cdae), +_c(U+036F, "อฏ" , cdaf), +_c(U+0370, "อฐ", cdb0), +_c(U+0371, "อฑ", cdb1), +_c(U+0372, "อฒ", cdb2), +_c(U+0373, "อณ", cdb3), +_c(U+0374, "อด", cdb4), +_c(U+0375, "อต", cdb5), +_c(U+0376, "อถ", cdb6), +_c(U+0377, "อท", cdb7), +_c(U+0378, "อธ", cdb8), +_c(U+0379, "อน", cdb9), +_c(U+037A, "อบ", cdba), +_c(U+037B, "อป", cdbb), +_c(U+037C, "อผ", cdbc), +_c(U+037D, "อฝ", cdbd), +_c(U+037E, "อพ", cdbe), +_c(U+037F, "อฟ", cdbf), +_c(U+0380, "ฮ", ce80), +_c(U+0381, "ฮ", ce81), +_c(U+0382, "ฮ", ce82), +_c(U+0383, "ฮ", ce83), +_c(U+0384, "ฮ", ce84), +_c(U+0385, "ฮ
", ce85), +_c(U+0386, "ฮ", ce86), +_c(U+0387, "ฮ", ce87), +_c(U+0388, "ฮ", ce88), +_c(U+0389, "ฮ", ce89), +_c(U+038A, "ฮ", ce8a), +_c(U+038B, "ฮ", ce8b), +_c(U+038C, "ฮ", ce8c), +_c(U+038D, "ฮ", ce8d), +_c(U+038E, "ฮ", ce8e), +_c(U+038F, "ฮ", ce8f), +_c(U+0390, "ฮ", ce90), +_c(U+0391, "ฮ", ce91), +_c(U+0392, "ฮ", ce92), +_c(U+0393, "ฮ", ce93), +_c(U+0394, "ฮ", ce94), +_c(U+0395, "ฮ", ce95), +_c(U+0396, "ฮ", ce96), +_c(U+0397, "ฮ", ce97), +_c(U+0398, "ฮ", ce98), +_c(U+0399, "ฮ", ce99), +_c(U+039A, "ฮ", ce9a), +_c(U+039B, "ฮ", ce9b), +_c(U+039C, "ฮ", ce9c), +_c(U+039D, "ฮ", ce9d), +_c(U+039E, "ฮ", ce9e), +_c(U+039F, "ฮ", ce9f), +_c(U+03A0, "ฮ ", cea0), +_c(U+03A1, "ฮก", cea1), +_c(U+03A2, "ฮข", cea2), +_c(U+03A3, "ฮฃ", cea3), +_c(U+03A4, "ฮค", cea4), +_c(U+03A5, "ฮฅ", cea5), +_c(U+03A6, "ฮฆ", cea6), +_c(U+03A7, "ฮง", cea7), +_c(U+03A8, "ฮจ", cea8), +_c(U+03A9, "ฮฉ", cea9), +_c(U+03AA, "ฮช", ceaa), +_c(U+03AB, "ฮซ", ceab), +_c(U+03AC, "ฮฌ", ceac), +_c(U+03AD, "ฮญ", cead), +_c(U+03AE, "ฮฎ", ceae), +_c(U+03AF, "ฮฏ", ceaf), +_c(U+03B0, "ฮฐ", ceb0), +_c(U+03B1, "ฮฑ", ceb1), +_c(U+03B2, "ฮฒ", ceb2), +_c(U+03B3, "ฮณ", ceb3), +_c(U+03B4, "ฮด", ceb4), +_c(U+03B5, "ฮต", ceb5), +_c(U+03B6, "ฮถ", ceb6), +_c(U+03B7, "ฮท", ceb7), +_c(U+03B8, "ฮธ", ceb8), +_c(U+03B9, "ฮน", ceb9), +_c(U+03BA, "ฮบ", ceba), +_c(U+03BB, "ฮป", cebb), +_c(U+03BC, "ฮผ", cebc), +_c(U+03BD, "ฮฝ", cebd), +_c(U+03BE, "ฮพ", cebe), +_c(U+03BF, "ฮฟ", cebf), +_c(U+03C0, "ฯ", cf80), +_c(U+03C1, "ฯ", cf81), +_c(U+03C2, "ฯ", cf82), +_c(U+03C3, "ฯ", cf83), +_c(U+03C4, "ฯ", cf84), +_c(U+03C5, "ฯ
", cf85), +_c(U+03C6, "ฯ", cf86), +_c(U+03C7, "ฯ", cf87), +_c(U+03C8, "ฯ", cf88), +_c(U+03C9, "ฯ", cf89), +_c(U+03CA, "ฯ", cf8a), +_c(U+03CB, "ฯ", cf8b), +_c(U+03CC, "ฯ", cf8c), +_c(U+03CD, "ฯ", cf8d), +_c(U+03CE, "ฯ", cf8e), +_c(U+03CF, "ฯ", cf8f), +_c(U+03D0, "ฯ", cf90), +_c(U+03D1, "ฯ", cf91), +_c(U+03D2, "ฯ", cf92), +_c(U+03D3, "ฯ", cf93), +_c(U+03D4, "ฯ", cf94), +_c(U+03D5, "ฯ", cf95), +_c(U+03D6, "ฯ", cf96), +_c(U+03D7, "ฯ", cf97), +_c(U+03D8, "ฯ", cf98), +_c(U+03D9, "ฯ", cf99), +_c(U+03DA, "ฯ", cf9a), +_c(U+03DB, "ฯ", cf9b), +_c(U+03DC, "ฯ", cf9c), +_c(U+03DD, "ฯ", cf9d), +_c(U+03DE, "ฯ", cf9e), +_c(U+03DF, "ฯ", cf9f), +_c(U+03E0, "ฯ ", cfa0), +_c(U+03E1, "ฯก", cfa1), +_c(U+03E2, "ฯข", cfa2), +_c(U+03E3, "ฯฃ", cfa3), +_c(U+03E4, "ฯค", cfa4), +_c(U+03E5, "ฯฅ", cfa5), +_c(U+03E6, "ฯฆ", cfa6), +_c(U+03E7, "ฯง", cfa7), +_c(U+03E8, "ฯจ", cfa8), +_c(U+03E9, "ฯฉ", cfa9), +_c(U+03EA, "ฯช", cfaa), +_c(U+03EB, "ฯซ", cfab), +_c(U+03EC, "ฯฌ", cfac), +_c(U+03ED, "ฯญ", cfad), +_c(U+03EE, "ฯฎ", cfae), +_c(U+03EF, "ฯฏ", cfaf), +_c(U+03F0, "ฯฐ", cfb0), +_c(U+03F1, "ฯฑ", cfb1), +_c(U+03F2, "ฯฒ", cfb2), +_c(U+03F3, "ฯณ", cfb3), +_c(U+03F4, "ฯด", cfb4), +_c(U+03F5, "ฯต", cfb5), +_c(U+03F6, "ฯถ", cfb6), +_c(U+03F7, "ฯท", cfb7), +_c(U+03F8, "ฯธ", cfb8), +_c(U+03F9, "ฯน", cfb9), +_c(U+03FA, "ฯบ", cfba), +_c(U+03FB, "ฯป", cfbb), +_c(U+03FC, "ฯผ", cfbc), +_c(U+03FD, "ฯฝ", cfbd), +_c(U+03FE, "ฯพ", cfbe), +_c(U+03FF, "ฯฟ", cfbf), +_c(U+0400, "ะ", d080), +_c(U+0401, "ะ", d081), +_c(U+0402, "ะ", d082), +_c(U+0403, "ะ", d083), +_c(U+0404, "ะ", d084), +_c(U+0405, "ะ
", d085), +_c(U+0406, "ะ", d086), +_c(U+0407, "ะ", d087), +_c(U+0408, "ะ", d088), +_c(U+0409, "ะ", d089), +_c(U+040A, "ะ", d08a), +_c(U+040B, "ะ", d08b), +_c(U+040C, "ะ", d08c), +_c(U+040D, "ะ", d08d), +_c(U+040E, "ะ", d08e), +_c(U+040F, "ะ", d08f), +_c(U+0410, "ะ", d090), +_c(U+0411, "ะ", d091), +_c(U+0412, "ะ", d092), +_c(U+0413, "ะ", d093), +_c(U+0414, "ะ", d094), +_c(U+0415, "ะ", d095), +_c(U+0416, "ะ", d096), +_c(U+0417, "ะ", d097), +_c(U+0418, "ะ", d098), +_c(U+0419, "ะ", d099), +_c(U+041A, "ะ", d09a), +_c(U+041B, "ะ", d09b), +_c(U+041C, "ะ", d09c), +_c(U+041D, "ะ", d09d), +_c(U+041E, "ะ", d09e), +_c(U+041F, "ะ", d09f), +_c(U+0420, "ะ ", d0a0), +_c(U+0421, "ะก", d0a1), +_c(U+0422, "ะข", d0a2), +_c(U+0423, "ะฃ", d0a3), +_c(U+0424, "ะค", d0a4), +_c(U+0425, "ะฅ", d0a5), +_c(U+0426, "ะฆ", d0a6), +_c(U+0427, "ะง", d0a7), +_c(U+0428, "ะจ", d0a8), +_c(U+0429, "ะฉ", d0a9), +_c(U+042A, "ะช", d0aa), +_c(U+042B, "ะซ", d0ab), +_c(U+042C, "ะฌ", d0ac), +_c(U+042D, "ะญ", d0ad), +_c(U+042E, "ะฎ", d0ae), +_c(U+042F, "ะฏ", d0af), +_c(U+0430, "ะฐ", d0b0), +_c(U+0431, "ะฑ", d0b1), +_c(U+0432, "ะฒ", d0b2), +_c(U+0433, "ะณ", d0b3), +_c(U+0434, "ะด", d0b4), +_c(U+0435, "ะต", d0b5), +_c(U+0436, "ะถ", d0b6), +_c(U+0437, "ะท", d0b7), +_c(U+0438, "ะธ", d0b8), +_c(U+0439, "ะน", d0b9), +_c(U+043A, "ะบ", d0ba), +_c(U+043B, "ะป", d0bb), +_c(U+043C, "ะผ", d0bc), +_c(U+043D, "ะฝ", d0bd), +_c(U+043E, "ะพ", d0be), +_c(U+043F, "ะฟ", d0bf), +_c(U+0440, "ั", d180), +_c(U+0441, "ั", d181), +_c(U+0442, "ั", d182), +_c(U+0443, "ั", d183), +_c(U+0444, "ั", d184), +_c(U+0445, "ั
", d185), +_c(U+0446, "ั", d186), +_c(U+0447, "ั", d187), +_c(U+0448, "ั", d188), +_c(U+0449, "ั", d189), +_c(U+044A, "ั", d18a), +_c(U+044B, "ั", d18b), +_c(U+044C, "ั", d18c), +_c(U+044D, "ั", d18d), +_c(U+044E, "ั", d18e), +_c(U+044F, "ั", d18f), +_c(U+0450, "ั", d190), +_c(U+0451, "ั", d191), +_c(U+0452, "ั", d192), +_c(U+0453, "ั", d193), +_c(U+0454, "ั", d194), +_c(U+0455, "ั", d195), +_c(U+0456, "ั", d196), +_c(U+0457, "ั", d197), +_c(U+0458, "ั", d198), +_c(U+0459, "ั", d199), +_c(U+045A, "ั", d19a), +_c(U+045B, "ั", d19b), +_c(U+045C, "ั", d19c), +_c(U+045D, "ั", d19d), +_c(U+045E, "ั", d19e), +_c(U+045F, "ั", d19f), +_c(U+0460, "ั ", d1a0), +_c(U+0461, "ัก", d1a1), +_c(U+0462, "ัข", d1a2), +_c(U+0463, "ัฃ", d1a3), +_c(U+0464, "ัค", d1a4), +_c(U+0465, "ัฅ", d1a5), +_c(U+0466, "ัฆ", d1a6), +_c(U+0467, "ัง", d1a7), +_c(U+0468, "ัจ", d1a8), +_c(U+0469, "ัฉ", d1a9), +_c(U+046A, "ัช", d1aa), +_c(U+046B, "ัซ", d1ab), +_c(U+046C, "ัฌ", d1ac), +_c(U+046D, "ัญ", d1ad), +_c(U+046E, "ัฎ", d1ae), +_c(U+046F, "ัฏ", d1af), +_c(U+0470, "ัฐ", d1b0), +_c(U+0471, "ัฑ", d1b1), +_c(U+0472, "ัฒ", d1b2), +_c(U+0473, "ัณ", d1b3), +_c(U+0474, "ัด", d1b4), +_c(U+0475, "ัต", d1b5), +_c(U+0476, "ัถ", d1b6), +_c(U+0477, "ัท", d1b7), +_c(U+0478, "ัธ", d1b8), +_c(U+0479, "ัน", d1b9), +_c(U+047A, "ับ", d1ba), +_c(U+047B, "ัป", d1bb), +_c(U+047C, "ัผ", d1bc), +_c(U+047D, "ัฝ", d1bd), +_c(U+047E, "ัพ", d1be), +_c(U+047F, "ัฟ", d1bf), +_c(U+20A0, "โ ", e282a0), +_c(U+20A1, "โก", e282a1), +_c(U+20A2, "โข", e282a2), +_c(U+20A3, "โฃ", e282a3), +_c(U+20A4, "โค", e282a4), +_c(U+20A5, "โฅ", e282a5), +_c(U+20A6, "โฆ", e282a6), +_c(U+20A7, "โง", e282a7), +_c(U+20A8, "โจ", e282a8), +_c(U+20A9, "โฉ", e282a9), +_c(U+20AA, "โช", e282aa), +_c(U+20AB, "โซ", e282ab), +_c(U+20AC, "โฌ", e282ac), +_c(U+20AD, "โญ", e282ad), +_c(U+20AE, "โฎ", e282ae), +_c(U+20AF, "โฏ", e282af), +_c(U+20B0, "โฐ", e282b0), +_c(U+20B1, "โฑ", e282b1), +_c(U+20B2, "โฒ", e282b2), +_c(U+20B3, "โณ", e282b3), +_c(U+20B4, "โด", e282b4), +_c(U+20B5, "โต", e282b5), +_c(U+20B6, "โถ", e282b6), +_c(U+20B7, "โท", e282b7), +_c(U+20B8, "โธ", e282b8), +_c(U+20B9, "โน", e282b9), +_c(U+20BA, "โบ", e282ba), +_c(U+20BB, "โป", e282bb), +_c(U+20BC, "โผ", e282bc), +_c(U+20BD, "โฝ", e282bd), +_c(U+20BE, "โพ", e282be), +_c(U+20BF, "โฟ", e282bf), +_c(U+20C0, "โ", e28380), +_c(U+20C1, "โ", e28381), +_c(U+20C2, "โ", e28382), +_c(U+20C3, "โ", e28383), +_c(U+20C4, "โ", e28384), +_c(U+20C5, "โ
", e28385), +_c(U+20C6, "โ", e28386), +_c(U+20C7, "โ", e28387), +_c(U+20C8, "โ", e28388), +_c(U+20C9, "โ", e28389), +_c(U+20CA, "โ", e2838a), +_c(U+20CB, "โ", e2838b), +_c(U+20CC, "โ", e2838c), +_c(U+20CD, "โ", e2838d), +_c(U+20CE, "โ", e2838e), +_c(U+20CF, "โ", e2838f), +_c(U+20D0, "โ", e28390), +_c(U+20D1, "โ", e28391), +_c(U+20D2, "โ", e28392), +_c(U+20D3, "โ", e28393), +_c(U+20D4, "โ", e28394), +_c(U+20D5, "โ", e28395), +_c(U+20D6, "โ", e28396), +_c(U+20D7, "โ", e28397), +_c(U+20D8, "โ", e28398), +_c(U+20D9, "โ", e28399), +_c(U+20DA, "โ", e2839a), +_c(U+20DB, "โ", e2839b), +_c(U+20DC, "โ", e2839c), +_c(U+20DD, "โ", e2839d), +_c(U+20DE, "โ", e2839e), +_c(U+20DF, "โ", e2839f), +_c(U+20E0, "โ ", e283a0), +_c(U+20E1, "โก", e283a1), +_c(U+20E2, "โข", e283a2), +_c(U+20E3, "โฃ", e283a3), +_c(U+20E4, "โค", e283a4), +_c(U+20E5, "โฅ", e283a5), +_c(U+20E6, "โฆ", e283a6), +_c(U+20E7, "โง", e283a7), +_c(U+20E8, "โจ", e283a8), +_c(U+20E9, "โฉ", e283a9), +_c(U+20EA, "โช", e283aa), +_c(U+20EB, "โซ", e283ab), +_c(U+20EC, "โฌ", e283ac), +_c(U+20ED, "โญ", e283ad), +_c(U+20EE, "โฎ", e283ae), +_c(U+20EF, "โฏ", e283af), +_c(U+20F0, "โฐ", e283b0), +_c(U+20F1, "โฑ", e283b1), +_c(U+20F2, "โฒ", e283b2), +_c(U+20F3, "โณ", e283b3), +_c(U+20F4, "โด", e283b4), +_c(U+20F5, "โต", e283b5), +_c(U+20F6, "โถ", e283b6), +_c(U+20F7, "โท", e283b7), +_c(U+20F8, "โธ", e283b8), +_c(U+20F9, "โน", e283b9), +_c(U+20FA, "โบ", e283ba), +_c(U+20FB, "โป", e283bb), +_c(U+20FC, "โผ", e283bc), +_c(U+20FD, "โฝ", e283bd), +_c(U+20FE, "โพ", e283be), +_c(U+20FF, "โฟ", e283bf), +_c(U+2100, "โ", e28480), +_c(U+2101, "โ", e28481), +_c(U+2102, "โ", e28482), +_c(U+2103, "โ", e28483), +_c(U+2104, "โ", e28484), +_c(U+2105, "โ
", e28485), +_c(U+2106, "โ", e28486), +_c(U+2107, "โ", e28487), +_c(U+2108, "โ", e28488), +_c(U+2109, "โ", e28489), +_c(U+210A, "โ", e2848a), +_c(U+210B, "โ", e2848b), +_c(U+210C, "โ", e2848c), +_c(U+210D, "โ", e2848d), +_c(U+210E, "โ", e2848e), +_c(U+210F, "โ", e2848f), +_c(U+2110, "โ", e28490), +_c(U+2111, "โ", e28491), +_c(U+2112, "โ", e28492), +_c(U+2113, "โ", e28493), +_c(U+2114, "โ", e28494), +_c(U+2115, "โ", e28495), +_c(U+2116, "โ", e28496), +_c(U+2117, "โ", e28497), +_c(U+2118, "โ", e28498), +_c(U+2119, "โ", e28499), +_c(U+211A, "โ", e2849a), +_c(U+211B, "โ", e2849b), +_c(U+211C, "โ", e2849c), +_c(U+211D, "โ", e2849d), +_c(U+211E, "โ", e2849e), +_c(U+211F, "โ", e2849f), +_c(U+2120, "โ ", e284a0), +_c(U+2121, "โก", e284a1), +_c(U+2122, "โข", e284a2), +_c(U+2123, "โฃ", e284a3), +_c(U+2124, "โค", e284a4), +_c(U+2125, "โฅ", e284a5), +_c(U+2126, "โฆ", e284a6), +_c(U+2127, "โง", e284a7), +_c(U+2128, "โจ", e284a8), +_c(U+2129, "โฉ", e284a9), +_c(U+212A, "โช", e284aa), +_c(U+212B, "โซ", e284ab), +_c(U+212C, "โฌ", e284ac), +_c(U+212D, "โญ", e284ad), +_c(U+212E, "โฎ", e284ae), +_c(U+212F, "โฏ", e284af), +_c(U+2130, "โฐ", e284b0), +_c(U+2131, "โฑ", e284b1), +_c(U+2132, "โฒ", e284b2), +_c(U+2133, "โณ", e284b3), +_c(U+2134, "โด", e284b4), +_c(U+2135, "โต", e284b5), +_c(U+2136, "โถ", e284b6), +_c(U+2137, "โท", e284b7), +_c(U+2138, "โธ", e284b8), +_c(U+2139, "โน", e284b9), +_c(U+213A, "โบ", e284ba), +_c(U+213B, "โป", e284bb), +_c(U+213C, "โผ", e284bc), +_c(U+213D, "โฝ", e284bd), +_c(U+213E, "โพ", e284be), +_c(U+213F, "โฟ", e284bf), +_c(U+2140, "โ
", e28580), +_c(U+2141, "โ
", e28581), +_c(U+2142, "โ
", e28582), +_c(U+2143, "โ
", e28583), +_c(U+2144, "โ
", e28584), +_c(U+2145, "โ
", e28585), +_c(U+2146, "โ
", e28586), +_c(U+2147, "โ
", e28587), +_c(U+2148, "โ
", e28588), +_c(U+2149, "โ
", e28589), +_c(U+214A, "โ
", e2858a), +_c(U+214B, "โ
", e2858b), +_c(U+214C, "โ
", e2858c), +_c(U+214D, "โ
", e2858d), +_c(U+214E, "โ
", e2858e), +_c(U+214F, "โ
", e2858f), +_c(U+2150, "โ
", e28590), +_c(U+2151, "โ
", e28591), +_c(U+2152, "โ
", e28592), +_c(U+2153, "โ
", e28593), +_c(U+2154, "โ
", e28594), +_c(U+2155, "โ
", e28595), +_c(U+2156, "โ
", e28596), +_c(U+2157, "โ
", e28597), +_c(U+2158, "โ
", e28598), +_c(U+2159, "โ
", e28599), +_c(U+215A, "โ
", e2859a), +_c(U+215B, "โ
", e2859b), +_c(U+215C, "โ
", e2859c), +_c(U+215D, "โ
", e2859d), +_c(U+215E, "โ
", e2859e), +_c(U+215F, "โ
", e2859f), +_c(U+2160, "โ
", e285a0), +_c(U+2161, "โ
ก", e285a1), +_c(U+2162, "โ
ข", e285a2), +_c(U+2163, "โ
ฃ", e285a3), +_c(U+2164, "โ
ค", e285a4), +_c(U+2165, "โ
ฅ", e285a5), +_c(U+2166, "โ
ฆ", e285a6), +_c(U+2167, "โ
ง", e285a7), +_c(U+2168, "โ
จ", e285a8), +_c(U+2169, "โ
ฉ", e285a9), +_c(U+216A, "โ
ช", e285aa), +_c(U+216B, "โ
ซ", e285ab), +_c(U+216C, "โ
ฌ", e285ac), +_c(U+216D, "โ
ญ", e285ad), +_c(U+216E, "โ
ฎ", e285ae), +_c(U+216F, "โ
ฏ", e285af), +_c(U+2170, "โ
ฐ", e285b0), +_c(U+2171, "โ
ฑ", e285b1), +_c(U+2172, "โ
ฒ", e285b2), +_c(U+2173, "โ
ณ", e285b3), +_c(U+2174, "โ
ด", e285b4), +_c(U+2175, "โ
ต", e285b5), +_c(U+2176, "โ
ถ", e285b6), +_c(U+2177, "โ
ท", e285b7), +_c(U+2178, "โ
ธ", e285b8), +_c(U+2179, "โ
น", e285b9), +_c(U+217A, "โ
บ", e285ba), +_c(U+217B, "โ
ป", e285bb), +_c(U+217C, "โ
ผ", e285bc), +_c(U+217D, "โ
ฝ", e285bd), +_c(U+217E, "โ
พ", e285be), +_c(U+217F, "โ
ฟ", e285bf), +_c(U+2180, "โ", e28680), +_c(U+2181, "โ", e28681), +_c(U+2182, "โ", e28682), +_c(U+2183, "โ", e28683), +_c(U+2184, "โ", e28684), +_c(U+2185, "โ
", e28685), +_c(U+2186, "โ", e28686), +_c(U+2187, "โ", e28687), +_c(U+2188, "โ", e28688), +_c(U+2189, "โ", e28689), +_c(U+218A, "โ", e2868a), +_c(U+218B, "โ", e2868b), +_c(U+218C, "โ", e2868c), +_c(U+218D, "โ", e2868d), +_c(U+218E, "โ", e2868e), +_c(U+218F, "โ", e2868f), +_c(U+2190, "โ", e28690), +_c(U+2191, "โ", e28691), +_c(U+2192, "โ", e28692), +_c(U+2193, "โ", e28693), +_c(U+2194, "โ", e28694), +_c(U+2195, "โ", e28695), +_c(U+2196, "โ", e28696), +_c(U+2197, "โ", e28697), +_c(U+2198, "โ", e28698), +_c(U+2199, "โ", e28699), +_c(U+219A, "โ", e2869a), +_c(U+219B, "โ", e2869b), +_c(U+219C, "โ", e2869c), +_c(U+219D, "โ", e2869d), +_c(U+219E, "โ", e2869e), +_c(U+219F, "โ", e2869f), +_c(U+21A0, "โ ", e286a0), +_c(U+21A1, "โก", e286a1), +_c(U+21A2, "โข", e286a2), +_c(U+21A3, "โฃ", e286a3), +_c(U+21A4, "โค", e286a4), +_c(U+21A5, "โฅ", e286a5), +_c(U+21A6, "โฆ", e286a6), +_c(U+21A7, "โง", e286a7), +_c(U+21A8, "โจ", e286a8), +_c(U+21A9, "โฉ", e286a9), +_c(U+21AA, "โช", e286aa), +_c(U+21AB, "โซ", e286ab), +_c(U+21AC, "โฌ", e286ac), +_c(U+21AD, "โญ", e286ad), +_c(U+21AE, "โฎ", e286ae), +_c(U+21AF, "โฏ", e286af), +_c(U+21B0, "โฐ", e286b0), +_c(U+21B1, "โฑ", e286b1), +_c(U+21B2, "โฒ", e286b2), +_c(U+21B3, "โณ", e286b3), +_c(U+21B4, "โด", e286b4), +_c(U+21B5, "โต", e286b5), +_c(U+21B6, "โถ", e286b6), +_c(U+21B7, "โท", e286b7), +_c(U+21B8, "โธ", e286b8), +_c(U+21B9, "โน", e286b9), +_c(U+21BA, "โบ", e286ba), +_c(U+21BB, "โป", e286bb), +_c(U+21BC, "โผ", e286bc), +_c(U+21BD, "โฝ", e286bd), +_c(U+21BE, "โพ", e286be), +_c(U+21BF, "โฟ", e286bf), +_c(U+21C0, "โ", e28780), +_c(U+21C1, "โ", e28781), +_c(U+21C2, "โ", e28782), +_c(U+21C3, "โ", e28783), +_c(U+21C4, "โ", e28784), +_c(U+21C5, "โ
", e28785), +_c(U+21C6, "โ", e28786), +_c(U+21C7, "โ", e28787), +_c(U+21C8, "โ", e28788), +_c(U+21C9, "โ", e28789), +_c(U+21CA, "โ", e2878a), +_c(U+21CB, "โ", e2878b), +_c(U+21CC, "โ", e2878c), +_c(U+21CD, "โ", e2878d), +_c(U+21CE, "โ", e2878e), +_c(U+21CF, "โ", e2878f), +_c(U+21D0, "โ", e28790), +_c(U+21D1, "โ", e28791), +_c(U+21D2, "โ", e28792), +_c(U+21D3, "โ", e28793), +_c(U+21D4, "โ", e28794), +_c(U+21D5, "โ", e28795), +_c(U+21D6, "โ", e28796), +_c(U+21D7, "โ", e28797), +_c(U+21D8, "โ", e28798), +_c(U+21D9, "โ", e28799), +_c(U+21DA, "โ", e2879a), +_c(U+21DB, "โ", e2879b), +_c(U+21DC, "โ", e2879c), +_c(U+21DD, "โ", e2879d), +_c(U+21DE, "โ", e2879e), +_c(U+21DF, "โ", e2879f), +_c(U+21E0, "โ ", e287a0), +_c(U+21E1, "โก", e287a1), +_c(U+21E2, "โข", e287a2), +_c(U+21E3, "โฃ", e287a3), +_c(U+21E4, "โค", e287a4), +_c(U+21E5, "โฅ", e287a5), +_c(U+21E6, "โฆ", e287a6), +_c(U+21E7, "โง", e287a7), +_c(U+21E8, "โจ", e287a8), +_c(U+21E9, "โฉ", e287a9), +_c(U+21EA, "โช", e287aa), +_c(U+21EB, "โซ", e287ab), +_c(U+21EC, "โฌ", e287ac), +_c(U+21ED, "โญ", e287ad), +_c(U+21EE, "โฎ", e287ae), +_c(U+21EF, "โฏ", e287af), +_c(U+21F0, "โฐ", e287b0), +_c(U+21F1, "โฑ", e287b1), +_c(U+21F2, "โฒ", e287b2), +_c(U+21F3, "โณ", e287b3), +_c(U+21F4, "โด", e287b4), +_c(U+21F5, "โต", e287b5), +_c(U+21F6, "โถ", e287b6), +_c(U+21F7, "โท", e287b7), +_c(U+21F8, "โธ", e287b8), +_c(U+21F9, "โน", e287b9), +_c(U+21FA, "โบ", e287ba), +_c(U+21FB, "โป", e287bb), +_c(U+21FC, "โผ", e287bc), +_c(U+21FD, "โฝ", e287bd), +_c(U+21FE, "โพ", e287be), +_c(U+21FF, "โฟ", e287bf), +_c(U+2200, "โ", e28880), +_c(U+2201, "โ", e28881), +_c(U+2202, "โ", e28882), +_c(U+2203, "โ", e28883), +_c(U+2204, "โ", e28884), +_c(U+2205, "โ
", e28885), +_c(U+2206, "โ", e28886), +_c(U+2207, "โ", e28887), +_c(U+2208, "โ", e28888), +_c(U+2209, "โ", e28889), +_c(U+220A, "โ", e2888a), +_c(U+220B, "โ", e2888b), +_c(U+220C, "โ", e2888c), +_c(U+220D, "โ", e2888d), +_c(U+220E, "โ", e2888e), +_c(U+220F, "โ", e2888f), +_c(U+2210, "โ", e28890), +_c(U+2211, "โ", e28891), +_c(U+2212, "โ", e28892), +_c(U+2213, "โ", e28893), +_c(U+2214, "โ", e28894), +_c(U+2215, "โ", e28895), +_c(U+2216, "โ", e28896), +_c(U+2217, "โ", e28897), +_c(U+2218, "โ", e28898), +_c(U+2219, "โ", e28899), +_c(U+221A, "โ", e2889a), +_c(U+221B, "โ", e2889b), +_c(U+221C, "โ", e2889c), +_c(U+221D, "โ", e2889d), +_c(U+221E, "โ", e2889e), +_c(U+221F, "โ", e2889f), +_c(U+2220, "โ ", e288a0), +_c(U+2221, "โก", e288a1), +_c(U+2222, "โข", e288a2), +_c(U+2223, "โฃ", e288a3), +_c(U+2224, "โค", e288a4), +_c(U+2225, "โฅ", e288a5), +_c(U+2226, "โฆ", e288a6), +_c(U+2227, "โง", e288a7), +_c(U+2228, "โจ", e288a8), +_c(U+2229, "โฉ", e288a9), +_c(U+222A, "โช", e288aa), +_c(U+222B, "โซ", e288ab), +_c(U+222C, "โฌ", e288ac), +_c(U+222D, "โญ", e288ad), +_c(U+222E, "โฎ", e288ae), +_c(U+222F, "โฏ", e288af), +_c(U+2230, "โฐ", e288b0), +_c(U+2231, "โฑ", e288b1), +_c(U+2232, "โฒ", e288b2), +_c(U+2233, "โณ", e288b3), +_c(U+2234, "โด", e288b4), +_c(U+2235, "โต", e288b5), +_c(U+2236, "โถ", e288b6), +_c(U+2237, "โท", e288b7), +_c(U+2238, "โธ", e288b8), +_c(U+2239, "โน", e288b9), +_c(U+223A, "โบ", e288ba), +_c(U+223B, "โป", e288bb), +_c(U+223C, "โผ", e288bc), +_c(U+223D, "โฝ", e288bd), +_c(U+223E, "โพ", e288be), +_c(U+223F, "โฟ", e288bf), +_c(U+2240, "โ", e28980), +_c(U+2241, "โ", e28981), +_c(U+2242, "โ", e28982), +_c(U+2243, "โ", e28983), +_c(U+2244, "โ", e28984), +_c(U+2245, "โ
", e28985), +_c(U+2246, "โ", e28986), +_c(U+2247, "โ", e28987), +_c(U+2248, "โ", e28988), +_c(U+2249, "โ", e28989), +_c(U+224A, "โ", e2898a), +_c(U+224B, "โ", e2898b), +_c(U+224C, "โ", e2898c), +_c(U+224D, "โ", e2898d), +_c(U+224E, "โ", e2898e), +_c(U+224F, "โ", e2898f), +_c(U+2250, "โ", e28990), +_c(U+2251, "โ", e28991), +_c(U+2252, "โ", e28992), +_c(U+2253, "โ", e28993), +_c(U+2254, "โ", e28994), +_c(U+2255, "โ", e28995), +_c(U+2256, "โ", e28996), +_c(U+2257, "โ", e28997), +_c(U+2258, "โ", e28998), +_c(U+2259, "โ", e28999), +_c(U+225A, "โ", e2899a), +_c(U+225B, "โ", e2899b), +_c(U+225C, "โ", e2899c), +_c(U+225D, "โ", e2899d), +_c(U+225E, "โ", e2899e), +_c(U+225F, "โ", e2899f), +_c(U+2260, "โ ", e289a0), +_c(U+2261, "โก", e289a1), +_c(U+2262, "โข", e289a2), +_c(U+2263, "โฃ", e289a3), +_c(U+2264, "โค", e289a4), +_c(U+2265, "โฅ", e289a5), +_c(U+2266, "โฆ", e289a6), +_c(U+2267, "โง", e289a7), +_c(U+2268, "โจ", e289a8), +_c(U+2269, "โฉ", e289a9), +_c(U+226A, "โช", e289aa), +_c(U+226B, "โซ", e289ab), +_c(U+226C, "โฌ", e289ac), +_c(U+226D, "โญ", e289ad), +_c(U+226E, "โฎ", e289ae), +_c(U+226F, "โฏ", e289af), +_c(U+2270, "โฐ", e289b0), +_c(U+2271, "โฑ", e289b1), +_c(U+2272, "โฒ", e289b2), +_c(U+2273, "โณ", e289b3), +_c(U+2274, "โด", e289b4), +_c(U+2275, "โต", e289b5), +_c(U+2276, "โถ", e289b6), +_c(U+2277, "โท", e289b7), +_c(U+2278, "โธ", e289b8), +_c(U+2279, "โน", e289b9), +_c(U+227A, "โบ", e289ba), +_c(U+227B, "โป", e289bb), +_c(U+227C, "โผ", e289bc), +_c(U+227D, "โฝ", e289bd), +_c(U+227E, "โพ", e289be), +_c(U+227F, "โฟ", e289bf), +_c(U+2280, "โ", e28a80), +_c(U+2281, "โ", e28a81), +_c(U+2282, "โ", e28a82), +_c(U+2283, "โ", e28a83), +_c(U+2284, "โ", e28a84), +_c(U+2285, "โ
", e28a85), +_c(U+2286, "โ", e28a86), +_c(U+2287, "โ", e28a87), +_c(U+2288, "โ", e28a88), +_c(U+2289, "โ", e28a89), +_c(U+228A, "โ", e28a8a), +_c(U+228B, "โ", e28a8b), +_c(U+228C, "โ", e28a8c), +_c(U+228D, "โ", e28a8d), +_c(U+228E, "โ", e28a8e), +_c(U+228F, "โ", e28a8f), +_c(U+2290, "โ", e28a90), +_c(U+2291, "โ", e28a91), +_c(U+2292, "โ", e28a92), +_c(U+2293, "โ", e28a93), +_c(U+2294, "โ", e28a94), +_c(U+2295, "โ", e28a95), +_c(U+2296, "โ", e28a96), +_c(U+2297, "โ", e28a97), +_c(U+2298, "โ", e28a98), +_c(U+2299, "โ", e28a99), +_c(U+229A, "โ", e28a9a), +_c(U+229B, "โ", e28a9b), +_c(U+229C, "โ", e28a9c), +_c(U+229D, "โ", e28a9d), +_c(U+229E, "โ", e28a9e), +_c(U+229F, "โ", e28a9f), +_c(U+22A0, "โ ", e28aa0), +_c(U+22A1, "โก", e28aa1), +_c(U+22A2, "โข", e28aa2), +_c(U+22A3, "โฃ", e28aa3), +_c(U+22A4, "โค", e28aa4), +_c(U+22A5, "โฅ", e28aa5), +_c(U+22A6, "โฆ", e28aa6), +_c(U+22A7, "โง", e28aa7), +_c(U+22A8, "โจ", e28aa8), +_c(U+22A9, "โฉ", e28aa9), +_c(U+22AA, "โช", e28aaa), +_c(U+22AB, "โซ", e28aab), +_c(U+22AC, "โฌ", e28aac), +_c(U+22AD, "โญ", e28aad), +_c(U+22AE, "โฎ", e28aae), +_c(U+22AF, "โฏ", e28aaf), +_c(U+22B0, "โฐ", e28ab0), +_c(U+22B1, "โฑ", e28ab1), +_c(U+22B2, "โฒ", e28ab2), +_c(U+22B3, "โณ", e28ab3), +_c(U+22B4, "โด", e28ab4), +_c(U+22B5, "โต", e28ab5), +_c(U+22B6, "โถ", e28ab6), +_c(U+22B7, "โท", e28ab7), +_c(U+22B8, "โธ", e28ab8), +_c(U+22B9, "โน", e28ab9), +_c(U+22BA, "โบ", e28aba), +_c(U+22BB, "โป", e28abb), +_c(U+22BC, "โผ", e28abc), +_c(U+22BD, "โฝ", e28abd), +_c(U+22BE, "โพ", e28abe), +_c(U+22BF, "โฟ", e28abf), +_c(U+22C0, "โ", e28b80), +_c(U+22C1, "โ", e28b81), +_c(U+22C2, "โ", e28b82), +_c(U+22C3, "โ", e28b83), +_c(U+22C4, "โ", e28b84), +_c(U+22C5, "โ
", e28b85), +_c(U+22C6, "โ", e28b86), +_c(U+22C7, "โ", e28b87), +_c(U+22C8, "โ", e28b88), +_c(U+22C9, "โ", e28b89), +_c(U+22CA, "โ", e28b8a), +_c(U+22CB, "โ", e28b8b), +_c(U+22CC, "โ", e28b8c), +_c(U+22CD, "โ", e28b8d), +_c(U+22CE, "โ", e28b8e), +_c(U+22CF, "โ", e28b8f), +_c(U+22D0, "โ", e28b90), +_c(U+22D1, "โ", e28b91), +_c(U+22D2, "โ", e28b92), +_c(U+22D3, "โ", e28b93), +_c(U+22D4, "โ", e28b94), +_c(U+22D5, "โ", e28b95), +_c(U+22D6, "โ", e28b96), +_c(U+22D7, "โ", e28b97), +_c(U+22D8, "โ", e28b98), +_c(U+22D9, "โ", e28b99), +_c(U+22DA, "โ", e28b9a), +_c(U+22DB, "โ", e28b9b), +_c(U+22DC, "โ", e28b9c), +_c(U+22DD, "โ", e28b9d), +_c(U+22DE, "โ", e28b9e), +_c(U+22DF, "โ", e28b9f), +_c(U+22E0, "โ ", e28ba0), +_c(U+22E1, "โก", e28ba1), +_c(U+22E2, "โข", e28ba2), +_c(U+22E3, "โฃ", e28ba3), +_c(U+22E4, "โค", e28ba4), +_c(U+22E5, "โฅ", e28ba5), +_c(U+22E6, "โฆ", e28ba6), +_c(U+22E7, "โง", e28ba7), +_c(U+22E8, "โจ", e28ba8), +_c(U+22E9, "โฉ", e28ba9), +_c(U+22EA, "โช", e28baa), +_c(U+22EB, "โซ", e28bab), +_c(U+22EC, "โฌ", e28bac), +_c(U+22ED, "โญ", e28bad), +_c(U+22EE, "โฎ", e28bae), +_c(U+22EF, "โฏ", e28baf), +_c(U+22F0, "โฐ", e28bb0), +_c(U+22F1, "โฑ", e28bb1), +_c(U+22F2, "โฒ", e28bb2), +_c(U+22F3, "โณ", e28bb3), +_c(U+22F4, "โด", e28bb4), +_c(U+22F5, "โต", e28bb5), +_c(U+22F6, "โถ", e28bb6), +_c(U+22F7, "โท", e28bb7), +_c(U+22F8, "โธ", e28bb8), +_c(U+22F9, "โน", e28bb9), +_c(U+22FA, "โบ", e28bba), +_c(U+22FB, "โป", e28bbb), +_c(U+22FC, "โผ", e28bbc), +_c(U+22FD, "โฝ", e28bbd), +_c(U+22FE, "โพ", e28bbe), +_c(U+22FF, "โฟ", e28bbf), +_c(U+2300, "โ", e28c80), +_c(U+2301, "โ", e28c81), +_c(U+2302, "โ", e28c82), +_c(U+2303, "โ", e28c83), +_c(U+2304, "โ", e28c84), +_c(U+2305, "โ
", e28c85), +_c(U+2306, "โ", e28c86), +_c(U+2307, "โ", e28c87), +_c(U+2308, "โ", e28c88), +_c(U+2309, "โ", e28c89), +_c(U+230A, "โ", e28c8a), +_c(U+230B, "โ", e28c8b), +_c(U+230C, "โ", e28c8c), +_c(U+230D, "โ", e28c8d), +_c(U+230E, "โ", e28c8e), +_c(U+230F, "โ", e28c8f), +_c(U+2310, "โ", e28c90), +_c(U+2311, "โ", e28c91), +_c(U+2312, "โ", e28c92), +_c(U+2313, "โ", e28c93), +_c(U+2314, "โ", e28c94), +_c(U+2315, "โ", e28c95), +_c(U+2316, "โ", e28c96), +_c(U+2317, "โ", e28c97), +_c(U+2318, "โ", e28c98), +_c(U+2319, "โ", e28c99), +_c(U+231A, "โ", e28c9a), +_c(U+231B, "โ", e28c9b), +_c(U+231C, "โ", e28c9c), +_c(U+231D, "โ", e28c9d), +_c(U+231E, "โ", e28c9e), +_c(U+231F, "โ", e28c9f), +_c(U+2320, "โ ", e28ca0), +_c(U+2321, "โก", e28ca1), +_c(U+2322, "โข", e28ca2), +_c(U+2323, "โฃ", e28ca3), +_c(U+2324, "โค", e28ca4), +_c(U+2325, "โฅ", e28ca5), +_c(U+2326, "โฆ", e28ca6), +_c(U+2327, "โง", e28ca7), +_c(U+2328, "โจ", e28ca8), +_c(U+2329, "โฉ", e28ca9), +_c(U+232A, "โช", e28caa), +_c(U+232B, "โซ", e28cab), +_c(U+232C, "โฌ", e28cac), +_c(U+232D, "โญ", e28cad), +_c(U+232E, "โฎ", e28cae), +_c(U+232F, "โฏ", e28caf), +_c(U+2330, "โฐ", e28cb0), +_c(U+2331, "โฑ", e28cb1), +_c(U+2332, "โฒ", e28cb2), +_c(U+2333, "โณ", e28cb3), +_c(U+2334, "โด", e28cb4), +_c(U+2335, "โต", e28cb5), +_c(U+2336, "โถ", e28cb6), +_c(U+2337, "โท", e28cb7), +_c(U+2338, "โธ", e28cb8), +_c(U+2339, "โน", e28cb9), +_c(U+233A, "โบ", e28cba), +_c(U+233B, "โป", e28cbb), +_c(U+233C, "โผ", e28cbc), +_c(U+233D, "โฝ", e28cbd), +_c(U+233E, "โพ", e28cbe), +_c(U+233F, "โฟ", e28cbf), +_c(U+2340, "โ", e28d80), +_c(U+2341, "โ", e28d81), +_c(U+2342, "โ", e28d82), +_c(U+2343, "โ", e28d83), +_c(U+2344, "โ", e28d84), +_c(U+2345, "โ
", e28d85), +_c(U+2346, "โ", e28d86), +_c(U+2347, "โ", e28d87), +_c(U+2348, "โ", e28d88), +_c(U+2349, "โ", e28d89), +_c(U+234A, "โ", e28d8a), +_c(U+234B, "โ", e28d8b), +_c(U+234C, "โ", e28d8c), +_c(U+234D, "โ", e28d8d), +_c(U+234E, "โ", e28d8e), +_c(U+234F, "โ", e28d8f), +_c(U+2350, "โ", e28d90), +_c(U+2351, "โ", e28d91), +_c(U+2352, "โ", e28d92), +_c(U+2353, "โ", e28d93), +_c(U+2354, "โ", e28d94), +_c(U+2355, "โ", e28d95), +_c(U+2356, "โ", e28d96), +_c(U+2357, "โ", e28d97), +_c(U+2358, "โ", e28d98), +_c(U+2359, "โ", e28d99), +_c(U+235A, "โ", e28d9a), +_c(U+235B, "โ", e28d9b), +_c(U+235C, "โ", e28d9c), +_c(U+235D, "โ", e28d9d), +_c(U+235E, "โ", e28d9e), +_c(U+235F, "โ", e28d9f), +_c(U+2360, "โ ", e28da0), +_c(U+2361, "โก", e28da1), +_c(U+2362, "โข", e28da2), +_c(U+2363, "โฃ", e28da3), +_c(U+2364, "โค", e28da4), +_c(U+2365, "โฅ", e28da5), +_c(U+2366, "โฆ", e28da6), +_c(U+2367, "โง", e28da7), +_c(U+2368, "โจ", e28da8), +_c(U+2369, "โฉ", e28da9), +_c(U+236A, "โช", e28daa), +_c(U+236B, "โซ", e28dab), +_c(U+236C, "โฌ", e28dac), +_c(U+236D, "โญ", e28dad), +_c(U+236E, "โฎ", e28dae), +_c(U+236F, "โฏ", e28daf), +_c(U+2370, "โฐ", e28db0), +_c(U+2371, "โฑ", e28db1), +_c(U+2372, "โฒ", e28db2), +_c(U+2373, "โณ", e28db3), +_c(U+2374, "โด", e28db4), +_c(U+2375, "โต", e28db5), +_c(U+2376, "โถ", e28db6), +_c(U+2377, "โท", e28db7), +_c(U+2378, "โธ", e28db8), +_c(U+2379, "โน", e28db9), +_c(U+237A, "โบ", e28dba), +_c(U+237B, "โป", e28dbb), +_c(U+237C, "โผ", e28dbc), +_c(U+237D, "โฝ", e28dbd), +_c(U+237E, "โพ", e28dbe), +_c(U+237F, "โฟ", e28dbf), +_c(U+2380, "โ", e28e80), +_c(U+2381, "โ", e28e81), +_c(U+2382, "โ", e28e82), +_c(U+2383, "โ", e28e83), +_c(U+2384, "โ", e28e84), +_c(U+2385, "โ
", e28e85), +_c(U+2386, "โ", e28e86), +_c(U+2387, "โ", e28e87), +_c(U+2388, "โ", e28e88), +_c(U+2389, "โ", e28e89), +_c(U+238A, "โ", e28e8a), +_c(U+238B, "โ", e28e8b), +_c(U+238C, "โ", e28e8c), +_c(U+238D, "โ", e28e8d), +_c(U+238E, "โ", e28e8e), +_c(U+238F, "โ", e28e8f), +_c(U+2390, "โ", e28e90), +_c(U+2391, "โ", e28e91), +_c(U+2392, "โ", e28e92), +_c(U+2393, "โ", e28e93), +_c(U+2394, "โ", e28e94), +_c(U+2395, "โ", e28e95), +_c(U+2396, "โ", e28e96), +_c(U+2397, "โ", e28e97), +_c(U+2398, "โ", e28e98), +_c(U+2399, "โ", e28e99), +_c(U+239A, "โ", e28e9a), +_c(U+239B, "โ", e28e9b), +_c(U+239C, "โ", e28e9c), +_c(U+239D, "โ", e28e9d), +_c(U+239E, "โ", e28e9e), +_c(U+239F, "โ", e28e9f), +_c(U+23A0, "โ ", e28ea0), +_c(U+23A1, "โก", e28ea1), +_c(U+23A2, "โข", e28ea2), +_c(U+23A3, "โฃ", e28ea3), +_c(U+23A4, "โค", e28ea4), +_c(U+23A5, "โฅ", e28ea5), +_c(U+23A6, "โฆ", e28ea6), +_c(U+23A7, "โง", e28ea7), +_c(U+23A8, "โจ", e28ea8), +_c(U+23A9, "โฉ", e28ea9), +_c(U+23AA, "โช", e28eaa), +_c(U+23AB, "โซ", e28eab), +_c(U+23AC, "โฌ", e28eac), +_c(U+23AD, "โญ", e28ead), +_c(U+23AE, "โฎ", e28eae), +_c(U+23AF, "โฏ", e28eaf), +_c(U+23B0, "โฐ", e28eb0), +_c(U+23B1, "โฑ", e28eb1), +_c(U+23B2, "โฒ", e28eb2), +_c(U+23B3, "โณ", e28eb3), +_c(U+23B4, "โด", e28eb4), +_c(U+23B5, "โต", e28eb5), +_c(U+23B6, "โถ", e28eb6), +_c(U+23B7, "โท", e28eb7), +_c(U+23B8, "โธ", e28eb8), +_c(U+23B9, "โน", e28eb9), +_c(U+23BA, "โบ", e28eba), +_c(U+23BB, "โป", e28ebb), +_c(U+23BC, "โผ", e28ebc), +_c(U+23BD, "โฝ", e28ebd), +_c(U+23BE, "โพ", e28ebe), +_c(U+23BF, "โฟ", e28ebf), +_c(U+23C0, "โ", e28f80), +_c(U+23C1, "โ", e28f81), +_c(U+23C2, "โ", e28f82), +_c(U+23C3, "โ", e28f83), +_c(U+23C4, "โ", e28f84), +_c(U+23C5, "โ
", e28f85), +_c(U+23C6, "โ", e28f86), +_c(U+23C7, "โ", e28f87), +_c(U+23C8, "โ", e28f88), +_c(U+23C9, "โ", e28f89), +_c(U+23CA, "โ", e28f8a), +_c(U+23CB, "โ", e28f8b), +_c(U+23CC, "โ", e28f8c), +_c(U+23CD, "โ", e28f8d), +_c(U+23CE, "โ", e28f8e), +_c(U+23CF, "โ", e28f8f), +_c(U+23D0, "โ", e28f90), +_c(U+23D1, "โ", e28f91), +_c(U+23D2, "โ", e28f92), +_c(U+23D3, "โ", e28f93), +_c(U+23D4, "โ", e28f94), +_c(U+23D5, "โ", e28f95), +_c(U+23D6, "โ", e28f96), +_c(U+23D7, "โ", e28f97), +_c(U+23D8, "โ", e28f98), +_c(U+23D9, "โ", e28f99), +_c(U+23DA, "โ", e28f9a), +_c(U+23DB, "โ", e28f9b), +_c(U+23DC, "โ", e28f9c), +_c(U+23DD, "โ", e28f9d), +_c(U+23DE, "โ", e28f9e), +_c(U+23DF, "โ", e28f9f), +_c(U+23E0, "โ ", e28fa0), +_c(U+23E1, "โก", e28fa1), +_c(U+23E2, "โข", e28fa2), +_c(U+23E3, "โฃ", e28fa3), +_c(U+23E4, "โค", e28fa4), +_c(U+23E5, "โฅ", e28fa5), +_c(U+23E6, "โฆ", e28fa6), +_c(U+23E7, "โง", e28fa7), +_c(U+23E8, "โจ", e28fa8), +_c(U+23E9, "โฉ", e28fa9), +_c(U+23EA, "โช", e28faa), +_c(U+23EB, "โซ", e28fab), +_c(U+23EC, "โฌ", e28fac), +_c(U+23ED, "โญ", e28fad), +_c(U+23EE, "โฎ", e28fae), +_c(U+23EF, "โฏ", e28faf), +_c(U+23F0, "โฐ", e28fb0), +_c(U+23F1, "โฑ", e28fb1), +_c(U+23F2, "โฒ", e28fb2), +_c(U+23F3, "โณ", e28fb3), +_c(U+23F4, "โด", e28fb4), +_c(U+23F5, "โต", e28fb5), +_c(U+23F6, "โถ", e28fb6), +_c(U+23F7, "โท", e28fb7), +_c(U+23F8, "โธ", e28fb8), +_c(U+23F9, "โน", e28fb9), +_c(U+23FA, "โบ", e28fba), +_c(U+23FB, "โป", e28fbb), +_c(U+23FC, "โผ", e28fbc), +_c(U+23FD, "โฝ", e28fbd), +_c(U+23FE, "โพ", e28fbe), +_c(U+23FF, "โฟ", e28fbf), +_c(U+2400, "โ", e29080), +_c(U+2401, "โ", e29081), +_c(U+2402, "โ", e29082), +_c(U+2403, "โ", e29083), +_c(U+2404, "โ", e29084), +_c(U+2405, "โ
", e29085), +_c(U+2406, "โ", e29086), +_c(U+2407, "โ", e29087), +_c(U+2408, "โ", e29088), +_c(U+2409, "โ", e29089), +_c(U+240A, "โ", e2908a), +_c(U+240B, "โ", e2908b), +_c(U+240C, "โ", e2908c), +_c(U+240D, "โ", e2908d), +_c(U+240E, "โ", e2908e), +_c(U+240F, "โ", e2908f), +_c(U+2410, "โ", e29090), +_c(U+2411, "โ", e29091), +_c(U+2412, "โ", e29092), +_c(U+2413, "โ", e29093), +_c(U+2414, "โ", e29094), +_c(U+2415, "โ", e29095), +_c(U+2416, "โ", e29096), +_c(U+2417, "โ", e29097), +_c(U+2418, "โ", e29098), +_c(U+2419, "โ", e29099), +_c(U+241A, "โ", e2909a), +_c(U+241B, "โ", e2909b), +_c(U+241C, "โ", e2909c), +_c(U+241D, "โ", e2909d), +_c(U+241E, "โ", e2909e), +_c(U+241F, "โ", e2909f), +_c(U+2420, "โ ", e290a0), +_c(U+2421, "โก", e290a1), +_c(U+2422, "โข", e290a2), +_c(U+2423, "โฃ", e290a3), +_c(U+2424, "โค", e290a4), +_c(U+2425, "โฅ", e290a5), +_c(U+2426, "โฆ", e290a6), +_c(U+2427, "โง", e290a7), +_c(U+2428, "โจ", e290a8), +_c(U+2429, "โฉ", e290a9), +_c(U+242A, "โช", e290aa), +_c(U+242B, "โซ", e290ab), +_c(U+242C, "โฌ", e290ac), +_c(U+242D, "โญ", e290ad), +_c(U+242E, "โฎ", e290ae), +_c(U+242F, "โฏ", e290af), +_c(U+2430, "โฐ", e290b0), +_c(U+2431, "โฑ", e290b1), +_c(U+2432, "โฒ", e290b2), +_c(U+2433, "โณ", e290b3), +_c(U+2434, "โด", e290b4), +_c(U+2435, "โต", e290b5), +_c(U+2436, "โถ", e290b6), +_c(U+2437, "โท", e290b7), +_c(U+2438, "โธ", e290b8), +_c(U+2439, "โน", e290b9), +_c(U+243A, "โบ", e290ba), +_c(U+243B, "โป", e290bb), +_c(U+243C, "โผ", e290bc), +_c(U+243D, "โฝ", e290bd), +_c(U+243E, "โพ", e290be), +_c(U+243F, "โฟ", e290bf), +_c(U+2440, "โ", e29180), +_c(U+2441, "โ", e29181), +_c(U+2442, "โ", e29182), +_c(U+2443, "โ", e29183), +_c(U+2444, "โ", e29184), +_c(U+2445, "โ
", e29185), +_c(U+2446, "โ", e29186), +_c(U+2447, "โ", e29187), +_c(U+2448, "โ", e29188), +_c(U+2449, "โ", e29189), +_c(U+244A, "โ", e2918a), +_c(U+244B, "โ", e2918b), +_c(U+244C, "โ", e2918c), +_c(U+244D, "โ", e2918d), +_c(U+244E, "โ", e2918e), +_c(U+244F, "โ", e2918f), +_c(U+2450, "โ", e29190), +_c(U+2451, "โ", e29191), +_c(U+2452, "โ", e29192), +_c(U+2453, "โ", e29193), +_c(U+2454, "โ", e29194), +_c(U+2455, "โ", e29195), +_c(U+2456, "โ", e29196), +_c(U+2457, "โ", e29197), +_c(U+2458, "โ", e29198), +_c(U+2459, "โ", e29199), +_c(U+245A, "โ", e2919a), +_c(U+245B, "โ", e2919b), +_c(U+245C, "โ", e2919c), +_c(U+245D, "โ", e2919d), +_c(U+245E, "โ", e2919e), +_c(U+245F, "โ", e2919f), +_c(U+2460, "โ ", e291a0), +_c(U+2461, "โก", e291a1), +_c(U+2462, "โข", e291a2), +_c(U+2463, "โฃ", e291a3), +_c(U+2464, "โค", e291a4), +_c(U+2465, "โฅ", e291a5), +_c(U+2466, "โฆ", e291a6), +_c(U+2467, "โง", e291a7), +_c(U+2468, "โจ", e291a8), +_c(U+2469, "โฉ", e291a9), +_c(U+246A, "โช", e291aa), +_c(U+246B, "โซ", e291ab), +_c(U+246C, "โฌ", e291ac), +_c(U+246D, "โญ", e291ad), +_c(U+246E, "โฎ", e291ae), +_c(U+246F, "โฏ", e291af), +_c(U+2470, "โฐ", e291b0), +_c(U+2471, "โฑ", e291b1), +_c(U+2472, "โฒ", e291b2), +_c(U+2473, "โณ", e291b3), +_c(U+2474, "โด", e291b4), +_c(U+2475, "โต", e291b5), +_c(U+2476, "โถ", e291b6), +_c(U+2477, "โท", e291b7), +_c(U+2478, "โธ", e291b8), +_c(U+2479, "โน", e291b9), +_c(U+247A, "โบ", e291ba), +_c(U+247B, "โป", e291bb), +_c(U+247C, "โผ", e291bc), +_c(U+247D, "โฝ", e291bd), +_c(U+247E, "โพ", e291be), +_c(U+247F, "โฟ", e291bf), +_c(U+2480, "โ", e29280), +_c(U+2481, "โ", e29281), +_c(U+2482, "โ", e29282), +_c(U+2483, "โ", e29283), +_c(U+2484, "โ", e29284), +_c(U+2485, "โ
", e29285), +_c(U+2486, "โ", e29286), +_c(U+2487, "โ", e29287), +_c(U+2488, "โ", e29288), +_c(U+2489, "โ", e29289), +_c(U+248A, "โ", e2928a), +_c(U+248B, "โ", e2928b), +_c(U+248C, "โ", e2928c), +_c(U+248D, "โ", e2928d), +_c(U+248E, "โ", e2928e), +_c(U+248F, "โ", e2928f), +_c(U+2490, "โ", e29290), +_c(U+2491, "โ", e29291), +_c(U+2492, "โ", e29292), +_c(U+2493, "โ", e29293), +_c(U+2494, "โ", e29294), +_c(U+2495, "โ", e29295), +_c(U+2496, "โ", e29296), +_c(U+2497, "โ", e29297), +_c(U+2498, "โ", e29298), +_c(U+2499, "โ", e29299), +_c(U+249A, "โ", e2929a), +_c(U+249B, "โ", e2929b), +_c(U+249C, "โ", e2929c), +_c(U+249D, "โ", e2929d), +_c(U+249E, "โ", e2929e), +_c(U+249F, "โ", e2929f), +_c(U+2601, "โ", e29881), +_c(U+2602, "โ", e29882), +_c(U+2603, "โ", e29883), +_c(U+2604, "โ", e29884), +_c(U+2605, "โ
", e29885), +_c(U+2606, "โ", e29886), +_c(U+2607, "โ", e29887), +_c(U+2608, "โ", e29888), +_c(U+2609, "โ", e29889), +_c(U+260A, "โ", e2988a), +_c(U+260B, "โ", e2988b), +_c(U+260C, "โ", e2988c), +_c(U+260D, "โ", e2988d), +_c(U+260E, "โ", e2988e), +_c(U+260F, "โ", e2988f), +_c(U+2610, "โ", e29890), +_c(U+2611, "โ", e29891), +_c(U+2612, "โ", e29892), +_c(U+2613, "โ", e29893), +_c(U+2614, "โ", e29894), +_c(U+2615, "โ", e29895), +_c(U+2616, "โ", e29896), +_c(U+2617, "โ", e29897), +_c(U+2618, "โ", e29898), +_c(U+2619, "โ", e29899), +_c(U+261A, "โ", e2989a), +_c(U+261B, "โ", e2989b), +_c(U+261C, "โ", e2989c), +_c(U+261D, "โ", e2989d), +_c(U+261E, "โ", e2989e), +_c(U+261F, "โ", e2989f), +_c(U+2620, "โ ", e298a0), +_c(U+2621, "โก", e298a1), +_c(U+2622, "โข", e298a2), +_c(U+2623, "โฃ", e298a3), +_c(U+2624, "โค", e298a4), +_c(U+2625, "โฅ", e298a5), +_c(U+2626, "โฆ", e298a6), +_c(U+2627, "โง", e298a7), +_c(U+2628, "โจ", e298a8), +_c(U+2629, "โฉ", e298a9), +_c(U+262A, "โช", e298aa), +_c(U+262B, "โซ", e298ab), +_c(U+262C, "โฌ", e298ac), +_c(U+262D, "โญ", e298ad), +_c(U+262E, "โฎ", e298ae), +_c(U+262F, "โฏ", e298af), +_c(U+2630, "โฐ", e298b0), +_c(U+2631, "โฑ", e298b1), +_c(U+2632, "โฒ", e298b2), +_c(U+2633, "โณ", e298b3), +_c(U+2634, "โด", e298b4), +_c(U+2635, "โต", e298b5), +_c(U+2636, "โถ", e298b6), +_c(U+2637, "โท", e298b7), +_c(U+2638, "โธ", e298b8), +_c(U+2639, "โน", e298b9), +_c(U+263A, "โบ", e298ba), +_c(U+263B, "โป", e298bb), +_c(U+263C, "โผ", e298bc), +_c(U+263D, "โฝ", e298bd), +_c(U+263E, "โพ", e298be), +_c(U+263F, "โฟ", e298bf), +_c(U+2640, "โ", e29980), +_c(U+2641, "โ", e29981), +_c(U+2642, "โ", e29982), +_c(U+2643, "โ", e29983), +_c(U+2644, "โ", e29984), +_c(U+2645, "โ
", e29985), +_c(U+2646, "โ", e29986), +_c(U+2647, "โ", e29987), +_c(U+2648, "โ", e29988), +_c(U+2649, "โ", e29989), +_c(U+264A, "โ", e2998a), +_c(U+264B, "โ", e2998b), +_c(U+264C, "โ", e2998c), +_c(U+264D, "โ", e2998d), +_c(U+264E, "โ", e2998e), +_c(U+264F, "โ", e2998f), +_c(U+2650, "โ", e29990), +_c(U+2651, "โ", e29991), +_c(U+2652, "โ", e29992), +_c(U+2653, "โ", e29993), +_c(U+2654, "โ", e29994), +_c(U+2655, "โ", e29995), +_c(U+2656, "โ", e29996), +_c(U+2657, "โ", e29997), +_c(U+2658, "โ", e29998), +_c(U+2659, "โ", e29999), +_c(U+265A, "โ", e2999a), +_c(U+265B, "โ", e2999b), +_c(U+265C, "โ", e2999c), +_c(U+265D, "โ", e2999d), +_c(U+265E, "โ", e2999e), +_c(U+265F, "โ", e2999f), +_c(U+2660, "โ ", e299a0), +_c(U+2661, "โก", e299a1), +_c(U+2662, "โข", e299a2), +_c(U+2663, "โฃ", e299a3), +_c(U+2664, "โค", e299a4), +_c(U+2665, "โฅ", e299a5), +_c(U+2666, "โฆ", e299a6), +_c(U+2667, "โง", e299a7), +_c(U+2668, "โจ", e299a8), +_c(U+2669, "โฉ", e299a9), +_c(U+266A, "โช", e299aa), +_c(U+266B, "โซ", e299ab), +_c(U+266C, "โฌ", e299ac), +_c(U+266D, "โญ", e299ad), +_c(U+266E, "โฎ", e299ae), +_c(U+266F, "โฏ", e299af), +_c(U+2670, "โฐ", e299b0), +_c(U+2671, "โฑ", e299b1), +_c(U+2672, "โฒ", e299b2), +_c(U+2673, "โณ", e299b3), +_c(U+2674, "โด", e299b4), +_c(U+2675, "โต", e299b5), +_c(U+2676, "โถ", e299b6), +_c(U+2677, "โท", e299b7), +_c(U+2678, "โธ", e299b8), +_c(U+2679, "โน", e299b9), +_c(U+267A, "โบ", e299ba), +_c(U+267B, "โป", e299bb), +_c(U+267C, "โผ", e299bc), +_c(U+267D, "โฝ", e299bd), +_c(U+267E, "โพ", e299be), +_c(U+267F, "โฟ", e299bf), +_c(U+2680, "โ", e29a80), +_c(U+2681, "โ", e29a81), +_c(U+2682, "โ", e29a82), +_c(U+2683, "โ", e29a83), +_c(U+2684, "โ", e29a84), +_c(U+2685, "โ
", e29a85), +_c(U+2686, "โ", e29a86), +_c(U+2687, "โ", e29a87), +_c(U+2688, "โ", e29a88), +_c(U+2689, "โ", e29a89), +_c(U+268A, "โ", e29a8a), +_c(U+268B, "โ", e29a8b), +_c(U+268C, "โ", e29a8c), +_c(U+268D, "โ", e29a8d), +_c(U+268E, "โ", e29a8e), +_c(U+268F, "โ", e29a8f), +_c(U+2690, "โ", e29a90), +_c(U+2691, "โ", e29a91), +_c(U+2692, "โ", e29a92), +_c(U+2693, "โ", e29a93), +_c(U+2694, "โ", e29a94), +_c(U+2695, "โ", e29a95), +_c(U+2696, "โ", e29a96), +_c(U+2697, "โ", e29a97), +_c(U+2698, "โ", e29a98), +_c(U+2699, "โ", e29a99), +_c(U+269A, "โ", e29a9a), +_c(U+269B, "โ", e29a9b), +_c(U+269C, "โ", e29a9c), +_c(U+269D, "โ", e29a9d), +_c(U+269E, "โ", e29a9e), +_c(U+269F, "โ", e29a9f), +_c(U+26A0, "โ ", e29aa0), +_c(U+26A1, "โก", e29aa1), +_c(U+26A2, "โข", e29aa2), +_c(U+26A3, "โฃ", e29aa3), +_c(U+26A4, "โค", e29aa4), +_c(U+26A5, "โฅ", e29aa5), +_c(U+26A6, "โฆ", e29aa6), +_c(U+26A7, "โง", e29aa7), +_c(U+26A8, "โจ", e29aa8), +_c(U+26A9, "โฉ", e29aa9), +_c(U+26AA, "โช", e29aaa), +_c(U+26AB, "โซ", e29aab), +_c(U+26AC, "โฌ", e29aac), +_c(U+26AD, "โญ", e29aad), +_c(U+26AE, "โฎ", e29aae), +_c(U+26AF, "โฏ", e29aaf), +_c(U+26B0, "โฐ", e29ab0), +_c(U+26B1, "โฑ", e29ab1), +_c(U+26B2, "โฒ", e29ab2), +_c(U+26B3, "โณ", e29ab3), +_c(U+26B4, "โด", e29ab4), +_c(U+26B5, "โต", e29ab5), +_c(U+26B6, "โถ", e29ab6), +_c(U+26B7, "โท", e29ab7), +_c(U+26B8, "โธ", e29ab8), +_c(U+26B9, "โน", e29ab9), +_c(U+26BA, "โบ", e29aba), +_c(U+26BB, "โป", e29abb), +_c(U+26BC, "โผ", e29abc), +_c(U+26BD, "โฝ", e29abd), +_c(U+26BE, "โพ", e29abe), +_c(U+26BF, "โฟ", e29abf), +_c(U+26C0, "โ", e29b80), +_c(U+26C1, "โ", e29b81), +_c(U+26C2, "โ", e29b82), +_c(U+26C3, "โ", e29b83), +_c(U+26C4, "โ", e29b84), +_c(U+26C5, "โ
", e29b85), +_c(U+26C6, "โ", e29b86), +_c(U+26C7, "โ", e29b87), +_c(U+26C8, "โ", e29b88), +_c(U+26C9, "โ", e29b89), +_c(U+26CA, "โ", e29b8a), +_c(U+26CB, "โ", e29b8b), +_c(U+26CC, "โ", e29b8c), +_c(U+26CD, "โ", e29b8d), +_c(U+26CE, "โ", e29b8e), +_c(U+26CF, "โ", e29b8f), +_c(U+26D0, "โ", e29b90), +_c(U+26D1, "โ", e29b91), +_c(U+26D2, "โ", e29b92), +_c(U+26D3, "โ", e29b93), +_c(U+26D4, "โ", e29b94), +_c(U+26D5, "โ", e29b95), +_c(U+26D6, "โ", e29b96), +_c(U+26D7, "โ", e29b97), +_c(U+26D8, "โ", e29b98), +_c(U+26D9, "โ", e29b99), +_c(U+26DA, "โ", e29b9a), +_c(U+26DB, "โ", e29b9b), +_c(U+26DC, "โ", e29b9c), +_c(U+26DD, "โ", e29b9d), +_c(U+26DE, "โ", e29b9e), +_c(U+26DF, "โ", e29b9f), +_c(U+26E0, "โ ", e29ba0), +_c(U+26E1, "โก", e29ba1), +_c(U+26E2, "โข", e29ba2), +_c(U+26E3, "โฃ", e29ba3), +_c(U+26E4, "โค", e29ba4), +_c(U+26E5, "โฅ", e29ba5), +_c(U+26E6, "โฆ", e29ba6), +_c(U+26E7, "โง", e29ba7), +_c(U+26E8, "โจ", e29ba8), +_c(U+26E9, "โฉ", e29ba9), +_c(U+26EA, "โช", e29baa), +_c(U+26EB, "โซ", e29bab), +_c(U+26EC, "โฌ", e29bac), +_c(U+26ED, "โญ", e29bad), +_c(U+26EE, "โฎ", e29bae), +_c(U+26EF, "โฏ", e29baf), +_c(U+26F0, "โฐ", e29bb0), +_c(U+26F1, "โฑ", e29bb1), +_c(U+26F2, "โฒ", e29bb2), +_c(U+26F3, "โณ", e29bb3), +_c(U+26F4, "โด", e29bb4), +_c(U+26F5, "โต", e29bb5), +_c(U+26F6, "โถ", e29bb6), +_c(U+26F7, "โท", e29bb7), +_c(U+26F8, "โธ", e29bb8), +_c(U+26F9, "โน", e29bb9), +_c(U+26FA, "โบ", e29bba), +_c(U+26FB, "โป", e29bbb), +_c(U+26FC, "โผ", e29bbc), +_c(U+26FD, "โฝ", e29bbd), +_c(U+26FE, "โพ", e29bbe), +_c(U+26FF, "โฟ", e29bbf), +_c(U+2700, "โ", e29c80), +_c(U+2701, "โ", e29c81), +_c(U+2702, "โ", e29c82), +_c(U+2703, "โ", e29c83), +_c(U+2704, "โ", e29c84), +_c(U+2705, "โ
", e29c85), +_c(U+2706, "โ", e29c86), +_c(U+2707, "โ", e29c87), +_c(U+2708, "โ", e29c88), +_c(U+2709, "โ", e29c89), +_c(U+270A, "โ", e29c8a), +_c(U+270B, "โ", e29c8b), +_c(U+270C, "โ", e29c8c), +_c(U+270D, "โ", e29c8d), +_c(U+270E, "โ", e29c8e), +_c(U+270F, "โ", e29c8f), +_c(U+2710, "โ", e29c90), +_c(U+2711, "โ", e29c91), +_c(U+2712, "โ", e29c92), +_c(U+2713, "โ", e29c93), +_c(U+2714, "โ", e29c94), +_c(U+2715, "โ", e29c95), +_c(U+2716, "โ", e29c96), +_c(U+2717, "โ", e29c97), +_c(U+2718, "โ", e29c98), +_c(U+2719, "โ", e29c99), +_c(U+271A, "โ", e29c9a), +_c(U+271B, "โ", e29c9b), +_c(U+271C, "โ", e29c9c), +_c(U+271D, "โ", e29c9d), +_c(U+271E, "โ", e29c9e), +_c(U+271F, "โ", e29c9f), +_c(U+2720, "โ ", e29ca0), +_c(U+2721, "โก", e29ca1), +_c(U+2722, "โข", e29ca2), +_c(U+2723, "โฃ", e29ca3), +_c(U+2724, "โค", e29ca4), +_c(U+2725, "โฅ", e29ca5), +_c(U+2726, "โฆ", e29ca6), +_c(U+2727, "โง", e29ca7), +_c(U+2728, "โจ", e29ca8), +_c(U+2729, "โฉ", e29ca9), +_c(U+272A, "โช", e29caa), +_c(U+272B, "โซ", e29cab), +_c(U+272C, "โฌ", e29cac), +_c(U+272D, "โญ", e29cad), +_c(U+272E, "โฎ", e29cae), +_c(U+272F, "โฏ", e29caf), +_c(U+2730, "โฐ", e29cb0), +_c(U+2731, "โฑ", e29cb1), +_c(U+2732, "โฒ", e29cb2), +_c(U+2733, "โณ", e29cb3), +_c(U+2734, "โด", e29cb4), +_c(U+2735, "โต", e29cb5), +_c(U+2736, "โถ", e29cb6), +_c(U+2737, "โท", e29cb7), +_c(U+2738, "โธ", e29cb8), +_c(U+2739, "โน", e29cb9), +_c(U+273A, "โบ", e29cba), +_c(U+273B, "โป", e29cbb), +_c(U+273C, "โผ", e29cbc), +_c(U+273D, "โฝ", e29cbd), +_c(U+273E, "โพ", e29cbe), +_c(U+273F, "โฟ", e29cbf), +_c(U+2740, "โ", e29d80), +_c(U+2741, "โ", e29d81), +_c(U+2742, "โ", e29d82), +_c(U+2743, "โ", e29d83), +_c(U+2744, "โ", e29d84), +_c(U+2745, "โ
", e29d85), +_c(U+2746, "โ", e29d86), +_c(U+2747, "โ", e29d87), +_c(U+2748, "โ", e29d88), +_c(U+2749, "โ", e29d89), +_c(U+274A, "โ", e29d8a), +_c(U+274B, "โ", e29d8b), +_c(U+274C, "โ", e29d8c), +_c(U+274D, "โ", e29d8d), +_c(U+274E, "โ", e29d8e), +_c(U+274F, "โ", e29d8f), +_c(U+2750, "โ", e29d90), +_c(U+2751, "โ", e29d91), +_c(U+2752, "โ", e29d92), +_c(U+2753, "โ", e29d93), +_c(U+2754, "โ", e29d94), +_c(U+2755, "โ", e29d95), +_c(U+2756, "โ", e29d96), +_c(U+2757, "โ", e29d97), +_c(U+2758, "โ", e29d98), +_c(U+2759, "โ", e29d99), +_c(U+275A, "โ", e29d9a), +_c(U+275B, "โ", e29d9b), +_c(U+275C, "โ", e29d9c), +_c(U+275D, "โ", e29d9d), +_c(U+275E, "โ", e29d9e), +_c(U+275F, "โ", e29d9f), +_c(U+2760, "โ ", e29da0), +_c(U+2761, "โก", e29da1), +_c(U+2762, "โข", e29da2), +_c(U+2763, "โฃ", e29da3), +_c(U+2764, "โค", e29da4), +_c(U+2765, "โฅ", e29da5), +_c(U+2766, "โฆ", e29da6), +_c(U+2767, "โง", e29da7), +_c(U+2768, "โจ", e29da8), +_c(U+2769, "โฉ", e29da9), +_c(U+276A, "โช", e29daa), +_c(U+276B, "โซ", e29dab), +_c(U+276C, "โฌ", e29dac), +_c(U+276D, "โญ", e29dad), +_c(U+276E, "โฎ", e29dae), +_c(U+276F, "โฏ", e29daf), +_c(U+2770, "โฐ", e29db0), +_c(U+2771, "โฑ", e29db1), +_c(U+2772, "โฒ", e29db2), +_c(U+2773, "โณ", e29db3), +_c(U+2774, "โด", e29db4), +_c(U+2775, "โต", e29db5), +_c(U+2776, "โถ", e29db6), +_c(U+2777, "โท", e29db7), +_c(U+2778, "โธ", e29db8), +_c(U+2779, "โน", e29db9), +_c(U+277A, "โบ", e29dba), +_c(U+277B, "โป", e29dbb), +_c(U+277C, "โผ", e29dbc), +_c(U+277D, "โฝ", e29dbd), +_c(U+277E, "โพ", e29dbe), +_c(U+277F, "โฟ", e29dbf), +_c(U+2780, "โ", e29e80), +_c(U+2781, "โ", e29e81), +_c(U+2782, "โ", e29e82), +_c(U+2783, "โ", e29e83), +_c(U+2784, "โ", e29e84), +_c(U+2785, "โ
", e29e85), +_c(U+2786, "โ", e29e86), +_c(U+2787, "โ", e29e87), +_c(U+2788, "โ", e29e88), +_c(U+2789, "โ", e29e89), +_c(U+278A, "โ", e29e8a), +_c(U+278B, "โ", e29e8b), +_c(U+278C, "โ", e29e8c), +_c(U+278D, "โ", e29e8d), +_c(U+278E, "โ", e29e8e), +_c(U+278F, "โ", e29e8f), +_c(U+2790, "โ", e29e90), +_c(U+2791, "โ", e29e91), +_c(U+2792, "โ", e29e92), +_c(U+2793, "โ", e29e93), +_c(U+2794, "โ", e29e94), +_c(U+2795, "โ", e29e95), +_c(U+2796, "โ", e29e96), +_c(U+2797, "โ", e29e97), +_c(U+2798, "โ", e29e98), +_c(U+2799, "โ", e29e99), +_c(U+279A, "โ", e29e9a), +_c(U+279B, "โ", e29e9b), +_c(U+279C, "โ", e29e9c), +_c(U+279D, "โ", e29e9d), +_c(U+279E, "โ", e29e9e), +_c(U+279F, "โ", e29e9f), +_c(U+27A0, "โ ", e29ea0), +_c(U+27A1, "โก", e29ea1), +_c(U+27A2, "โข", e29ea2), +_c(U+27A3, "โฃ", e29ea3), +_c(U+27A4, "โค", e29ea4), +_c(U+27A5, "โฅ", e29ea5), +_c(U+27A6, "โฆ", e29ea6), +_c(U+27A7, "โง", e29ea7), +_c(U+27A8, "โจ", e29ea8), +_c(U+27A9, "โฉ", e29ea9), +_c(U+27AA, "โช", e29eaa), +_c(U+27AB, "โซ", e29eab), +_c(U+27AC, "โฌ", e29eac), +_c(U+27AD, "โญ", e29ead), +_c(U+27AE, "โฎ", e29eae), +_c(U+27AF, "โฏ", e29eaf), +_c(U+27B0, "โฐ", e29eb0), +_c(U+27B1, "โฑ", e29eb1), +_c(U+27B2, "โฒ", e29eb2), +_c(U+27B3, "โณ", e29eb3), +_c(U+27B4, "โด", e29eb4), +_c(U+27B5, "โต", e29eb5), +_c(U+27B6, "โถ", e29eb6), +_c(U+27B7, "โท", e29eb7), +_c(U+27B8, "โธ", e29eb8), +_c(U+27B9, "โน", e29eb9), +_c(U+27BA, "โบ", e29eba), +_c(U+27BB, "โป", e29ebb), +_c(U+27BC, "โผ", e29ebc), +_c(U+27BD, "โฝ", e29ebd), +_c(U+27BE, "โพ", e29ebe), +_c(U+27BF, "โฟ", e29ebf), +_c(U+27C0, "โ", e29f80), +_c(U+27C1, "โ", e29f81), +_c(U+27C2, "โ", e29f82), +_c(U+27C3, "โ", e29f83), +_c(U+27C4, "โ", e29f84), +_c(U+27C5, "โ
", e29f85), +_c(U+27C6, "โ", e29f86), +_c(U+27C7, "โ", e29f87), +_c(U+27C8, "โ", e29f88), +_c(U+27C9, "โ", e29f89), +_c(U+27CA, "โ", e29f8a), +_c(U+27CB, "โ", e29f8b), +_c(U+27CC, "โ", e29f8c), +_c(U+27CD, "โ", e29f8d), +_c(U+27CE, "โ", e29f8e), +_c(U+27CF, "โ", e29f8f), +_c(U+27D0, "โ", e29f90), +_c(U+27D1, "โ", e29f91), +_c(U+27D2, "โ", e29f92), +_c(U+27D3, "โ", e29f93), +_c(U+27D4, "โ", e29f94), +_c(U+27D5, "โ", e29f95), +_c(U+27D6, "โ", e29f96), +_c(U+27D7, "โ", e29f97), +_c(U+27D8, "โ", e29f98), +_c(U+27D9, "โ", e29f99), +_c(U+27DA, "โ", e29f9a), +_c(U+27DB, "โ", e29f9b), +_c(U+27DC, "โ", e29f9c), +_c(U+27DD, "โ", e29f9d), +_c(U+27DE, "โ", e29f9e), +_c(U+27DF, "โ", e29f9f), +_c(U+27E0, "โ ", e29fa0), +_c(U+27E1, "โก", e29fa1), +_c(U+27E2, "โข", e29fa2), +_c(U+27E3, "โฃ", e29fa3), +_c(U+27E4, "โค", e29fa4), +_c(U+27E5, "โฅ", e29fa5), +_c(U+27E6, "โฆ", e29fa6), +_c(U+27E7, "โง", e29fa7), +_c(U+27E8, "โจ", e29fa8), +_c(U+27E9, "โฉ", e29fa9), +_c(U+27EA, "โช", e29faa), +_c(U+27EB, "โซ", e29fab), +_c(U+27EC, "โฌ", e29fac), +_c(U+27ED, "โญ", e29fad), +_c(U+27EE, "โฎ", e29fae), +_c(U+27EF, "โฏ", e29faf), +_c(U+27F0, "โฐ", e29fb0), +_c(U+27F1, "โฑ", e29fb1), +_c(U+27F2, "โฒ", e29fb2), +_c(U+27F3, "โณ", e29fb3), +_c(U+27F4, "โด", e29fb4), +_c(U+27F5, "โต", e29fb5), +_c(U+27F6, "โถ", e29fb6), +_c(U+27F7, "โท", e29fb7), +_c(U+27F8, "โธ", e29fb8), +_c(U+27F9, "โน", e29fb9), +_c(U+27FA, "โบ", e29fba), +_c(U+27FB, "โป", e29fbb), +_c(U+27FC, "โผ", e29fbc), +_c(U+27FD, "โฝ", e29fbd), +_c(U+27FE, "โพ", e29fbe), +_c(U+27FF, "โฟ", e29fbf), +_c(U+2800, "โ ", e2a080), +_c(U+2801, "โ ", e2a081), +_c(U+2802, "โ ", e2a082), +_c(U+2803, "โ ", e2a083), +_c(U+2804, "โ ", e2a084), +_c(U+2805, "โ
", e2a085), +_c(U+2806, "โ ", e2a086), +_c(U+2807, "โ ", e2a087), +_c(U+2808, "โ ", e2a088), +_c(U+2809, "โ ", e2a089), +_c(U+280A, "โ ", e2a08a), +_c(U+280B, "โ ", e2a08b), +_c(U+280C, "โ ", e2a08c), +_c(U+280D, "โ ", e2a08d), +_c(U+280E, "โ ", e2a08e), +_c(U+280F, "โ ", e2a08f), +_c(U+2810, "โ ", e2a090), +_c(U+2811, "โ ", e2a091), +_c(U+2812, "โ ", e2a092), +_c(U+2813, "โ ", e2a093), +_c(U+2814, "โ ", e2a094), +_c(U+2815, "โ ", e2a095), +_c(U+2816, "โ ", e2a096), +_c(U+2817, "โ ", e2a097), +_c(U+2818, "โ ", e2a098), +_c(U+2819, "โ ", e2a099), +_c(U+281A, "โ ", e2a09a), +_c(U+281B, "โ ", e2a09b), +_c(U+281C, "โ ", e2a09c), +_c(U+281D, "โ ", e2a09d), +_c(U+281E, "โ ", e2a09e), +_c(U+281F, "โ ", e2a09f), +_c(U+2820, "โ ", e2a0a0), +_c(U+2821, "โ ก", e2a0a1), +_c(U+2822, "โ ข", e2a0a2), +_c(U+2823, "โ ฃ", e2a0a3), +_c(U+2824, "โ ค", e2a0a4), +_c(U+2825, "โ ฅ", e2a0a5), +_c(U+2826, "โ ฆ", e2a0a6), +_c(U+2827, "โ ง", e2a0a7), +_c(U+2828, "โ จ", e2a0a8), +_c(U+2829, "โ ฉ", e2a0a9), +_c(U+282A, "โ ช", e2a0aa), +_c(U+282B, "โ ซ", e2a0ab), +_c(U+282C, "โ ฌ", e2a0ac), +_c(U+282D, "โ ญ", e2a0ad), +_c(U+282E, "โ ฎ", e2a0ae), +_c(U+282F, "โ ฏ", e2a0af), +_c(U+2830, "โ ฐ", e2a0b0), +_c(U+2831, "โ ฑ", e2a0b1), +_c(U+2832, "โ ฒ", e2a0b2), +_c(U+2833, "โ ณ", e2a0b3), +_c(U+2834, "โ ด", e2a0b4), +_c(U+2835, "โ ต", e2a0b5), +_c(U+2836, "โ ถ", e2a0b6), +_c(U+2837, "โ ท", e2a0b7), +_c(U+2838, "โ ธ", e2a0b8), +_c(U+2839, "โ น", e2a0b9), +_c(U+283A, "โ บ", e2a0ba), +_c(U+283B, "โ ป", e2a0bb), +_c(U+283C, "โ ผ", e2a0bc), +_c(U+283D, "โ ฝ", e2a0bd), +_c(U+283E, "โ พ", e2a0be), +_c(U+283F, "โ ฟ", e2a0bf), +_c(U+2840, "โก", e2a180), +_c(U+2841, "โก", e2a181), +_c(U+2842, "โก", e2a182), +_c(U+2843, "โก", e2a183), +_c(U+2844, "โก", e2a184), +_c(U+2845, "โก
", e2a185), +_c(U+2846, "โก", e2a186), +_c(U+2847, "โก", e2a187), +_c(U+2848, "โก", e2a188), +_c(U+2849, "โก", e2a189), +_c(U+284A, "โก", e2a18a), +_c(U+284B, "โก", e2a18b), +_c(U+284C, "โก", e2a18c), +_c(U+284D, "โก", e2a18d), +_c(U+284E, "โก", e2a18e), +_c(U+284F, "โก", e2a18f), +_c(U+2850, "โก", e2a190), +_c(U+2851, "โก", e2a191), +_c(U+2852, "โก", e2a192), +_c(U+2853, "โก", e2a193), +_c(U+2854, "โก", e2a194), +_c(U+2855, "โก", e2a195), +_c(U+2856, "โก", e2a196), +_c(U+2857, "โก", e2a197), +_c(U+2858, "โก", e2a198), +_c(U+2859, "โก", e2a199), +_c(U+285A, "โก", e2a19a), +_c(U+285B, "โก", e2a19b), +_c(U+285C, "โก", e2a19c), +_c(U+285D, "โก", e2a19d), +_c(U+285E, "โก", e2a19e), +_c(U+285F, "โก", e2a19f), +_c(U+2860, "โก ", e2a1a0), +_c(U+2861, "โกก", e2a1a1), +_c(U+2862, "โกข", e2a1a2), +_c(U+2863, "โกฃ", e2a1a3), +_c(U+2864, "โกค", e2a1a4), +_c(U+2865, "โกฅ", e2a1a5), +_c(U+2866, "โกฆ", e2a1a6), +_c(U+2867, "โกง", e2a1a7), +_c(U+2868, "โกจ", e2a1a8), +_c(U+2869, "โกฉ", e2a1a9), +_c(U+286A, "โกช", e2a1aa), +_c(U+286B, "โกซ", e2a1ab), +_c(U+286C, "โกฌ", e2a1ac), +_c(U+286D, "โกญ", e2a1ad), +_c(U+286E, "โกฎ", e2a1ae), +_c(U+286F, "โกฏ", e2a1af), +_c(U+2870, "โกฐ", e2a1b0), +_c(U+2871, "โกฑ", e2a1b1), +_c(U+2872, "โกฒ", e2a1b2), +_c(U+2873, "โกณ", e2a1b3), +_c(U+2874, "โกด", e2a1b4), +_c(U+2875, "โกต", e2a1b5), +_c(U+2876, "โกถ", e2a1b6), +_c(U+2877, "โกท", e2a1b7), +_c(U+2878, "โกธ", e2a1b8), +_c(U+2879, "โกน", e2a1b9), +_c(U+287A, "โกบ", e2a1ba), +_c(U+287B, "โกป", e2a1bb), +_c(U+287C, "โกผ", e2a1bc), +_c(U+287D, "โกฝ", e2a1bd), +_c(U+287E, "โกพ", e2a1be), +_c(U+287F, "โกฟ", e2a1bf), +_c(U+2880, "โข", e2a280), +_c(U+2881, "โข", e2a281), +_c(U+2882, "โข", e2a282), +_c(U+2883, "โข", e2a283), +_c(U+2884, "โข", e2a284), +_c(U+2885, "โข
", e2a285), +_c(U+2886, "โข", e2a286), +_c(U+2887, "โข", e2a287), +_c(U+2888, "โข", e2a288), +_c(U+2889, "โข", e2a289), +_c(U+288A, "โข", e2a28a), +_c(U+288B, "โข", e2a28b), +_c(U+288C, "โข", e2a28c), +_c(U+288D, "โข", e2a28d), +_c(U+288E, "โข", e2a28e), +_c(U+288F, "โข", e2a28f), +_c(U+2890, "โข", e2a290), +_c(U+2891, "โข", e2a291), +_c(U+2892, "โข", e2a292), +_c(U+2893, "โข", e2a293), +_c(U+2894, "โข", e2a294), +_c(U+2895, "โข", e2a295), +_c(U+2896, "โข", e2a296), +_c(U+2897, "โข", e2a297), +_c(U+2898, "โข", e2a298), +_c(U+2899, "โข", e2a299), +_c(U+289A, "โข", e2a29a), +_c(U+289B, "โข", e2a29b), +_c(U+289C, "โข", e2a29c), +_c(U+289D, "โข", e2a29d), +_c(U+289E, "โข", e2a29e), +_c(U+289F, "โข", e2a29f), +_c(U+28A0, "โข ", e2a2a0), +_c(U+28A1, "โขก", e2a2a1), +_c(U+28A2, "โขข", e2a2a2), +_c(U+28A3, "โขฃ", e2a2a3), +_c(U+28A4, "โขค", e2a2a4), +_c(U+28A5, "โขฅ", e2a2a5), +_c(U+28A6, "โขฆ", e2a2a6), +_c(U+28A7, "โขง", e2a2a7), +_c(U+28A8, "โขจ", e2a2a8), +_c(U+28A9, "โขฉ", e2a2a9), +_c(U+28AA, "โขช", e2a2aa), +_c(U+28AB, "โขซ", e2a2ab), +_c(U+28AC, "โขฌ", e2a2ac), +_c(U+28AD, "โขญ", e2a2ad), +_c(U+28AE, "โขฎ", e2a2ae), +_c(U+28AF, "โขฏ", e2a2af), +_c(U+28B0, "โขฐ", e2a2b0), +_c(U+28B1, "โขฑ", e2a2b1), +_c(U+28B2, "โขฒ", e2a2b2), +_c(U+28B3, "โขณ", e2a2b3), +_c(U+28B4, "โขด", e2a2b4), +_c(U+28B5, "โขต", e2a2b5), +_c(U+28B6, "โขถ", e2a2b6), +_c(U+28B7, "โขท", e2a2b7), +_c(U+28B8, "โขธ", e2a2b8), +_c(U+28B9, "โขน", e2a2b9), +_c(U+28BA, "โขบ", e2a2ba), +_c(U+28BB, "โขป", e2a2bb), +_c(U+28BC, "โขผ", e2a2bc), +_c(U+28BD, "โขฝ", e2a2bd), +_c(U+28BE, "โขพ", e2a2be), +_c(U+28BF, "โขฟ", e2a2bf), +_c(U+28C0, "โฃ", e2a380), +_c(U+28C1, "โฃ", e2a381), +_c(U+28C2, "โฃ", e2a382), +_c(U+28C3, "โฃ", e2a383), +_c(U+28C4, "โฃ", e2a384), +_c(U+28C5, "โฃ
", e2a385), +_c(U+28C6, "โฃ", e2a386), +_c(U+28C7, "โฃ", e2a387), +_c(U+28C8, "โฃ", e2a388), +_c(U+28C9, "โฃ", e2a389), +_c(U+28CA, "โฃ", e2a38a), +_c(U+28CB, "โฃ", e2a38b), +_c(U+28CC, "โฃ", e2a38c), +_c(U+28CD, "โฃ", e2a38d), +_c(U+28CE, "โฃ", e2a38e), +_c(U+28CF, "โฃ", e2a38f), +_c(U+28D0, "โฃ", e2a390), +_c(U+28D1, "โฃ", e2a391), +_c(U+28D2, "โฃ", e2a392), +_c(U+28D3, "โฃ", e2a393), +_c(U+28D4, "โฃ", e2a394), +_c(U+28D5, "โฃ", e2a395), +_c(U+28D6, "โฃ", e2a396), +_c(U+28D7, "โฃ", e2a397), +_c(U+28D8, "โฃ", e2a398), +_c(U+28D9, "โฃ", e2a399), +_c(U+28DA, "โฃ", e2a39a), +_c(U+28DB, "โฃ", e2a39b), +_c(U+28DC, "โฃ", e2a39c), +_c(U+28DD, "โฃ", e2a39d), +_c(U+28DE, "โฃ", e2a39e), +_c(U+28DF, "โฃ", e2a39f), +_c(U+28E0, "โฃ ", e2a3a0), +_c(U+28E1, "โฃก", e2a3a1), +_c(U+28E2, "โฃข", e2a3a2), +_c(U+28E3, "โฃฃ", e2a3a3), +_c(U+28E4, "โฃค", e2a3a4), +_c(U+28E5, "โฃฅ", e2a3a5), +_c(U+28E6, "โฃฆ", e2a3a6), +_c(U+28E7, "โฃง", e2a3a7), +_c(U+28E8, "โฃจ", e2a3a8), +_c(U+28E9, "โฃฉ", e2a3a9), +_c(U+28EA, "โฃช", e2a3aa), +_c(U+28EB, "โฃซ", e2a3ab), +_c(U+28EC, "โฃฌ", e2a3ac), +_c(U+28ED, "โฃญ", e2a3ad), +_c(U+28EE, "โฃฎ", e2a3ae), +_c(U+28EF, "โฃฏ", e2a3af), +_c(U+28F0, "โฃฐ", e2a3b0), +_c(U+28F1, "โฃฑ", e2a3b1), +_c(U+28F2, "โฃฒ", e2a3b2), +_c(U+28F3, "โฃณ", e2a3b3), +_c(U+28F4, "โฃด", e2a3b4), +_c(U+28F5, "โฃต", e2a3b5), +_c(U+28F6, "โฃถ", e2a3b6), +_c(U+28F7, "โฃท", e2a3b7), +_c(U+28F8, "โฃธ", e2a3b8), +_c(U+28F9, "โฃน", e2a3b9), +_c(U+28FA, "โฃบ", e2a3ba), +_c(U+28FB, "โฃป", e2a3bb), +_c(U+28FC, "โฃผ", e2a3bc), +_c(U+28FD, "โฃฝ", e2a3bd), +_c(U+28FE, "โฃพ", e2a3be), +_c(U+28FF, "โฃฟ", e2a3bf), +_c(U+2900, "โค", e2a480), +_c(U+2901, "โค", e2a481), +_c(U+2902, "โค", e2a482), +_c(U+2903, "โค", e2a483), +_c(U+2904, "โค", e2a484), +_c(U+2905, "โค
", e2a485), +_c(U+2906, "โค", e2a486), +_c(U+2907, "โค", e2a487), +_c(U+2908, "โค", e2a488), +_c(U+2909, "โค", e2a489), +_c(U+290A, "โค", e2a48a), +_c(U+290B, "โค", e2a48b), +_c(U+290C, "โค", e2a48c), +_c(U+290D, "โค", e2a48d), +_c(U+290E, "โค", e2a48e), +_c(U+290F, "โค", e2a48f), +_c(U+2910, "โค", e2a490), +_c(U+2911, "โค", e2a491), +_c(U+2912, "โค", e2a492), +_c(U+2913, "โค", e2a493), +_c(U+2914, "โค", e2a494), +_c(U+2915, "โค", e2a495), +_c(U+2916, "โค", e2a496), +_c(U+2917, "โค", e2a497), +_c(U+2918, "โค", e2a498), +_c(U+2919, "โค", e2a499), +_c(U+291A, "โค", e2a49a), +_c(U+291B, "โค", e2a49b), +_c(U+291C, "โค", e2a49c), +_c(U+291D, "โค", e2a49d), +_c(U+291E, "โค", e2a49e), +_c(U+291F, "โค", e2a49f), +_c(U+2920, "โค ", e2a4a0), +_c(U+2921, "โคก", e2a4a1), +_c(U+2922, "โคข", e2a4a2), +_c(U+2923, "โคฃ", e2a4a3), +_c(U+2924, "โคค", e2a4a4), +_c(U+2925, "โคฅ", e2a4a5), +_c(U+2926, "โคฆ", e2a4a6), +_c(U+2927, "โคง", e2a4a7), +_c(U+2928, "โคจ", e2a4a8), +_c(U+2929, "โคฉ", e2a4a9), +_c(U+292A, "โคช", e2a4aa), +_c(U+292B, "โคซ", e2a4ab), +_c(U+292C, "โคฌ", e2a4ac), +_c(U+292D, "โคญ", e2a4ad), +_c(U+292E, "โคฎ", e2a4ae), +_c(U+292F, "โคฏ", e2a4af), +_c(U+2930, "โคฐ", e2a4b0), +_c(U+2931, "โคฑ", e2a4b1), +_c(U+2932, "โคฒ", e2a4b2), +_c(U+2933, "โคณ", e2a4b3), +_c(U+2934, "โคด", e2a4b4), +_c(U+2935, "โคต", e2a4b5), +_c(U+2936, "โคถ", e2a4b6), +_c(U+2937, "โคท", e2a4b7), +_c(U+2938, "โคธ", e2a4b8), +_c(U+2939, "โคน", e2a4b9), +_c(U+293A, "โคบ", e2a4ba), +_c(U+293B, "โคป", e2a4bb), +_c(U+293C, "โคผ", e2a4bc), +_c(U+293D, "โคฝ", e2a4bd), +_c(U+293E, "โคพ", e2a4be), +_c(U+293F, "โคฟ", e2a4bf), +_c(U+2940, "โฅ", e2a580), +_c(U+2941, "โฅ", e2a581), +_c(U+2942, "โฅ", e2a582), +_c(U+2943, "โฅ", e2a583), +_c(U+2944, "โฅ", e2a584), +_c(U+2945, "โฅ
", e2a585), +_c(U+2946, "โฅ", e2a586), +_c(U+2947, "โฅ", e2a587), +_c(U+2948, "โฅ", e2a588), +_c(U+2949, "โฅ", e2a589), +_c(U+294A, "โฅ", e2a58a), +_c(U+294B, "โฅ", e2a58b), +_c(U+294C, "โฅ", e2a58c), +_c(U+294D, "โฅ", e2a58d), +_c(U+294E, "โฅ", e2a58e), +_c(U+294F, "โฅ", e2a58f), +_c(U+2950, "โฅ", e2a590), +_c(U+2951, "โฅ", e2a591), +_c(U+2952, "โฅ", e2a592), +_c(U+2953, "โฅ", e2a593), +_c(U+2954, "โฅ", e2a594), +_c(U+2955, "โฅ", e2a595), +_c(U+2956, "โฅ", e2a596), +_c(U+2957, "โฅ", e2a597), +_c(U+2958, "โฅ", e2a598), +_c(U+2959, "โฅ", e2a599), +_c(U+295A, "โฅ", e2a59a), +_c(U+295B, "โฅ", e2a59b), +_c(U+295C, "โฅ", e2a59c), +_c(U+295D, "โฅ", e2a59d), +_c(U+295E, "โฅ", e2a59e), +_c(U+295F, "โฅ", e2a59f), +_c(U+2960, "โฅ ", e2a5a0), +_c(U+2961, "โฅก", e2a5a1), +_c(U+2962, "โฅข", e2a5a2), +_c(U+2963, "โฅฃ", e2a5a3), +_c(U+2964, "โฅค", e2a5a4), +_c(U+2965, "โฅฅ", e2a5a5), +_c(U+2966, "โฅฆ", e2a5a6), +_c(U+2967, "โฅง", e2a5a7), +_c(U+2968, "โฅจ", e2a5a8), +_c(U+2969, "โฅฉ", e2a5a9), +_c(U+296A, "โฅช", e2a5aa), +_c(U+296B, "โฅซ", e2a5ab), +_c(U+296C, "โฅฌ", e2a5ac), +_c(U+296D, "โฅญ", e2a5ad), +_c(U+296E, "โฅฎ", e2a5ae), +_c(U+296F, "โฅฏ", e2a5af), +_c(U+2970, "โฅฐ", e2a5b0), +_c(U+2971, "โฅฑ", e2a5b1), +_c(U+2972, "โฅฒ", e2a5b2), +_c(U+2973, "โฅณ", e2a5b3), +_c(U+2974, "โฅด", e2a5b4), +_c(U+2975, "โฅต", e2a5b5), +_c(U+2976, "โฅถ", e2a5b6), +_c(U+2977, "โฅท", e2a5b7), +_c(U+2978, "โฅธ", e2a5b8), +_c(U+2979, "โฅน", e2a5b9), +_c(U+297A, "โฅบ", e2a5ba), +_c(U+297B, "โฅป", e2a5bb), +_c(U+297C, "โฅผ", e2a5bc), +_c(U+297D, "โฅฝ", e2a5bd), +_c(U+297E, "โฅพ", e2a5be), +_c(U+297F, "โฅฟ", e2a5bf), +_c(U+2980, "โฆ", e2a680), +_c(U+2981, "โฆ", e2a681), +_c(U+2982, "โฆ", e2a682), +_c(U+2983, "โฆ", e2a683), +_c(U+2984, "โฆ", e2a684), +_c(U+2985, "โฆ
", e2a685), +_c(U+2986, "โฆ", e2a686), +_c(U+2987, "โฆ", e2a687), +_c(U+2988, "โฆ", e2a688), +_c(U+2989, "โฆ", e2a689), +_c(U+298A, "โฆ", e2a68a), +_c(U+298B, "โฆ", e2a68b), +_c(U+298C, "โฆ", e2a68c), +_c(U+298D, "โฆ", e2a68d), +_c(U+298E, "โฆ", e2a68e), +_c(U+298F, "โฆ", e2a68f), +_c(U+2990, "โฆ", e2a690), +_c(U+2991, "โฆ", e2a691), +_c(U+2992, "โฆ", e2a692), +_c(U+2993, "โฆ", e2a693), +_c(U+2994, "โฆ", e2a694), +_c(U+2995, "โฆ", e2a695), +_c(U+2996, "โฆ", e2a696), +_c(U+2997, "โฆ", e2a697), +_c(U+2998, "โฆ", e2a698), +_c(U+2999, "โฆ", e2a699), +_c(U+299A, "โฆ", e2a69a), +_c(U+299B, "โฆ", e2a69b), +_c(U+299C, "โฆ", e2a69c), +_c(U+299D, "โฆ", e2a69d), +_c(U+299E, "โฆ", e2a69e), +_c(U+299F, "โฆ", e2a69f), +_c(U+29A0, "โฆ ", e2a6a0), +_c(U+29A1, "โฆก", e2a6a1), +_c(U+29A2, "โฆข", e2a6a2), +_c(U+29A3, "โฆฃ", e2a6a3), +_c(U+29A4, "โฆค", e2a6a4), +_c(U+29A5, "โฆฅ", e2a6a5), +_c(U+29A6, "โฆฆ", e2a6a6), +_c(U+29A7, "โฆง", e2a6a7), +_c(U+29A8, "โฆจ", e2a6a8), +_c(U+29A9, "โฆฉ", e2a6a9), +_c(U+29AA, "โฆช", e2a6aa), +_c(U+29AB, "โฆซ", e2a6ab), +_c(U+29AC, "โฆฌ", e2a6ac), +_c(U+29AD, "โฆญ", e2a6ad), +_c(U+29AE, "โฆฎ", e2a6ae), +_c(U+29AF, "โฆฏ", e2a6af), +_c(U+29B0, "โฆฐ", e2a6b0), +_c(U+29B1, "โฆฑ", e2a6b1), +_c(U+29B2, "โฆฒ", e2a6b2), +_c(U+29B3, "โฆณ", e2a6b3), +_c(U+29B4, "โฆด", e2a6b4), +_c(U+29B5, "โฆต", e2a6b5), +_c(U+29B6, "โฆถ", e2a6b6), +_c(U+29B7, "โฆท", e2a6b7), +_c(U+29B8, "โฆธ", e2a6b8), +_c(U+29B9, "โฆน", e2a6b9), +_c(U+29BA, "โฆบ", e2a6ba), +_c(U+29BB, "โฆป", e2a6bb), +_c(U+29BC, "โฆผ", e2a6bc), +_c(U+29BD, "โฆฝ", e2a6bd), +_c(U+29BE, "โฆพ", e2a6be), +_c(U+29BF, "โฆฟ", e2a6bf), +_c(U+29C0, "โง", e2a780), +_c(U+29C1, "โง", e2a781), +_c(U+29C2, "โง", e2a782), +_c(U+29C3, "โง", e2a783), +_c(U+29C4, "โง", e2a784), +_c(U+29C5, "โง
", e2a785), +_c(U+29C6, "โง", e2a786), +_c(U+29C7, "โง", e2a787), +_c(U+29C8, "โง", e2a788), +_c(U+29C9, "โง", e2a789), +_c(U+29CA, "โง", e2a78a), +_c(U+29CB, "โง", e2a78b), +_c(U+29CC, "โง", e2a78c), +_c(U+29CD, "โง", e2a78d), +_c(U+29CE, "โง", e2a78e), +_c(U+29CF, "โง", e2a78f), +_c(U+29D0, "โง", e2a790), +_c(U+29D1, "โง", e2a791), +_c(U+29D2, "โง", e2a792), +_c(U+29D3, "โง", e2a793), +_c(U+29D4, "โง", e2a794), +_c(U+29D5, "โง", e2a795), +_c(U+29D6, "โง", e2a796), +_c(U+29D7, "โง", e2a797), +_c(U+29D8, "โง", e2a798), +_c(U+29D9, "โง", e2a799), +_c(U+29DA, "โง", e2a79a), +_c(U+29DB, "โง", e2a79b), +_c(U+29DC, "โง", e2a79c), +_c(U+29DD, "โง", e2a79d), +_c(U+29DE, "โง", e2a79e), +_c(U+29DF, "โง", e2a79f), +_c(U+29E0, "โง ", e2a7a0), +_c(U+29E1, "โงก", e2a7a1), +_c(U+29E2, "โงข", e2a7a2), +_c(U+29E3, "โงฃ", e2a7a3), +_c(U+29E4, "โงค", e2a7a4), +_c(U+29E5, "โงฅ", e2a7a5), +_c(U+29E6, "โงฆ", e2a7a6), +_c(U+29E7, "โงง", e2a7a7), +_c(U+29E8, "โงจ", e2a7a8), +_c(U+29E9, "โงฉ", e2a7a9), +_c(U+29EA, "โงช", e2a7aa), +_c(U+29EB, "โงซ", e2a7ab), +_c(U+29EC, "โงฌ", e2a7ac), +_c(U+29ED, "โงญ", e2a7ad), +_c(U+29EE, "โงฎ", e2a7ae), +_c(U+29EF, "โงฏ", e2a7af), +_c(U+29F0, "โงฐ", e2a7b0), +_c(U+29F1, "โงฑ", e2a7b1), +_c(U+29F2, "โงฒ", e2a7b2), +_c(U+29F3, "โงณ", e2a7b3), +_c(U+29F4, "โงด", e2a7b4), +_c(U+29F5, "โงต", e2a7b5), +_c(U+29F6, "โงถ", e2a7b6), +_c(U+29F7, "โงท", e2a7b7), +_c(U+29F8, "โงธ", e2a7b8), +_c(U+29F9, "โงน", e2a7b9), +_c(U+29FA, "โงบ", e2a7ba), +_c(U+29FB, "โงป", e2a7bb), +_c(U+29FC, "โงผ", e2a7bc), +_c(U+29FD, "โงฝ", e2a7bd), +_c(U+29FE, "โงพ", e2a7be), +_c(U+29FF, "โงฟ", e2a7bf), +_c(U+1D100, "๐", f09d8480), +_c(U+1D101, "๐", f09d8481), +_c(U+1D102, "๐", f09d8482), +_c(U+1D103, "๐", f09d8483), +_c(U+1D104, "๐", f09d8484), +_c(U+1D105, "๐
", f09d8485), +_c(U+1D106, "๐", f09d8486), +_c(U+1D107, "๐", f09d8487), +_c(U+1D108, "๐", f09d8488), +_c(U+1D109, "๐", f09d8489), +_c(U+1D10A, "๐", f09d848a), +_c(U+1D10B, "๐", f09d848b), +_c(U+1D10C, "๐", f09d848c), +_c(U+1D10D, "๐", f09d848d), +_c(U+1D10E, "๐", f09d848e), +_c(U+1D10F, "๐", f09d848f), +_c(U+1D110, "๐", f09d8490), +_c(U+1D111, "๐", f09d8491), +_c(U+1D112, "๐", f09d8492), +_c(U+1D113, "๐", f09d8493), +_c(U+1D114, "๐", f09d8494), +_c(U+1D115, "๐", f09d8495), +_c(U+1D116, "๐", f09d8496), +_c(U+1D117, "๐", f09d8497), +_c(U+1D118, "๐", f09d8498), +_c(U+1D119, "๐", f09d8499), +_c(U+1D11A, "๐", f09d849a), +_c(U+1D11B, "๐", f09d849b), +_c(U+1D11C, "๐", f09d849c), +_c(U+1D11D, "๐", f09d849d), +_c(U+1D11E, "๐", f09d849e), +_c(U+1D11F, "๐", f09d849f), +_c(U+1D120, "๐ ", f09d84a0), +_c(U+1D121, "๐ก", f09d84a1), +_c(U+1D122, "๐ข", f09d84a2), +_c(U+1D123, "๐ฃ", f09d84a3), +_c(U+1D124, "๐ค", f09d84a4), +_c(U+1D125, "๐ฅ", f09d84a5), +_c(U+1D126, "๐ฆ", f09d84a6), +_c(U+1D127, "๐ง", f09d84a7), +_c(U+1D128, "๐จ", f09d84a8), +_c(U+1D129, "๐ฉ", f09d84a9), +_c(U+1D12A, "๐ช", f09d84aa), +_c(U+1D12B, "๐ซ", f09d84ab), +_c(U+1D12C, "๐ฌ", f09d84ac), +_c(U+1D12D, "๐ญ", f09d84ad), +_c(U+1D12E, "๐ฎ", f09d84ae), +_c(U+1D12F, "๐ฏ", f09d84af), +_c(U+1D130, "๐ฐ", f09d84b0), +_c(U+1D131, "๐ฑ", f09d84b1), +_c(U+1D132, "๐ฒ", f09d84b2), +_c(U+1D133, "๐ณ", f09d84b3), +_c(U+1D134, "๐ด", f09d84b4), +_c(U+1D135, "๐ต", f09d84b5), +_c(U+1D136, "๐ถ", f09d84b6), +_c(U+1D137, "๐ท", f09d84b7), +_c(U+1D138, "๐ธ", f09d84b8), +_c(U+1D139, "๐น", f09d84b9), +_c(U+1D13A, "๐บ", f09d84ba), +_c(U+1D13B, "๐ป", f09d84bb), +_c(U+1D13C, "๐ผ", f09d84bc), +_c(U+1D13D, "๐ฝ", f09d84bd), +_c(U+1D13E, "๐พ", f09d84be), +_c(U+1D13F, "๐ฟ", f09d84bf), +_c(U+1D140, "๐
", f09d8580), +_c(U+1D141, "๐
", f09d8581), +_c(U+1D142, "๐
", f09d8582), +_c(U+1D143, "๐
", f09d8583), +_c(U+1D144, "๐
", f09d8584), +_c(U+1D145, "๐
", f09d8585), +_c(U+1D146, "๐
", f09d8586), +_c(U+1D147, "๐
", f09d8587), +_c(U+1D148, "๐
", f09d8588), +_c(U+1D149, "๐
", f09d8589), +_c(U+1D14A, "๐
", f09d858a), +_c(U+1D14B, "๐
", f09d858b), +_c(U+1D14C, "๐
", f09d858c), +_c(U+1D14D, "๐
", f09d858d), +_c(U+1D14E, "๐
", f09d858e), +_c(U+1D14F, "๐
", f09d858f), +_c(U+1D150, "๐
", f09d8590), +_c(U+1D151, "๐
", f09d8591), +_c(U+1D152, "๐
", f09d8592), +_c(U+1D153, "๐
", f09d8593), +_c(U+1D154, "๐
", f09d8594), +_c(U+1D155, "๐
", f09d8595), +_c(U+1D156, "๐
", f09d8596), +_c(U+1D157, "๐
", f09d8597), +_c(U+1D158, "๐
", f09d8598), +_c(U+1D159, "๐
", f09d8599), +_c(U+1D15A, "๐
", f09d859a), +_c(U+1D15B, "๐
", f09d859b), +_c(U+1D15C, "๐
", f09d859c), +_c(U+1D15D, "๐
", f09d859d), +_c(U+1D15E, "๐
", f09d859e), +_c(U+1D15F, "๐
", f09d859f), +_c(U+1D160, "๐
", f09d85a0), +_c(U+1D161, "๐
ก", f09d85a1), +_c(U+1D162, "๐
ข", f09d85a2), +_c(U+1D163, "๐
ฃ", f09d85a3), +_c(U+1D164, "๐
ค", f09d85a4), +_c(U+1D165, "๐
ฅ", f09d85a5), +_c(U+1D166, "๐
ฆ", f09d85a6), +_c(U+1D167, "๐
ง", f09d85a7), +_c(U+1D168, "๐
จ", f09d85a8), +_c(U+1D169, "๐
ฉ", f09d85a9), +_c(U+1D16A, "๐
ช", f09d85aa), +_c(U+1D16B, "๐
ซ", f09d85ab), +_c(U+1D16C, "๐
ฌ", f09d85ac), +_c(U+1D16D, "๐
ญ", f09d85ad), +_c(U+1D16E, "๐
ฎ", f09d85ae), +_c(U+1D16F, "๐
ฏ", f09d85af), +_c(U+1D170, "๐
ฐ", f09d85b0), +_c(U+1D171, "๐
ฑ", f09d85b1), +_c(U+1D172, "๐
ฒ", f09d85b2), +_c(U+1D173, "๐
ณ", f09d85b3), +_c(U+1D174, "๐
ด", f09d85b4), +_c(U+1D175, "๐
ต", f09d85b5), +_c(U+1D176, "๐
ถ", f09d85b6), +_c(U+1D177, "๐
ท", f09d85b7), +_c(U+1D178, "๐
ธ", f09d85b8), +_c(U+1D179, "๐
น", f09d85b9), +_c(U+1D17A, "๐
บ", f09d85ba), +_c(U+1D17B, "๐
ป", f09d85bb), +_c(U+1D17C, "๐
ผ", f09d85bc), +_c(U+1D17D, "๐
ฝ", f09d85bd), +_c(U+1D17E, "๐
พ", f09d85be), +_c(U+1D17F, "๐
ฟ", f09d85bf), +_c(U+1D180, "๐", f09d8680), +_c(U+1D181, "๐", f09d8681), +_c(U+1D182, "๐", f09d8682), +_c(U+1D183, "๐", f09d8683), +_c(U+1D184, "๐", f09d8684), +_c(U+1D185, "๐
", f09d8685), +_c(U+1D186, "๐", f09d8686), +_c(U+1D187, "๐", f09d8687), +_c(U+1D188, "๐", f09d8688), +_c(U+1D189, "๐", f09d8689), +_c(U+1D18A, "๐", f09d868a), +_c(U+1D18B, "๐", f09d868b), +_c(U+1D18C, "๐", f09d868c), +_c(U+1D18D, "๐", f09d868d), +_c(U+1D18E, "๐", f09d868e), +_c(U+1D18F, "๐", f09d868f), +_c(U+1D190, "๐", f09d8690), +_c(U+1D191, "๐", f09d8691), +_c(U+1D192, "๐", f09d8692), +_c(U+1D193, "๐", f09d8693), +_c(U+1D194, "๐", f09d8694), +_c(U+1D195, "๐", f09d8695), +_c(U+1D196, "๐", f09d8696), +_c(U+1D197, "๐", f09d8697), +_c(U+1D198, "๐", f09d8698), +_c(U+1D199, "๐", f09d8699), +_c(U+1D19A, "๐", f09d869a), +_c(U+1D19B, "๐", f09d869b), +_c(U+1D19C, "๐", f09d869c), +_c(U+1D19D, "๐", f09d869d), +_c(U+1D19E, "๐", f09d869e), +_c(U+1D19F, "๐", f09d869f), +_c(U+1D1A0, "๐ ", f09d86a0), +_c(U+1D1A1, "๐ก", f09d86a1), +_c(U+1D1A2, "๐ข", f09d86a2), +_c(U+1D1A3, "๐ฃ", f09d86a3), +_c(U+1D1A4, "๐ค", f09d86a4), +_c(U+1D1A5, "๐ฅ", f09d86a5), +_c(U+1D1A6, "๐ฆ", f09d86a6), +_c(U+1D1A7, "๐ง", f09d86a7), +_c(U+1D1A8, "๐จ", f09d86a8), +_c(U+1D1A9, "๐ฉ", f09d86a9), +_c(U+1D1AA, "๐ช", f09d86aa), +_c(U+1D1AB, "๐ซ", f09d86ab), +_c(U+1D1AC, "๐ฌ", f09d86ac), +_c(U+1D1AD, "๐ญ", f09d86ad), +_c(U+1D1AE, "๐ฎ", f09d86ae), +_c(U+1D1AF, "๐ฏ", f09d86af), +_c(U+1D1B0, "๐ฐ", f09d86b0), +_c(U+1D1B1, "๐ฑ", f09d86b1), +_c(U+1D1B2, "๐ฒ", f09d86b2), +_c(U+1D1B3, "๐ณ", f09d86b3), +_c(U+1D1B4, "๐ด", f09d86b4), +_c(U+1D1B5, "๐ต", f09d86b5), +_c(U+1D1B6, "๐ถ", f09d86b6), +_c(U+1D1B7, "๐ท", f09d86b7), +_c(U+1D1B8, "๐ธ", f09d86b8), +_c(U+1D1B9, "๐น", f09d86b9), +_c(U+1D1BA, "๐บ", f09d86ba), +_c(U+1D1BB, "๐ป", f09d86bb), +_c(U+1D1BC, "๐ผ", f09d86bc), +_c(U+1D1BD, "๐ฝ", f09d86bd), +_c(U+1D1BE, "๐พ", f09d86be), +_c(U+1D1BF, "๐ฟ", f09d86bf), +_c(U+1D1C0, "๐", f09d8780), +_c(U+1D1C1, "๐", f09d8781), +_c(U+1D1C2, "๐", f09d8782), +_c(U+1D1C3, "๐", f09d8783), +_c(U+1D1C4, "๐", f09d8784), +_c(U+1D1C5, "๐
", f09d8785), +_c(U+1D1C6, "๐", f09d8786), +_c(U+1D1C7, "๐", f09d8787), +_c(U+1D1C8, "๐", f09d8788), +_c(U+1D1C9, "๐", f09d8789), +_c(U+1D1CA, "๐", f09d878a), +_c(U+1D1CB, "๐", f09d878b), +_c(U+1D1CC, "๐", f09d878c), +_c(U+1D1CD, "๐", f09d878d), +_c(U+1D1CE, "๐", f09d878e), +_c(U+1D1CF, "๐", f09d878f), +_c(U+1D1D0, "๐", f09d8790), +_c(U+1D1D1, "๐", f09d8791), +_c(U+1D1D2, "๐", f09d8792), +_c(U+1D1D3, "๐", f09d8793), +_c(U+1D1D4, "๐", f09d8794), +_c(U+1D1D5, "๐", f09d8795), +_c(U+1D1D6, "๐", f09d8796), +_c(U+1D1D7, "๐", f09d8797), +_c(U+1D1D8, "๐", f09d8798), +_c(U+1D1D9, "๐", f09d8799), +_c(U+1D1DA, "๐", f09d879a), +_c(U+1D1DB, "๐", f09d879b), +_c(U+1D1DC, "๐", f09d879c), +_c(U+1D1DD, "๐", f09d879d), +_c(U+1D1DE, "๐", f09d879e), +_c(U+1D1DF, "๐", f09d879f), +_c(U+1D1E0, "๐ ", f09d87a0), +_c(U+1D1E1, "๐ก", f09d87a1), +_c(U+1D1E2, "๐ข", f09d87a2), +_c(U+1D1E3, "๐ฃ", f09d87a3), +_c(U+1D1E4, "๐ค", f09d87a4), +_c(U+1D1E5, "๐ฅ", f09d87a5), +_c(U+1D1E6, "๐ฆ", f09d87a6), +_c(U+1D1E7, "๐ง", f09d87a7), +_c(U+1D1E8, "๐จ", f09d87a8), +_c(U+1D1E9, "๐ฉ", f09d87a9), +_c(U+1D1EA, "๐ช", f09d87aa), +_c(U+1D1EB, "๐ซ", f09d87ab), +_c(U+1D1EC, "๐ฌ", f09d87ac), +_c(U+1D1ED, "๐ญ", f09d87ad), +_c(U+1D1EE, "๐ฎ", f09d87ae), +_c(U+1D1EF, "๐ฏ", f09d87af), +_c(U+1D1F0, "๐ฐ", f09d87b0), +_c(U+1D1F1, "๐ฑ", f09d87b1), +_c(U+1D1F2, "๐ฒ", f09d87b2), +_c(U+1D1F3, "๐ณ", f09d87b3), +_c(U+1D1F4, "๐ด", f09d87b4), +_c(U+1D1F5, "๐ต", f09d87b5), +_c(U+1D1F6, "๐ถ", f09d87b6), +_c(U+1D1F7, "๐ท", f09d87b7), +_c(U+1D1F8, "๐ธ", f09d87b8), +_c(U+1D1F9, "๐น", f09d87b9), +_c(U+1D1FA, "๐บ", f09d87ba), +_c(U+1D1FB, "๐ป", f09d87bb), +_c(U+1D1FC, "๐ผ", f09d87bc), +_c(U+1D1FD, "๐ฝ", f09d87bd), +_c(U+1D1FE, "๐พ", f09d87be), +_c(U+1D1FF, "๐ฟ", f09d87bf), +_c(U+1D200, "๐", f09d8880), +_c(U+1D201, "๐", f09d8881), +_c(U+1D202, "๐", f09d8882), +_c(U+1D203, "๐", f09d8883), +_c(U+1D204, "๐", f09d8884), +_c(U+1D205, "๐
", f09d8885), +_c(U+1D206, "๐", f09d8886), +_c(U+1D207, "๐", f09d8887), +_c(U+1D208, "๐", f09d8888), +_c(U+1D209, "๐", f09d8889), +_c(U+1D20A, "๐", f09d888a), +_c(U+1D20B, "๐", f09d888b), +_c(U+1D20C, "๐", f09d888c), +_c(U+1D20D, "๐", f09d888d), +_c(U+1D20E, "๐", f09d888e), +_c(U+1D20F, "๐", f09d888f), +_c(U+1D210, "๐", f09d8890), +_c(U+1D211, "๐", f09d8891), +_c(U+1D212, "๐", f09d8892), +_c(U+1D213, "๐", f09d8893), +_c(U+1D214, "๐", f09d8894), +_c(U+1D215, "๐", f09d8895), +_c(U+1D216, "๐", f09d8896), +_c(U+1D217, "๐", f09d8897), +_c(U+1D218, "๐", f09d8898), +_c(U+1D219, "๐", f09d8899), +_c(U+1D21A, "๐", f09d889a), +_c(U+1D21B, "๐", f09d889b), +_c(U+1D21C, "๐", f09d889c), +_c(U+1D21D, "๐", f09d889d), +_c(U+1D21E, "๐", f09d889e), +_c(U+1D21F, "๐", f09d889f), +_c(U+1D220, "๐ ", f09d88a0), +_c(U+1D221, "๐ก", f09d88a1), +_c(U+1D222, "๐ข", f09d88a2), +_c(U+1D223, "๐ฃ", f09d88a3), +_c(U+1D224, "๐ค", f09d88a4), +_c(U+1D225, "๐ฅ", f09d88a5), +_c(U+1D226, "๐ฆ", f09d88a6), +_c(U+1D227, "๐ง", f09d88a7), +_c(U+1D228, "๐จ", f09d88a8), +_c(U+1D229, "๐ฉ", f09d88a9), +_c(U+1D22A, "๐ช", f09d88aa), +_c(U+1D22B, "๐ซ", f09d88ab), +_c(U+1D22C, "๐ฌ", f09d88ac), +_c(U+1D22D, "๐ญ", f09d88ad), +_c(U+1D22E, "๐ฎ", f09d88ae), +_c(U+1D22F, "๐ฏ", f09d88af), +_c(U+1D230, "๐ฐ", f09d88b0), +_c(U+1D231, "๐ฑ", f09d88b1), +_c(U+1D232, "๐ฒ", f09d88b2), +_c(U+1D233, "๐ณ", f09d88b3), +_c(U+1D234, "๐ด", f09d88b4), +_c(U+1D235, "๐ต", f09d88b5), +_c(U+1D236, "๐ถ", f09d88b6), +_c(U+1D237, "๐ท", f09d88b7), +_c(U+1D238, "๐ธ", f09d88b8), +_c(U+1D239, "๐น", f09d88b9), +_c(U+1D23A, "๐บ", f09d88ba), +_c(U+1D23B, "๐ป", f09d88bb), +_c(U+1D23C, "๐ผ", f09d88bc), +_c(U+1D23D, "๐ฝ", f09d88bd), +_c(U+1D23E, "๐พ", f09d88be), +_c(U+1D23F, "๐ฟ", f09d88bf), +_c(U+1D240, "๐", f09d8980), +_c(U+1D241, "๐", f09d8981), +_c(U+1D242, "๐", f09d8982), +_c(U+1D243, "๐", f09d8983), +_c(U+1D244, "๐", f09d8984), +_c(U+1D245, "๐
", f09d8985), +_c(U+1D246, "๐", f09d8986), +_c(U+1D247, "๐", f09d8987), +_c(U+1D248, "๐", f09d8988), +_c(U+1D249, "๐", f09d8989), +_c(U+1D24A, "๐", f09d898a), +_c(U+1D24B, "๐", f09d898b), +_c(U+1D24C, "๐", f09d898c), +_c(U+1D24D, "๐", f09d898d), +_c(U+1D24E, "๐", f09d898e), +_c(U+1D24F, "๐", f09d898f), +_c(U+1D250, "๐", f09d8990), +_c(U+1D251, "๐", f09d8991), +_c(U+1D252, "๐", f09d8992), +_c(U+1D253, "๐", f09d8993), +_c(U+1D254, "๐", f09d8994), +_c(U+1D255, "๐", f09d8995), +_c(U+1D256, "๐", f09d8996), +_c(U+1D257, "๐", f09d8997), +_c(U+1D258, "๐", f09d8998), +_c(U+1D259, "๐", f09d8999), +_c(U+1D25A, "๐", f09d899a), +_c(U+1D25B, "๐", f09d899b), +_c(U+1D25C, "๐", f09d899c), +_c(U+1D25D, "๐", f09d899d), +_c(U+1D25E, "๐", f09d899e), +_c(U+1D25F, "๐", f09d899f), +_c(U+1D260, "๐ ", f09d89a0), +_c(U+1D261, "๐ก", f09d89a1), +_c(U+1D262, "๐ข", f09d89a2), +_c(U+1D263, "๐ฃ", f09d89a3), +_c(U+1D264, "๐ค", f09d89a4), +_c(U+1D265, "๐ฅ", f09d89a5), +_c(U+1D266, "๐ฆ", f09d89a6), +_c(U+1D267, "๐ง", f09d89a7), +_c(U+1D268, "๐จ", f09d89a8), +_c(U+1D269, "๐ฉ", f09d89a9), +_c(U+1D26A, "๐ช", f09d89aa), +_c(U+1D26B, "๐ซ", f09d89ab), +_c(U+1D26C, "๐ฌ", f09d89ac), +_c(U+1D26D, "๐ญ", f09d89ad), +_c(U+1D26E, "๐ฎ", f09d89ae), +_c(U+1D26F, "๐ฏ", f09d89af), +_c(U+1D270, "๐ฐ", f09d89b0), +_c(U+1D271, "๐ฑ", f09d89b1), +_c(U+1D272, "๐ฒ", f09d89b2), +_c(U+1D273, "๐ณ", f09d89b3), +_c(U+1D274, "๐ด", f09d89b4), +_c(U+1D275, "๐ต", f09d89b5), +_c(U+1D276, "๐ถ", f09d89b6), +_c(U+1D277, "๐ท", f09d89b7), +_c(U+1D278, "๐ธ", f09d89b8), +_c(U+1D279, "๐น", f09d89b9), +_c(U+1D27A, "๐บ", f09d89ba), +_c(U+1D27B, "๐ป", f09d89bb), +_c(U+1D27C, "๐ผ", f09d89bc), +_c(U+1D27D, "๐ฝ", f09d89bd), +_c(U+1D27E, "๐พ", f09d89be), +_c(U+1D27F, "๐ฟ", f09d89bf), +_c(U+1D280, "๐", f09d8a80), +_c(U+1D281, "๐", f09d8a81), +_c(U+1D282, "๐", f09d8a82), +_c(U+1D283, "๐", f09d8a83), +_c(U+1D284, "๐", f09d8a84), +_c(U+1D285, "๐
", f09d8a85), +_c(U+1D286, "๐", f09d8a86), +_c(U+1D287, "๐", f09d8a87), +_c(U+1D288, "๐", f09d8a88), +_c(U+1D289, "๐", f09d8a89), +_c(U+1D28A, "๐", f09d8a8a), +_c(U+1D28B, "๐", f09d8a8b), +_c(U+1D28C, "๐", f09d8a8c), +_c(U+1D28D, "๐", f09d8a8d), +_c(U+1D28E, "๐", f09d8a8e), +_c(U+1D28F, "๐", f09d8a8f), +_c(U+1D290, "๐", f09d8a90), +_c(U+1D291, "๐", f09d8a91), +_c(U+1D292, "๐", f09d8a92), +_c(U+1D293, "๐", f09d8a93), +_c(U+1D294, "๐", f09d8a94), +_c(U+1D295, "๐", f09d8a95), +_c(U+1D296, "๐", f09d8a96), +_c(U+1D297, "๐", f09d8a97), +_c(U+1D298, "๐", f09d8a98), +_c(U+1D299, "๐", f09d8a99), +_c(U+1D29A, "๐", f09d8a9a), +_c(U+1D29B, "๐", f09d8a9b), +_c(U+1D29C, "๐", f09d8a9c), +_c(U+1D29D, "๐", f09d8a9d), +_c(U+1D29E, "๐", f09d8a9e), +_c(U+1D29F, "๐", f09d8a9f), +_c(U+1D2A0, "๐ ", f09d8aa0), +_c(U+1D2A1, "๐ก", f09d8aa1), +_c(U+1D2A2, "๐ข", f09d8aa2), +_c(U+1D2A3, "๐ฃ", f09d8aa3), +_c(U+1D2A4, "๐ค", f09d8aa4), +_c(U+1D2A5, "๐ฅ", f09d8aa5), +_c(U+1D2A6, "๐ฆ", f09d8aa6), +_c(U+1D2A7, "๐ง", f09d8aa7), +_c(U+1D2A8, "๐จ", f09d8aa8), +_c(U+1D2A9, "๐ฉ", f09d8aa9), +_c(U+1D2AA, "๐ช", f09d8aaa), +_c(U+1D2AB, "๐ซ", f09d8aab), +_c(U+1D2AC, "๐ฌ", f09d8aac), +_c(U+1D2AD, "๐ญ", f09d8aad), +_c(U+1D2AE, "๐ฎ", f09d8aae), +_c(U+1D2AF, "๐ฏ", f09d8aaf), +_c(U+1D2B0, "๐ฐ", f09d8ab0), +_c(U+1D2B1, "๐ฑ", f09d8ab1), +_c(U+1D2B2, "๐ฒ", f09d8ab2), +_c(U+1D2B3, "๐ณ", f09d8ab3), +_c(U+1D2B4, "๐ด", f09d8ab4), +_c(U+1D2B5, "๐ต", f09d8ab5), +_c(U+1D2B6, "๐ถ", f09d8ab6), +_c(U+1D2B7, "๐ท", f09d8ab7), +_c(U+1D2B8, "๐ธ", f09d8ab8), +_c(U+1D2B9, "๐น", f09d8ab9), +_c(U+1D2BA, "๐บ", f09d8aba), +_c(U+1D2BB, "๐ป", f09d8abb), +_c(U+1D2BC, "๐ผ", f09d8abc), +_c(U+1D2BD, "๐ฝ", f09d8abd), +_c(U+1D2BE, "๐พ", f09d8abe), +_c(U+1D2BF, "๐ฟ", f09d8abf), +_c(U+1D2C0, "๐", f09d8b80), +_c(U+1D2C1, "๐", f09d8b81), +_c(U+1D2C2, "๐", f09d8b82), +_c(U+1D2C3, "๐", f09d8b83), +_c(U+1D2C4, "๐", f09d8b84), +_c(U+1D2C5, "๐
", f09d8b85), +_c(U+1D2C6, "๐", f09d8b86), +_c(U+1D2C7, "๐", f09d8b87), +_c(U+1D2C8, "๐", f09d8b88), +_c(U+1D2C9, "๐", f09d8b89), +_c(U+1D2CA, "๐", f09d8b8a), +_c(U+1D2CB, "๐", f09d8b8b), +_c(U+1D2CC, "๐", f09d8b8c), +_c(U+1D2CD, "๐", f09d8b8d), +_c(U+1D2CE, "๐", f09d8b8e), +_c(U+1D2CF, "๐", f09d8b8f), +_c(U+1D2D0, "๐", f09d8b90), +_c(U+1D2D1, "๐", f09d8b91), +_c(U+1D2D2, "๐", f09d8b92), +_c(U+1D2D3, "๐", f09d8b93), +_c(U+1D2D4, "๐", f09d8b94), +_c(U+1D2D5, "๐", f09d8b95), +_c(U+1D2D6, "๐", f09d8b96), +_c(U+1D2D7, "๐", f09d8b97), +_c(U+1D2D8, "๐", f09d8b98), +_c(U+1D2D9, "๐", f09d8b99), +_c(U+1D2DA, "๐", f09d8b9a), +_c(U+1D2DB, "๐", f09d8b9b), +_c(U+1D2DC, "๐", f09d8b9c), +_c(U+1D2DD, "๐", f09d8b9d), +_c(U+1D2DE, "๐", f09d8b9e), +_c(U+1D2DF, "๐", f09d8b9f), +_c(U+1D2E0, "๐ ", f09d8ba0), +_c(U+1D2E1, "๐ก", f09d8ba1), +_c(U+1D2E2, "๐ข", f09d8ba2), +_c(U+1D2E3, "๐ฃ", f09d8ba3), +_c(U+1D2E4, "๐ค", f09d8ba4), +_c(U+1D2E5, "๐ฅ", f09d8ba5), +_c(U+1D2E6, "๐ฆ", f09d8ba6), +_c(U+1D2E7, "๐ง", f09d8ba7), +_c(U+1D2E8, "๐จ", f09d8ba8), +_c(U+1D2E9, "๐ฉ", f09d8ba9), +_c(U+1D2EA, "๐ช", f09d8baa), +_c(U+1D2EB, "๐ซ", f09d8bab), +_c(U+1D2EC, "๐ฌ", f09d8bac), +_c(U+1D2ED, "๐ญ", f09d8bad), +_c(U+1D2EE, "๐ฎ", f09d8bae), +_c(U+1D2EF, "๐ฏ", f09d8baf), +_c(U+1D2F0, "๐ฐ", f09d8bb0), +_c(U+1D2F1, "๐ฑ", f09d8bb1), +_c(U+1D2F2, "๐ฒ", f09d8bb2), +_c(U+1D2F3, "๐ณ", f09d8bb3), +_c(U+1D2F4, "๐ด", f09d8bb4), +_c(U+1D2F5, "๐ต", f09d8bb5), +_c(U+1D2F6, "๐ถ", f09d8bb6), +_c(U+1D2F7, "๐ท", f09d8bb7), +_c(U+1D2F8, "๐ธ", f09d8bb8), +_c(U+1D2F9, "๐น", f09d8bb9), +_c(U+1D2FA, "๐บ", f09d8bba), +_c(U+1D2FB, "๐ป", f09d8bbb), +_c(U+1D2FC, "๐ผ", f09d8bbc), +_c(U+1D2FD, "๐ฝ", f09d8bbd), +_c(U+1D2FE, "๐พ", f09d8bbe), +_c(U+1D2FF, "๐ฟ", f09d8bbf), +_c(U+1D300, "๐", f09d8c80), +_c(U+1D301, "๐", f09d8c81), +_c(U+1D302, "๐", f09d8c82), +_c(U+1D303, "๐", f09d8c83), +_c(U+1D304, "๐", f09d8c84), +_c(U+1D305, "๐
", f09d8c85), +_c(U+1D306, "๐", f09d8c86), +_c(U+1D307, "๐", f09d8c87), +_c(U+1D308, "๐", f09d8c88), +_c(U+1D309, "๐", f09d8c89), +_c(U+1D30A, "๐", f09d8c8a), +_c(U+1D30B, "๐", f09d8c8b), +_c(U+1D30C, "๐", f09d8c8c), +_c(U+1D30D, "๐", f09d8c8d), +_c(U+1D30E, "๐", f09d8c8e), +_c(U+1D30F, "๐", f09d8c8f), +_c(U+1D310, "๐", f09d8c90), +_c(U+1D311, "๐", f09d8c91), +_c(U+1D312, "๐", f09d8c92), +_c(U+1D313, "๐", f09d8c93), +_c(U+1D314, "๐", f09d8c94), +_c(U+1D315, "๐", f09d8c95), +_c(U+1D316, "๐", f09d8c96), +_c(U+1D317, "๐", f09d8c97), +_c(U+1D318, "๐", f09d8c98), +_c(U+1D319, "๐", f09d8c99), +_c(U+1D31A, "๐", f09d8c9a), +_c(U+1D31B, "๐", f09d8c9b), +_c(U+1D31C, "๐", f09d8c9c), +_c(U+1D31D, "๐", f09d8c9d), +_c(U+1D31E, "๐", f09d8c9e), +_c(U+1D31F, "๐", f09d8c9f), +_c(U+1D320, "๐ ", f09d8ca0), +_c(U+1D321, "๐ก", f09d8ca1), +_c(U+1D322, "๐ข", f09d8ca2), +_c(U+1D323, "๐ฃ", f09d8ca3), +_c(U+1D324, "๐ค", f09d8ca4), +_c(U+1D325, "๐ฅ", f09d8ca5), +_c(U+1D326, "๐ฆ", f09d8ca6), +_c(U+1D327, "๐ง", f09d8ca7), +_c(U+1D328, "๐จ", f09d8ca8), +_c(U+1D329, "๐ฉ", f09d8ca9), +_c(U+1D32A, "๐ช", f09d8caa), +_c(U+1D32B, "๐ซ", f09d8cab), +_c(U+1D32C, "๐ฌ", f09d8cac), +_c(U+1D32D, "๐ญ", f09d8cad), +_c(U+1D32E, "๐ฎ", f09d8cae), +_c(U+1D32F, "๐ฏ", f09d8caf), +_c(U+1D330, "๐ฐ", f09d8cb0), +_c(U+1D331, "๐ฑ", f09d8cb1), +_c(U+1D332, "๐ฒ", f09d8cb2), +_c(U+1D333, "๐ณ", f09d8cb3), +_c(U+1D334, "๐ด", f09d8cb4), +_c(U+1D335, "๐ต", f09d8cb5), +_c(U+1D336, "๐ถ", f09d8cb6), +_c(U+1D337, "๐ท", f09d8cb7), +_c(U+1D338, "๐ธ", f09d8cb8), +_c(U+1D339, "๐น", f09d8cb9), +_c(U+1D33A, "๐บ", f09d8cba), +_c(U+1D33B, "๐ป", f09d8cbb), +_c(U+1D33C, "๐ผ", f09d8cbc), +_c(U+1D33D, "๐ฝ", f09d8cbd), +_c(U+1D33E, "๐พ", f09d8cbe), +_c(U+1D33F, "๐ฟ", f09d8cbf), +_c(U+1D340, "๐", f09d8d80), +_c(U+1D341, "๐", f09d8d81), +_c(U+1D342, "๐", f09d8d82), +_c(U+1D343, "๐", f09d8d83), +_c(U+1D344, "๐", f09d8d84), +_c(U+1D345, "๐
", f09d8d85), +_c(U+1D346, "๐", f09d8d86), +_c(U+1D347, "๐", f09d8d87), +_c(U+1D348, "๐", f09d8d88), +_c(U+1D349, "๐", f09d8d89), +_c(U+1D34A, "๐", f09d8d8a), +_c(U+1D34B, "๐", f09d8d8b), +_c(U+1D34C, "๐", f09d8d8c), +_c(U+1D34D, "๐", f09d8d8d), +_c(U+1D34E, "๐", f09d8d8e), +_c(U+1D34F, "๐", f09d8d8f), +_c(U+1D350, "๐", f09d8d90), +_c(U+1D351, "๐", f09d8d91), +_c(U+1D352, "๐", f09d8d92), +_c(U+1D353, "๐", f09d8d93), +_c(U+1D354, "๐", f09d8d94), +_c(U+1D355, "๐", f09d8d95), +_c(U+1D356, "๐", f09d8d96), +_c(U+1D357, "๐", f09d8d97), +_c(U+1D358, "๐", f09d8d98), +_c(U+1D359, "๐", f09d8d99), +_c(U+1D35A, "๐", f09d8d9a), +_c(U+1D35B, "๐", f09d8d9b), +_c(U+1D35C, "๐", f09d8d9c), +_c(U+1D35D, "๐", f09d8d9d), +_c(U+1D35E, "๐", f09d8d9e), +_c(U+1D35F, "๐", f09d8d9f), +_c(U+1D360, "๐ ", f09d8da0), +_c(U+1D361, "๐ก", f09d8da1), +_c(U+1D362, "๐ข", f09d8da2), +_c(U+1D363, "๐ฃ", f09d8da3), +_c(U+1D364, "๐ค", f09d8da4), +_c(U+1D365, "๐ฅ", f09d8da5), +_c(U+1D366, "๐ฆ", f09d8da6), +_c(U+1D367, "๐ง", f09d8da7), +_c(U+1D368, "๐จ", f09d8da8), +_c(U+1D369, "๐ฉ", f09d8da9), +_c(U+1D36A, "๐ช", f09d8daa), +_c(U+1D36B, "๐ซ", f09d8dab), +_c(U+1D36C, "๐ฌ", f09d8dac), +_c(U+1D36D, "๐ญ", f09d8dad), +_c(U+1D36E, "๐ฎ", f09d8dae), +_c(U+1D36F, "๐ฏ", f09d8daf), +_c(U+1D370, "๐ฐ", f09d8db0), +_c(U+1D371, "๐ฑ", f09d8db1), +_c(U+1D372, "๐ฒ", f09d8db2), +_c(U+1D373, "๐ณ", f09d8db3), +_c(U+1D374, "๐ด", f09d8db4), +_c(U+1D375, "๐ต", f09d8db5), +_c(U+1D376, "๐ถ", f09d8db6), +_c(U+1D377, "๐ท", f09d8db7), +_c(U+1D378, "๐ธ", f09d8db8), +_c(U+1D379, "๐น", f09d8db9), +_c(U+1D37A, "๐บ", f09d8dba), +_c(U+1D37B, "๐ป", f09d8dbb), +_c(U+1D37C, "๐ผ", f09d8dbc), +_c(U+1D37D, "๐ฝ", f09d8dbd), +_c(U+1D37E, "๐พ", f09d8dbe), +_c(U+1D37F, "๐ฟ", f09d8dbf), +_c(U+1D380, "๐", f09d8e80), +_c(U+1D381, "๐", f09d8e81), +_c(U+1D382, "๐", f09d8e82), +_c(U+1D383, "๐", f09d8e83), +_c(U+1D384, "๐", f09d8e84), +_c(U+1D385, "๐
", f09d8e85), +_c(U+1D386, "๐", f09d8e86), +_c(U+1D387, "๐", f09d8e87), +_c(U+1D388, "๐", f09d8e88), +_c(U+1D389, "๐", f09d8e89), +_c(U+1D38A, "๐", f09d8e8a), +_c(U+1D38B, "๐", f09d8e8b), +_c(U+1D38C, "๐", f09d8e8c), +_c(U+1D38D, "๐", f09d8e8d), +_c(U+1D38E, "๐", f09d8e8e), +_c(U+1D38F, "๐", f09d8e8f), +_c(U+1D390, "๐", f09d8e90), +_c(U+1D391, "๐", f09d8e91), +_c(U+1D392, "๐", f09d8e92), +_c(U+1D393, "๐", f09d8e93), +_c(U+1D394, "๐", f09d8e94), +_c(U+1D395, "๐", f09d8e95), +_c(U+1D396, "๐", f09d8e96), +_c(U+1D397, "๐", f09d8e97), +_c(U+1D398, "๐", f09d8e98), +_c(U+1D399, "๐", f09d8e99), +_c(U+1D39A, "๐", f09d8e9a), +_c(U+1D39B, "๐", f09d8e9b), +_c(U+1D39C, "๐", f09d8e9c), +_c(U+1D39D, "๐", f09d8e9d), +_c(U+1D39E, "๐", f09d8e9e), +_c(U+1D39F, "๐", f09d8e9f), +_c(U+1D3A0, "๐ ", f09d8ea0), +_c(U+1D3A1, "๐ก", f09d8ea1), +_c(U+1D3A2, "๐ข", f09d8ea2), +_c(U+1D3A3, "๐ฃ", f09d8ea3), +_c(U+1D3A4, "๐ค", f09d8ea4), +_c(U+1D3A5, "๐ฅ", f09d8ea5), +_c(U+1D3A6, "๐ฆ", f09d8ea6), +_c(U+1D3A7, "๐ง", f09d8ea7), +_c(U+1D3A8, "๐จ", f09d8ea8), +_c(U+1D3A9, "๐ฉ", f09d8ea9), +_c(U+1D3AA, "๐ช", f09d8eaa), +_c(U+1D3AB, "๐ซ", f09d8eab), +_c(U+1D3AC, "๐ฌ", f09d8eac), +_c(U+1D3AD, "๐ญ", f09d8ead), +_c(U+1D3AE, "๐ฎ", f09d8eae), +_c(U+1D3AF, "๐ฏ", f09d8eaf), +_c(U+1D3B0, "๐ฐ", f09d8eb0), +_c(U+1D3B1, "๐ฑ", f09d8eb1), +_c(U+1D3B2, "๐ฒ", f09d8eb2), +_c(U+1D3B3, "๐ณ", f09d8eb3), +_c(U+1D3B4, "๐ด", f09d8eb4), +_c(U+1D3B5, "๐ต", f09d8eb5), +_c(U+1D3B6, "๐ถ", f09d8eb6), +_c(U+1D3B7, "๐ท", f09d8eb7), +_c(U+1D3B8, "๐ธ", f09d8eb8), +_c(U+1D3B9, "๐น", f09d8eb9), +_c(U+1D3BA, "๐บ", f09d8eba), +_c(U+1D3BB, "๐ป", f09d8ebb), +_c(U+1D3BC, "๐ผ", f09d8ebc), +_c(U+1D3BD, "๐ฝ", f09d8ebd), +_c(U+1D3BE, "๐พ", f09d8ebe), +_c(U+1D3BF, "๐ฟ", f09d8ebf), +_c(U+1D3C0, "๐", f09d8f80), +_c(U+1D3C1, "๐", f09d8f81), +_c(U+1D3C2, "๐", f09d8f82), +_c(U+1D3C3, "๐", f09d8f83), +_c(U+1D3C4, "๐", f09d8f84), +_c(U+1D3C5, "๐
", f09d8f85), +_c(U+1D3C6, "๐", f09d8f86), +_c(U+1D3C7, "๐", f09d8f87), +_c(U+1D3C8, "๐", f09d8f88), +_c(U+1D3C9, "๐", f09d8f89), +_c(U+1D3CA, "๐", f09d8f8a), +_c(U+1D3CB, "๐", f09d8f8b), +_c(U+1D3CC, "๐", f09d8f8c), +_c(U+1D3CD, "๐", f09d8f8d), +_c(U+1D3CE, "๐", f09d8f8e), +_c(U+1D3CF, "๐", f09d8f8f), +_c(U+1D3D0, "๐", f09d8f90), +_c(U+1D3D1, "๐", f09d8f91), +_c(U+1D3D2, "๐", f09d8f92), +_c(U+1D3D3, "๐", f09d8f93), +_c(U+1D3D4, "๐", f09d8f94), +_c(U+1D3D5, "๐", f09d8f95), +_c(U+1D3D6, "๐", f09d8f96), +_c(U+1D3D7, "๐", f09d8f97), +_c(U+1D3D8, "๐", f09d8f98), +_c(U+1D3D9, "๐", f09d8f99), +_c(U+1D3DA, "๐", f09d8f9a), +_c(U+1D3DB, "๐", f09d8f9b), +_c(U+1D3DC, "๐", f09d8f9c), +_c(U+1D3DD, "๐", f09d8f9d), +_c(U+1D3DE, "๐", f09d8f9e), +_c(U+1D3DF, "๐", f09d8f9f), +_c(U+1D3E0, "๐ ", f09d8fa0), +_c(U+1D3E1, "๐ก", f09d8fa1), +_c(U+1D3E2, "๐ข", f09d8fa2), +_c(U+1D3E3, "๐ฃ", f09d8fa3), +_c(U+1D3E4, "๐ค", f09d8fa4), +_c(U+1D3E5, "๐ฅ", f09d8fa5), +_c(U+1D3E6, "๐ฆ", f09d8fa6), +_c(U+1D3E7, "๐ง", f09d8fa7), +_c(U+1D3E8, "๐จ", f09d8fa8), +_c(U+1D3E9, "๐ฉ", f09d8fa9), +_c(U+1D3EA, "๐ช", f09d8faa), +_c(U+1D3EB, "๐ซ", f09d8fab), +_c(U+1D3EC, "๐ฌ", f09d8fac), +_c(U+1D3ED, "๐ญ", f09d8fad), +_c(U+1D3EE, "๐ฎ", f09d8fae), +_c(U+1D3EF, "๐ฏ", f09d8faf), +_c(U+1D3F0, "๐ฐ", f09d8fb0), +_c(U+1D3F1, "๐ฑ", f09d8fb1), +_c(U+1D3F2, "๐ฒ", f09d8fb2), +_c(U+1D3F3, "๐ณ", f09d8fb3), +_c(U+1D3F4, "๐ด", f09d8fb4), +_c(U+1D3F5, "๐ต", f09d8fb5), +_c(U+1D3F6, "๐ถ", f09d8fb6), +_c(U+1D3F7, "๐ท", f09d8fb7), +_c(U+1D3F8, "๐ธ", f09d8fb8), +_c(U+1D3F9, "๐น", f09d8fb9), +_c(U+1D3FA, "๐บ", f09d8fba), +_c(U+1D3FB, "๐ป", f09d8fbb), +_c(U+1D3FC, "๐ผ", f09d8fbc), +_c(U+1D3FD, "๐ฝ", f09d8fbd), +_c(U+1D3FE, "๐พ", f09d8fbe), +_c(U+1D3FF, "๐ฟ", f09d8fbf), +_c(U+1D400, "๐", f09d9080), +_c(U+1D401, "๐", f09d9081), +_c(U+1D402, "๐", f09d9082), +_c(U+1D403, "๐", f09d9083), +_c(U+1D404, "๐", f09d9084), +_c(U+1D405, "๐
", f09d9085), +_c(U+1D406, "๐", f09d9086), +_c(U+1D407, "๐", f09d9087), +_c(U+1D408, "๐", f09d9088), +_c(U+1D409, "๐", f09d9089), +_c(U+1D40A, "๐", f09d908a), +_c(U+1D40B, "๐", f09d908b), +_c(U+1D40C, "๐", f09d908c), +_c(U+1D40D, "๐", f09d908d), +_c(U+1D40E, "๐", f09d908e), +_c(U+1D40F, "๐", f09d908f), +_c(U+1D410, "๐", f09d9090), +_c(U+1D411, "๐", f09d9091), +_c(U+1D412, "๐", f09d9092), +_c(U+1D413, "๐", f09d9093), +_c(U+1D414, "๐", f09d9094), +_c(U+1D415, "๐", f09d9095), +_c(U+1D416, "๐", f09d9096), +_c(U+1D417, "๐", f09d9097), +_c(U+1D418, "๐", f09d9098), +_c(U+1D419, "๐", f09d9099), +_c(U+1D41A, "๐", f09d909a), +_c(U+1D41B, "๐", f09d909b), +_c(U+1D41C, "๐", f09d909c), +_c(U+1D41D, "๐", f09d909d), +_c(U+1D41E, "๐", f09d909e), +_c(U+1D41F, "๐", f09d909f), +_c(U+1D420, "๐ ", f09d90a0), +_c(U+1D421, "๐ก", f09d90a1), +_c(U+1D422, "๐ข", f09d90a2), +_c(U+1D423, "๐ฃ", f09d90a3), +_c(U+1D424, "๐ค", f09d90a4), +_c(U+1D425, "๐ฅ", f09d90a5), +_c(U+1D426, "๐ฆ", f09d90a6), +_c(U+1D427, "๐ง", f09d90a7), +_c(U+1D428, "๐จ", f09d90a8), +_c(U+1D429, "๐ฉ", f09d90a9), +_c(U+1D42A, "๐ช", f09d90aa), +_c(U+1D42B, "๐ซ", f09d90ab), +_c(U+1D42C, "๐ฌ", f09d90ac), +_c(U+1D42D, "๐ญ", f09d90ad), +_c(U+1D42E, "๐ฎ", f09d90ae), +_c(U+1D42F, "๐ฏ", f09d90af), +_c(U+1D430, "๐ฐ", f09d90b0), +_c(U+1D431, "๐ฑ", f09d90b1), +_c(U+1D432, "๐ฒ", f09d90b2), +_c(U+1D433, "๐ณ", f09d90b3), +_c(U+1D434, "๐ด", f09d90b4), +_c(U+1D435, "๐ต", f09d90b5), +_c(U+1D436, "๐ถ", f09d90b6), +_c(U+1D437, "๐ท", f09d90b7), +_c(U+1D438, "๐ธ", f09d90b8), +_c(U+1D439, "๐น", f09d90b9), +_c(U+1D43A, "๐บ", f09d90ba), +_c(U+1D43B, "๐ป", f09d90bb), +_c(U+1D43C, "๐ผ", f09d90bc), +_c(U+1D43D, "๐ฝ", f09d90bd), +_c(U+1D43E, "๐พ", f09d90be), +_c(U+1D43F, "๐ฟ", f09d90bf), +_c(U+1D440, "๐", f09d9180), +_c(U+1D441, "๐", f09d9181), +_c(U+1D442, "๐", f09d9182), +_c(U+1D443, "๐", f09d9183), +_c(U+1D444, "๐", f09d9184), +_c(U+1D445, "๐
", f09d9185), +_c(U+1D446, "๐", f09d9186), +_c(U+1D447, "๐", f09d9187), +_c(U+1D448, "๐", f09d9188), +_c(U+1D449, "๐", f09d9189), +_c(U+1D44A, "๐", f09d918a), +_c(U+1D44B, "๐", f09d918b), +_c(U+1D44C, "๐", f09d918c), +_c(U+1D44D, "๐", f09d918d), +_c(U+1D44E, "๐", f09d918e), +_c(U+1D44F, "๐", f09d918f), +_c(U+1D450, "๐", f09d9190), +_c(U+1D451, "๐", f09d9191), +_c(U+1D452, "๐", f09d9192), +_c(U+1D453, "๐", f09d9193), +_c(U+1D454, "๐", f09d9194), +_c(U+1D455, "๐", f09d9195), +_c(U+1D456, "๐", f09d9196), +_c(U+1D457, "๐", f09d9197), +_c(U+1D458, "๐", f09d9198), +_c(U+1D459, "๐", f09d9199), +_c(U+1D45A, "๐", f09d919a), +_c(U+1D45B, "๐", f09d919b), +_c(U+1D45C, "๐", f09d919c), +_c(U+1D45D, "๐", f09d919d), +_c(U+1D45E, "๐", f09d919e), +_c(U+1D45F, "๐", f09d919f), +_c(U+1D460, "๐ ", f09d91a0), +_c(U+1D461, "๐ก", f09d91a1), +_c(U+1D462, "๐ข", f09d91a2), +_c(U+1D463, "๐ฃ", f09d91a3), +_c(U+1D464, "๐ค", f09d91a4), +_c(U+1D465, "๐ฅ", f09d91a5), +_c(U+1D466, "๐ฆ", f09d91a6), +_c(U+1D467, "๐ง", f09d91a7), +_c(U+1D468, "๐จ", f09d91a8), +_c(U+1D469, "๐ฉ", f09d91a9), +_c(U+1D46A, "๐ช", f09d91aa), +_c(U+1D46B, "๐ซ", f09d91ab), +_c(U+1D46C, "๐ฌ", f09d91ac), +_c(U+1D46D, "๐ญ", f09d91ad), +_c(U+1D46E, "๐ฎ", f09d91ae), +_c(U+1D46F, "๐ฏ", f09d91af), +_c(U+1D470, "๐ฐ", f09d91b0), +_c(U+1D471, "๐ฑ", f09d91b1), +_c(U+1D472, "๐ฒ", f09d91b2), +_c(U+1D473, "๐ณ", f09d91b3), +_c(U+1D474, "๐ด", f09d91b4), +_c(U+1D475, "๐ต", f09d91b5), +_c(U+1D476, "๐ถ", f09d91b6), +_c(U+1D477, "๐ท", f09d91b7), +_c(U+1D478, "๐ธ", f09d91b8), +_c(U+1D479, "๐น", f09d91b9), +_c(U+1D47A, "๐บ", f09d91ba), +_c(U+1D47B, "๐ป", f09d91bb), +_c(U+1D47C, "๐ผ", f09d91bc), +_c(U+1D47D, "๐ฝ", f09d91bd), +_c(U+1D47E, "๐พ", f09d91be), +_c(U+1D47F, "๐ฟ", f09d91bf), +_c(U+1D480, "๐", f09d9280), +_c(U+1D481, "๐", f09d9281), +_c(U+1D482, "๐", f09d9282), +_c(U+1D483, "๐", f09d9283), +_c(U+1D484, "๐", f09d9284), +_c(U+1D485, "๐
", f09d9285), +_c(U+1D486, "๐", f09d9286), +_c(U+1D487, "๐", f09d9287), +_c(U+1D488, "๐", f09d9288), +_c(U+1D489, "๐", f09d9289), +_c(U+1D48A, "๐", f09d928a), +_c(U+1D48B, "๐", f09d928b), +_c(U+1D48C, "๐", f09d928c), +_c(U+1D48D, "๐", f09d928d), +_c(U+1D48E, "๐", f09d928e), +_c(U+1D48F, "๐", f09d928f), +_c(U+1D490, "๐", f09d9290), +_c(U+1D491, "๐", f09d9291), +_c(U+1D492, "๐", f09d9292), +_c(U+1D493, "๐", f09d9293), +_c(U+1D494, "๐", f09d9294), +_c(U+1D495, "๐", f09d9295), +_c(U+1D496, "๐", f09d9296), +_c(U+1D497, "๐", f09d9297), +_c(U+1D498, "๐", f09d9298), +_c(U+1D499, "๐", f09d9299), +_c(U+1D49A, "๐", f09d929a), +_c(U+1D49B, "๐", f09d929b), +_c(U+1D49C, "๐", f09d929c), +_c(U+1D49D, "๐", f09d929d), +_c(U+1D49E, "๐", f09d929e), +_c(U+1D49F, "๐", f09d929f), +_c(U+1D4A0, "๐ ", f09d92a0), +_c(U+1D4A1, "๐ก", f09d92a1), +_c(U+1D4A2, "๐ข", f09d92a2), +_c(U+1D4A3, "๐ฃ", f09d92a3), +_c(U+1D4A4, "๐ค", f09d92a4), +_c(U+1D4A5, "๐ฅ", f09d92a5), +_c(U+1D4A6, "๐ฆ", f09d92a6), +_c(U+1D4A7, "๐ง", f09d92a7), +_c(U+1D4A8, "๐จ", f09d92a8), +_c(U+1D4A9, "๐ฉ", f09d92a9), +_c(U+1D4AA, "๐ช", f09d92aa), +_c(U+1D4AB, "๐ซ", f09d92ab), +_c(U+1D4AC, "๐ฌ", f09d92ac), +_c(U+1D4AD, "๐ญ", f09d92ad), +_c(U+1D4AE, "๐ฎ", f09d92ae), +_c(U+1D4AF, "๐ฏ", f09d92af), +_c(U+1D4B0, "๐ฐ", f09d92b0), +_c(U+1D4B1, "๐ฑ", f09d92b1), +_c(U+1D4B2, "๐ฒ", f09d92b2), +_c(U+1D4B3, "๐ณ", f09d92b3), +_c(U+1D4B4, "๐ด", f09d92b4), +_c(U+1D4B5, "๐ต", f09d92b5), +_c(U+1D4B6, "๐ถ", f09d92b6), +_c(U+1D4B7, "๐ท", f09d92b7), +_c(U+1D4B8, "๐ธ", f09d92b8), +_c(U+1D4B9, "๐น", f09d92b9), +_c(U+1D4BA, "๐บ", f09d92ba), +_c(U+1D4BB, "๐ป", f09d92bb), +_c(U+1D4BC, "๐ผ", f09d92bc), +_c(U+1D4BD, "๐ฝ", f09d92bd), +_c(U+1D4BE, "๐พ", f09d92be), +_c(U+1D4BF, "๐ฟ", f09d92bf), +_c(U+1D4C0, "๐", f09d9380), +_c(U+1D4C1, "๐", f09d9381), +_c(U+1D4C2, "๐", f09d9382), +_c(U+1D4C3, "๐", f09d9383), +_c(U+1D4C4, "๐", f09d9384), +_c(U+1D4C5, "๐
", f09d9385), +_c(U+1D4C6, "๐", f09d9386), +_c(U+1D4C7, "๐", f09d9387), +_c(U+1D4C8, "๐", f09d9388), +_c(U+1D4C9, "๐", f09d9389), +_c(U+1D4CA, "๐", f09d938a), +_c(U+1D4CB, "๐", f09d938b), +_c(U+1D4CC, "๐", f09d938c), +_c(U+1D4CD, "๐", f09d938d), +_c(U+1D4CE, "๐", f09d938e), +_c(U+1D4CF, "๐", f09d938f), +_c(U+1D4D0, "๐", f09d9390), +_c(U+1D4D1, "๐", f09d9391), +_c(U+1D4D2, "๐", f09d9392), +_c(U+1D4D3, "๐", f09d9393), +_c(U+1D4D4, "๐", f09d9394), +_c(U+1D4D5, "๐", f09d9395), +_c(U+1D4D6, "๐", f09d9396), +_c(U+1D4D7, "๐", f09d9397), +_c(U+1D4D8, "๐", f09d9398), +_c(U+1D4D9, "๐", f09d9399), +_c(U+1D4DA, "๐", f09d939a), +_c(U+1D4DB, "๐", f09d939b), +_c(U+1D4DC, "๐", f09d939c), +_c(U+1D4DD, "๐", f09d939d), +_c(U+1D4DE, "๐", f09d939e), +_c(U+1D4DF, "๐", f09d939f), +_c(U+1D4E0, "๐ ", f09d93a0), +_c(U+1D4E1, "๐ก", f09d93a1), +_c(U+1D4E2, "๐ข", f09d93a2), +_c(U+1D4E3, "๐ฃ", f09d93a3), +_c(U+1D4E4, "๐ค", f09d93a4), +_c(U+1D4E5, "๐ฅ", f09d93a5), +_c(U+1D4E6, "๐ฆ", f09d93a6), +_c(U+1D4E7, "๐ง", f09d93a7), +_c(U+1D4E8, "๐จ", f09d93a8), +_c(U+1D4E9, "๐ฉ", f09d93a9), +_c(U+1D4EA, "๐ช", f09d93aa), +_c(U+1D4EB, "๐ซ", f09d93ab), +_c(U+1D4EC, "๐ฌ", f09d93ac), +_c(U+1D4ED, "๐ญ", f09d93ad), +_c(U+1D4EE, "๐ฎ", f09d93ae), +_c(U+1D4EF, "๐ฏ", f09d93af), +_c(U+1D4F0, "๐ฐ", f09d93b0), +_c(U+1D4F1, "๐ฑ", f09d93b1), +_c(U+1D4F2, "๐ฒ", f09d93b2), +_c(U+1D4F3, "๐ณ", f09d93b3), +_c(U+1D4F4, "๐ด", f09d93b4), +_c(U+1D4F5, "๐ต", f09d93b5), +_c(U+1D4F6, "๐ถ", f09d93b6), +_c(U+1D4F7, "๐ท", f09d93b7), +_c(U+1D4F8, "๐ธ", f09d93b8), +_c(U+1D4F9, "๐น", f09d93b9), +_c(U+1D4FA, "๐บ", f09d93ba), +_c(U+1D4FB, "๐ป", f09d93bb), +_c(U+1D4FC, "๐ผ", f09d93bc), +_c(U+1D4FD, "๐ฝ", f09d93bd), +_c(U+1D4FE, "๐พ", f09d93be), +_c(U+1D4FF, "๐ฟ", f09d93bf), +_c(U+1F600, "๐", f09f9880), +_c(U+1F601, "๐", f09f9881), +_c(U+1F602, "๐", f09f9882), +_c(U+1F603, "๐", f09f9883), +_c(U+1F604, "๐", f09f9884), +_c(U+1F605, "๐
", f09f9885), +_c(U+1F606, "๐", f09f9886), +_c(U+1F607, "๐", f09f9887), +_c(U+1F608, "๐", f09f9888), +_c(U+1F609, "๐", f09f9889), +_c(U+1F60A, "๐", f09f988a), +_c(U+1F60B, "๐", f09f988b), +_c(U+1F60C, "๐", f09f988c), +_c(U+1F60D, "๐", f09f988d), +_c(U+1F60E, "๐", f09f988e), +_c(U+1F60F, "๐", f09f988f), +_c(U+1F610, "๐", f09f9890), +_c(U+1F611, "๐", f09f9891), +_c(U+1F612, "๐", f09f9892), +_c(U+1F613, "๐", f09f9893), +_c(U+1F614, "๐", f09f9894), +_c(U+1F615, "๐", f09f9895), +_c(U+1F616, "๐", f09f9896), +_c(U+1F617, "๐", f09f9897), +_c(U+1F618, "๐", f09f9898), +_c(U+1F619, "๐", f09f9899), +_c(U+1F61A, "๐", f09f989a), +_c(U+1F61B, "๐", f09f989b), +_c(U+1F61C, "๐", f09f989c), +_c(U+1F61D, "๐", f09f989d), +_c(U+1F61E, "๐", f09f989e), +_c(U+1F61F, "๐", f09f989f), +_c(U+1F620, "๐ ", f09f98a0), +_c(U+1F621, "๐ก", f09f98a1), +_c(U+1F622, "๐ข", f09f98a2), +_c(U+1F623, "๐ฃ", f09f98a3), +_c(U+1F624, "๐ค", f09f98a4), +_c(U+1F625, "๐ฅ", f09f98a5), +_c(U+1F626, "๐ฆ", f09f98a6), +_c(U+1F627, "๐ง", f09f98a7), +_c(U+1F628, "๐จ", f09f98a8), +_c(U+1F629, "๐ฉ", f09f98a9), +_c(U+1F62A, "๐ช", f09f98aa), +_c(U+1F62B, "๐ซ", f09f98ab), +_c(U+1F62C, "๐ฌ", f09f98ac), +_c(U+1F62D, "๐ญ", f09f98ad), +_c(U+1F62E, "๐ฎ", f09f98ae), +_c(U+1F62F, "๐ฏ", f09f98af), +_c(U+1F630, "๐ฐ", f09f98b0), +_c(U+1F631, "๐ฑ", f09f98b1), +_c(U+1F632, "๐ฒ", f09f98b2), +_c(U+1F633, "๐ณ", f09f98b3), +_c(U+1F634, "๐ด", f09f98b4), +_c(U+1F635, "๐ต", f09f98b5), +_c(U+1F636, "๐ถ", f09f98b6), +_c(U+1F637, "๐ท", f09f98b7), +_c(U+1F638, "๐ธ", f09f98b8), +_c(U+1F639, "๐น", f09f98b9), +_c(U+1F63A, "๐บ", f09f98ba), +_c(U+1F63B, "๐ป", f09f98bb), +_c(U+1F63C, "๐ผ", f09f98bc), +_c(U+1F63D, "๐ฝ", f09f98bd), +_c(U+1F63E, "๐พ", f09f98be), +_c(U+1F63F, "๐ฟ", f09f98bf), +_c(U+1F640, "๐", f09f9980), +_c(U+1F641, "๐", f09f9981), +_c(U+1F642, "๐", f09f9982), +_c(U+1F643, "๐", f09f9983), +_c(U+1F644, "๐", f09f9984), +_c(U+1F645, "๐
", f09f9985), +_c(U+1F646, "๐", f09f9986), +_c(U+1F647, "๐", f09f9987), +_c(U+1F648, "๐", f09f9988), +_c(U+1F649, "๐", f09f9989), +_c(U+1F64A, "๐", f09f998a), +_c(U+1F64B, "๐", f09f998b), +_c(U+1F64C, "๐", f09f998c), +_c(U+1F64D, "๐", f09f998d), +_c(U+1F64E, "๐", f09f998e), +_c(U+1F64F, "๐", f09f998f), +_c(U+1F650, "๐", f09f9990), +_c(U+1F651, "๐", f09f9991), +_c(U+1F652, "๐", f09f9992), +_c(U+1F653, "๐", f09f9993), +_c(U+1F654, "๐", f09f9994), +_c(U+1F655, "๐", f09f9995), +_c(U+1F656, "๐", f09f9996), +_c(U+1F657, "๐", f09f9997), +_c(U+1F658, "๐", f09f9998), +_c(U+1F659, "๐", f09f9999), +_c(U+1F65A, "๐", f09f999a), +_c(U+1F65B, "๐", f09f999b), +_c(U+1F65C, "๐", f09f999c), +_c(U+1F65D, "๐", f09f999d), +_c(U+1F65E, "๐", f09f999e), +_c(U+1F65F, "๐", f09f999f), +_c(U+1F660, "๐ ", f09f99a0), +_c(U+1F661, "๐ก", f09f99a1), +_c(U+1F662, "๐ข", f09f99a2), +_c(U+1F663, "๐ฃ", f09f99a3), +_c(U+1F664, "๐ค", f09f99a4), +_c(U+1F665, "๐ฅ", f09f99a5), +_c(U+1F666, "๐ฆ", f09f99a6), +_c(U+1F667, "๐ง", f09f99a7), +_c(U+1F668, "๐จ", f09f99a8), +_c(U+1F669, "๐ฉ", f09f99a9), +_c(U+1F66A, "๐ช", f09f99aa), +_c(U+1F66B, "๐ซ", f09f99ab), +_c(U+1F66C, "๐ฌ", f09f99ac), +_c(U+1F66D, "๐ญ", f09f99ad), +_c(U+1F66E, "๐ฎ", f09f99ae), +_c(U+1F66F, "๐ฏ", f09f99af), +_c(U+1F670, "๐ฐ", f09f99b0), +_c(U+1F671, "๐ฑ", f09f99b1), +_c(U+1F672, "๐ฒ", f09f99b2), +_c(U+1F673, "๐ณ", f09f99b3), +_c(U+1F674, "๐ด", f09f99b4), +_c(U+1F675, "๐ต", f09f99b5), +_c(U+1F676, "๐ถ", f09f99b6), +_c(U+1F677, "๐ท", f09f99b7), +_c(U+1F678, "๐ธ", f09f99b8), +_c(U+1F679, "๐น", f09f99b9), +_c(U+1F67A, "๐บ", f09f99ba), +_c(U+1F67B, "๐ป", f09f99bb), +_c(U+1F67C, "๐ผ", f09f99bc), +_c(U+1F67D, "๐ฝ", f09f99bd), +_c(U+1F67E, "๐พ", f09f99be), +_c(U+1F67F, "๐ฟ", f09f99bf), +_c(U+1F680, "๐", f09f9a80), +_c(U+1F681, "๐", f09f9a81), +_c(U+1F682, "๐", f09f9a82), +_c(U+1F683, "๐", f09f9a83), +_c(U+1F684, "๐", f09f9a84), +_c(U+1F685, "๐
", f09f9a85), +_c(U+1F686, "๐", f09f9a86), +_c(U+1F687, "๐", f09f9a87), +_c(U+1F688, "๐", f09f9a88), +_c(U+1F689, "๐", f09f9a89), +_c(U+1F68A, "๐", f09f9a8a), +_c(U+1F68B, "๐", f09f9a8b), +_c(U+1F68C, "๐", f09f9a8c), +_c(U+1F68D, "๐", f09f9a8d), +_c(U+1F68E, "๐", f09f9a8e), +_c(U+1F68F, "๐", f09f9a8f), +_c(U+1F690, "๐", f09f9a90), +_c(U+1F691, "๐", f09f9a91), +_c(U+1F692, "๐", f09f9a92), +_c(U+1F693, "๐", f09f9a93), +_c(U+1F694, "๐", f09f9a94), +_c(U+1F695, "๐", f09f9a95), +_c(U+1F696, "๐", f09f9a96), +_c(U+1F697, "๐", f09f9a97), +_c(U+1F698, "๐", f09f9a98), +_c(U+1F699, "๐", f09f9a99), +_c(U+1F69A, "๐", f09f9a9a), +_c(U+1F69B, "๐", f09f9a9b), +_c(U+1F69C, "๐", f09f9a9c), +_c(U+1F69D, "๐", f09f9a9d), +_c(U+1F69E, "๐", f09f9a9e), +_c(U+1F69F, "๐", f09f9a9f), +_c(U+1F6A0, "๐ ", f09f9aa0), +_c(U+1F6A1, "๐ก", f09f9aa1), +_c(U+1F6A2, "๐ข", f09f9aa2), +_c(U+1F6A3, "๐ฃ", f09f9aa3), +_c(U+1F6A4, "๐ค", f09f9aa4), +_c(U+1F6A5, "๐ฅ", f09f9aa5), +_c(U+1F6A6, "๐ฆ", f09f9aa6), +_c(U+1F6A7, "๐ง", f09f9aa7), +_c(U+1F6A8, "๐จ", f09f9aa8), +_c(U+1F6A9, "๐ฉ", f09f9aa9), +_c(U+1F6AA, "๐ช", f09f9aaa), +_c(U+1F6AB, "๐ซ", f09f9aab), +_c(U+1F6AC, "๐ฌ", f09f9aac), +_c(U+1F6AD, "๐ญ", f09f9aad), +_c(U+1F6AE, "๐ฎ", f09f9aae), +_c(U+1F6AF, "๐ฏ", f09f9aaf), +_c(U+1F6B0, "๐ฐ", f09f9ab0), +_c(U+1F6B1, "๐ฑ", f09f9ab1), +_c(U+1F6B2, "๐ฒ", f09f9ab2), +_c(U+1F6B3, "๐ณ", f09f9ab3), +_c(U+1F6B4, "๐ด", f09f9ab4), +_c(U+1F6B5, "๐ต", f09f9ab5), +_c(U+1F6B6, "๐ถ", f09f9ab6), +_c(U+1F6B7, "๐ท", f09f9ab7), +_c(U+1F6B8, "๐ธ", f09f9ab8), +_c(U+1F6B9, "๐น", f09f9ab9), +_c(U+1F6BA, "๐บ", f09f9aba), +_c(U+1F6BB, "๐ป", f09f9abb), +_c(U+1F6BC, "๐ผ", f09f9abc), +_c(U+1F6BD, "๐ฝ", f09f9abd), +_c(U+1F6BE, "๐พ", f09f9abe), +_c(U+1F6BF, "๐ฟ", f09f9abf), +_c(U+1F6C0, "๐", f09f9b80), +_c(U+1F6C1, "๐", f09f9b81), +_c(U+1F6C2, "๐", f09f9b82), +_c(U+1F6C3, "๐", f09f9b83), +_c(U+1F6C4, "๐", f09f9b84), +_c(U+1F6C5, "๐
", f09f9b85), +_c(U+1F6C6, "๐", f09f9b86), +_c(U+1F6C7, "๐", f09f9b87), +_c(U+1F6C8, "๐", f09f9b88), +_c(U+1F6C9, "๐", f09f9b89), +_c(U+1F6CA, "๐", f09f9b8a), +_c(U+1F6CB, "๐", f09f9b8b), +_c(U+1F6CC, "๐", f09f9b8c), +_c(U+1F6CD, "๐", f09f9b8d), +_c(U+1F6CE, "๐", f09f9b8e), +_c(U+1F6CF, "๐", f09f9b8f), +_c(U+1F6D0, "๐", f09f9b90), +_c(U+1F6D1, "๐", f09f9b91), +_c(U+1F6D2, "๐", f09f9b92), +_c(U+1F6D3, "๐", f09f9b93), +_c(U+1F6D4, "๐", f09f9b94), +_c(U+1F6D5, "๐", f09f9b95), +_c(U+1F6D6, "๐", f09f9b96), +_c(U+1F6D7, "๐", f09f9b97), +_c(U+1F6D8, "๐", f09f9b98), +_c(U+1F6D9, "๐", f09f9b99), +_c(U+1F6DA, "๐", f09f9b9a), +_c(U+1F6DB, "๐", f09f9b9b), +_c(U+1F6DC, "๐", f09f9b9c), +_c(U+1F6DD, "๐", f09f9b9d), +_c(U+1F6DE, "๐", f09f9b9e), +_c(U+1F6DF, "๐", f09f9b9f), +_c(U+1F6E0, "๐ ", f09f9ba0), +_c(U+1F6E1, "๐ก", f09f9ba1), +_c(U+1F6E2, "๐ข", f09f9ba2), +_c(U+1F6E3, "๐ฃ", f09f9ba3), +_c(U+1F6E4, "๐ค", f09f9ba4), +_c(U+1F6E5, "๐ฅ", f09f9ba5), +_c(U+1F6E6, "๐ฆ", f09f9ba6), +_c(U+1F6E7, "๐ง", f09f9ba7), +_c(U+1F6E8, "๐จ", f09f9ba8), +_c(U+1F6E9, "๐ฉ", f09f9ba9), +_c(U+1F6EA, "๐ช", f09f9baa), +_c(U+1F6EB, "๐ซ", f09f9bab), +_c(U+1F6EC, "๐ฌ", f09f9bac), +_c(U+1F6ED, "๐ญ", f09f9bad), +_c(U+1F6EE, "๐ฎ", f09f9bae), +_c(U+1F6EF, "๐ฏ", f09f9baf), +_c(U+1F6F0, "๐ฐ", f09f9bb0), +_c(U+1F6F1, "๐ฑ", f09f9bb1), +_c(U+1F6F2, "๐ฒ", f09f9bb2), +_c(U+1F6F3, "๐ณ", f09f9bb3), +_c(U+1F6F4, "๐ด", f09f9bb4), +_c(U+1F6F5, "๐ต", f09f9bb5), +_c(U+1F6F6, "๐ถ", f09f9bb6), +_c(U+1F6F7, "๐ท", f09f9bb7), +_c(U+1F6F8, "๐ธ", f09f9bb8), +_c(U+1F6F9, "๐น", f09f9bb9), +_c(U+1F6FA, "๐บ", f09f9bba), +_c(U+1F6FB, "๐ป", f09f9bbb), +_c(U+1F6FC, "๐ผ", f09f9bbc), +_c(U+1F6FD, "๐ฝ", f09f9bbd), +_c(U+1F6FE, "๐พ", f09f9bbe), +_c(U+1F6FF, "๐ฟ", f09f9bbf), +_c(U+1F700, "๐", f09f9c80), +_c(U+1F701, "๐", f09f9c81), +_c(U+1F702, "๐", f09f9c82), +_c(U+1F703, "๐", f09f9c83), +_c(U+1F704, "๐", f09f9c84), +_c(U+1F705, "๐
", f09f9c85), +_c(U+1F706, "๐", f09f9c86), +_c(U+1F707, "๐", f09f9c87), +_c(U+1F708, "๐", f09f9c88), +_c(U+1F709, "๐", f09f9c89), +_c(U+1F70A, "๐", f09f9c8a), +_c(U+1F70B, "๐", f09f9c8b), +_c(U+1F70C, "๐", f09f9c8c), +_c(U+1F70D, "๐", f09f9c8d), +_c(U+1F70E, "๐", f09f9c8e), +_c(U+1F70F, "๐", f09f9c8f), +_c(U+1F710, "๐", f09f9c90), +_c(U+1F711, "๐", f09f9c91), +_c(U+1F712, "๐", f09f9c92), +_c(U+1F713, "๐", f09f9c93), +_c(U+1F714, "๐", f09f9c94), +_c(U+1F715, "๐", f09f9c95), +_c(U+1F716, "๐", f09f9c96), +_c(U+1F717, "๐", f09f9c97), +_c(U+1F718, "๐", f09f9c98), +_c(U+1F719, "๐", f09f9c99), +_c(U+1F71A, "๐", f09f9c9a), +_c(U+1F71B, "๐", f09f9c9b), +_c(U+1F71C, "๐", f09f9c9c), +_c(U+1F71D, "๐", f09f9c9d), +_c(U+1F71E, "๐", f09f9c9e), +_c(U+1F71F, "๐", f09f9c9f), +_c(U+1F720, "๐ ", f09f9ca0), +_c(U+1F721, "๐ก", f09f9ca1), +_c(U+1F722, "๐ข", f09f9ca2), +_c(U+1F723, "๐ฃ", f09f9ca3), +_c(U+1F724, "๐ค", f09f9ca4), +_c(U+1F725, "๐ฅ", f09f9ca5), +_c(U+1F726, "๐ฆ", f09f9ca6), +_c(U+1F727, "๐ง", f09f9ca7), +_c(U+1F728, "๐จ", f09f9ca8), +_c(U+1F729, "๐ฉ", f09f9ca9), +_c(U+1F72A, "๐ช", f09f9caa), +_c(U+1F72B, "๐ซ", f09f9cab), +_c(U+1F72C, "๐ฌ", f09f9cac), +_c(U+1F72D, "๐ญ", f09f9cad), +_c(U+1F72E, "๐ฎ", f09f9cae), +_c(U+1F72F, "๐ฏ", f09f9caf), +_c(U+1F730, "๐ฐ", f09f9cb0), +_c(U+1F731, "๐ฑ", f09f9cb1), +_c(U+1F732, "๐ฒ", f09f9cb2), +_c(U+1F733, "๐ณ", f09f9cb3), +_c(U+1F734, "๐ด", f09f9cb4), +_c(U+1F735, "๐ต", f09f9cb5), +_c(U+1F736, "๐ถ", f09f9cb6), +_c(U+1F737, "๐ท", f09f9cb7), +_c(U+1F738, "๐ธ", f09f9cb8), +_c(U+1F739, "๐น", f09f9cb9), +_c(U+1F73A, "๐บ", f09f9cba), +_c(U+1F73B, "๐ป", f09f9cbb), +_c(U+1F73C, "๐ผ", f09f9cbc), +_c(U+1F73D, "๐ฝ", f09f9cbd), +_c(U+1F73E, "๐พ", f09f9cbe), +_c(U+1F73F, "๐ฟ", f09f9cbf), +_c(U+1F740, "๐", f09f9d80), +_c(U+1F741, "๐", f09f9d81), +_c(U+1F742, "๐", f09f9d82), +_c(U+1F743, "๐", f09f9d83), +_c(U+1F744, "๐", f09f9d84), +_c(U+1F745, "๐
", f09f9d85), +_c(U+1F746, "๐", f09f9d86), +_c(U+1F747, "๐", f09f9d87), +_c(U+1F748, "๐", f09f9d88), +_c(U+1F749, "๐", f09f9d89), +_c(U+1F74A, "๐", f09f9d8a), +_c(U+1F74B, "๐", f09f9d8b), +_c(U+1F74C, "๐", f09f9d8c), +_c(U+1F74D, "๐", f09f9d8d), +_c(U+1F74E, "๐", f09f9d8e), +_c(U+1F74F, "๐", f09f9d8f), +_c(U+1F750, "๐", f09f9d90), +_c(U+1F751, "๐", f09f9d91), +_c(U+1F752, "๐", f09f9d92), +_c(U+1F753, "๐", f09f9d93), +_c(U+1F754, "๐", f09f9d94), +_c(U+1F755, "๐", f09f9d95), +_c(U+1F756, "๐", f09f9d96), +_c(U+1F757, "๐", f09f9d97), +_c(U+1F758, "๐", f09f9d98), +_c(U+1F759, "๐", f09f9d99), +_c(U+1F75A, "๐", f09f9d9a), +_c(U+1F75B, "๐", f09f9d9b), +_c(U+1F75C, "๐", f09f9d9c), +_c(U+1F75D, "๐", f09f9d9d), +_c(U+1F75E, "๐", f09f9d9e), +_c(U+1F75F, "๐", f09f9d9f), +_c(U+1F760, "๐ ", f09f9da0), +_c(U+1F761, "๐ก", f09f9da1), +_c(U+1F762, "๐ข", f09f9da2), +_c(U+1F763, "๐ฃ", f09f9da3), +_c(U+1F764, "๐ค", f09f9da4), +_c(U+1F765, "๐ฅ", f09f9da5), +_c(U+1F766, "๐ฆ", f09f9da6), +_c(U+1F767, "๐ง", f09f9da7), +_c(U+1F768, "๐จ", f09f9da8), +_c(U+1F769, "๐ฉ", f09f9da9), +_c(U+1F76A, "๐ช", f09f9daa), +_c(U+1F76B, "๐ซ", f09f9dab), +_c(U+1F76C, "๐ฌ", f09f9dac), +_c(U+1F76D, "๐ญ", f09f9dad), +_c(U+1F76E, "๐ฎ", f09f9dae), +_c(U+1F76F, "๐ฏ", f09f9daf), +_c(U+1F770, "๐ฐ", f09f9db0), +_c(U+1F771, "๐ฑ", f09f9db1), +_c(U+1F772, "๐ฒ", f09f9db2), +_c(U+1F773, "๐ณ", f09f9db3), +_c(U+1F774, "๐ด", f09f9db4), +_c(U+1F775, "๐ต", f09f9db5), +_c(U+1F776, "๐ถ", f09f9db6), +_c(U+1F777, "๐ท", f09f9db7), +_c(U+1F778, "๐ธ", f09f9db8), +_c(U+1F779, "๐น", f09f9db9), +_c(U+1F77A, "๐บ", f09f9dba), +_c(U+1F77B, "๐ป", f09f9dbb), +_c(U+1F77C, "๐ผ", f09f9dbc), +_c(U+1F77D, "๐ฝ", f09f9dbd), +_c(U+1F77E, "๐พ", f09f9dbe), +_c(U+1F77F, "๐ฟ", f09f9dbf), +_c(U+1F780, "๐", f09f9e80), +_c(U+1F781, "๐", f09f9e81), +_c(U+1F782, "๐", f09f9e82), +_c(U+1F783, "๐", f09f9e83), +_c(U+1F784, "๐", f09f9e84), +_c(U+1F785, "๐
", f09f9e85), +_c(U+1F786, "๐", f09f9e86), +_c(U+1F787, "๐", f09f9e87), +_c(U+1F788, "๐", f09f9e88), +_c(U+1F789, "๐", f09f9e89), +_c(U+1F78A, "๐", f09f9e8a), +_c(U+1F78B, "๐", f09f9e8b), +_c(U+1F78C, "๐", f09f9e8c), +_c(U+1F78D, "๐", f09f9e8d), +_c(U+1F78E, "๐", f09f9e8e), +_c(U+1F78F, "๐", f09f9e8f), +_c(U+1F790, "๐", f09f9e90), +_c(U+1F791, "๐", f09f9e91), +_c(U+1F792, "๐", f09f9e92), +_c(U+1F793, "๐", f09f9e93), +_c(U+1F794, "๐", f09f9e94), +_c(U+1F795, "๐", f09f9e95), +_c(U+1F796, "๐", f09f9e96), +_c(U+1F797, "๐", f09f9e97), +_c(U+1F798, "๐", f09f9e98), +_c(U+1F799, "๐", f09f9e99), +_c(U+1F79A, "๐", f09f9e9a), +_c(U+1F79B, "๐", f09f9e9b), +_c(U+1F79C, "๐", f09f9e9c), +_c(U+1F79D, "๐", f09f9e9d), +_c(U+1F79E, "๐", f09f9e9e), +_c(U+1F79F, "๐", f09f9e9f), +_c(U+1F7A0, "๐ ", f09f9ea0), +_c(U+1F7A1, "๐ก", f09f9ea1), +_c(U+1F7A2, "๐ข", f09f9ea2), +_c(U+1F7A3, "๐ฃ", f09f9ea3), +_c(U+1F7A4, "๐ค", f09f9ea4), +_c(U+1F7A5, "๐ฅ", f09f9ea5), +_c(U+1F7A6, "๐ฆ", f09f9ea6), +_c(U+1F7A7, "๐ง", f09f9ea7), +_c(U+1F7A8, "๐จ", f09f9ea8), +_c(U+1F7A9, "๐ฉ", f09f9ea9), +_c(U+1F7AA, "๐ช", f09f9eaa), +_c(U+1F7AB, "๐ซ", f09f9eab), +_c(U+1F7AC, "๐ฌ", f09f9eac), +_c(U+1F7AD, "๐ญ", f09f9ead), +_c(U+1F7AE, "๐ฎ", f09f9eae), +_c(U+1F7AF, "๐ฏ", f09f9eaf), +_c(U+1F7B0, "๐ฐ", f09f9eb0), +_c(U+1F7B1, "๐ฑ", f09f9eb1), +_c(U+1F7B2, "๐ฒ", f09f9eb2), +_c(U+1F7B3, "๐ณ", f09f9eb3), +_c(U+1F7B4, "๐ด", f09f9eb4), +_c(U+1F7B5, "๐ต", f09f9eb5), +_c(U+1F7B6, "๐ถ", f09f9eb6), +_c(U+1F7B7, "๐ท", f09f9eb7), +_c(U+1F7B8, "๐ธ", f09f9eb8), +_c(U+1F7B9, "๐น", f09f9eb9), +_c(U+1F7BA, "๐บ", f09f9eba), +_c(U+1F7BB, "๐ป", f09f9ebb), +_c(U+1F7BC, "๐ผ", f09f9ebc), +_c(U+1F7BD, "๐ฝ", f09f9ebd), +_c(U+1F7BE, "๐พ", f09f9ebe), +_c(U+1F7BF, "๐ฟ", f09f9ebf), +_c(U+1F7C0, "๐", f09f9f80), +_c(U+1F7C1, "๐", f09f9f81), +_c(U+1F7C2, "๐", f09f9f82), +_c(U+1F7C3, "๐", f09f9f83), +_c(U+1F7C4, "๐", f09f9f84), +_c(U+1F7C5, "๐
", f09f9f85), +_c(U+1F7C6, "๐", f09f9f86), +_c(U+1F7C7, "๐", f09f9f87), +_c(U+1F7C8, "๐", f09f9f88), +_c(U+1F7C9, "๐", f09f9f89), +_c(U+1F7CA, "๐", f09f9f8a), +_c(U+1F7CB, "๐", f09f9f8b), +_c(U+1F7CC, "๐", f09f9f8c), +_c(U+1F7CD, "๐", f09f9f8d), +_c(U+1F7CE, "๐", f09f9f8e), +_c(U+1F7CF, "๐", f09f9f8f), +_c(U+1F7D0, "๐", f09f9f90), +_c(U+1F7D1, "๐", f09f9f91), +_c(U+1F7D2, "๐", f09f9f92), +_c(U+1F7D3, "๐", f09f9f93), +_c(U+1F7D4, "๐", f09f9f94), +_c(U+1F7D5, "๐", f09f9f95), +_c(U+1F7D6, "๐", f09f9f96), +_c(U+1F7D7, "๐", f09f9f97), +_c(U+1F7D8, "๐", f09f9f98), +_c(U+1F7D9, "๐", f09f9f99), +_c(U+1F7DA, "๐", f09f9f9a), +_c(U+1F7DB, "๐", f09f9f9b), +_c(U+1F7DC, "๐", f09f9f9c), +_c(U+1F7DD, "๐", f09f9f9d), +_c(U+1F7DE, "๐", f09f9f9e), +_c(U+1F7DF, "๐", f09f9f9f), +_c(U+1F7E0, "๐ ", f09f9fa0), +_c(U+1F7E1, "๐ก", f09f9fa1), +_c(U+1F7E2, "๐ข", f09f9fa2), +_c(U+1F7E3, "๐ฃ", f09f9fa3), +_c(U+1F7E4, "๐ค", f09f9fa4), +_c(U+1F7E5, "๐ฅ", f09f9fa5), +_c(U+1F7E6, "๐ฆ", f09f9fa6), +_c(U+1F7E7, "๐ง", f09f9fa7), +_c(U+1F7E8, "๐จ", f09f9fa8), +_c(U+1F7E9, "๐ฉ", f09f9fa9), +_c(U+1F7EA, "๐ช", f09f9faa), +_c(U+1F7EB, "๐ซ", f09f9fab), +_c(U+1F7EC, "๐ฌ", f09f9fac), +_c(U+1F7ED, "๐ญ", f09f9fad), +_c(U+1F7EE, "๐ฎ", f09f9fae), +_c(U+1F7EF, "๐ฏ", f09f9faf), +_c(U+1F7F0, "๐ฐ", f09f9fb0), +_c(U+1F7F1, "๐ฑ", f09f9fb1), +_c(U+1F7F2, "๐ฒ", f09f9fb2), +_c(U+1F7F3, "๐ณ", f09f9fb3), +_c(U+1F7F4, "๐ด", f09f9fb4), +_c(U+1F7F5, "๐ต", f09f9fb5), +_c(U+1F7F6, "๐ถ", f09f9fb6), +_c(U+1F7F7, "๐ท", f09f9fb7), +_c(U+1F7F8, "๐ธ", f09f9fb8), +_c(U+1F7F9, "๐น", f09f9fb9), +_c(U+1F7FA, "๐บ", f09f9fba), +_c(U+1F7FB, "๐ป", f09f9fbb), +_c(U+1F7FC, "๐ผ", f09f9fbc), +_c(U+1F7FD, "๐ฝ", f09f9fbd), +_c(U+1F7FE, "๐พ", f09f9fbe), +_c(U+1F7FF, "๐ฟ", f09f9fbf), +_c(U+1F800, "๐ ", f09fa080), +_c(U+1F801, "๐ ", f09fa081), +_c(U+1F802, "๐ ", f09fa082), +_c(U+1F803, "๐ ", f09fa083), +_c(U+1F804, "๐ ", f09fa084), +_c(U+1F805, "๐
", f09fa085), +_c(U+1F806, "๐ ", f09fa086), +_c(U+1F807, "๐ ", f09fa087), +_c(U+1F808, "๐ ", f09fa088), +_c(U+1F809, "๐ ", f09fa089), +_c(U+1F80A, "๐ ", f09fa08a), +_c(U+1F80B, "๐ ", f09fa08b), +_c(U+1F80C, "๐ ", f09fa08c), +_c(U+1F80D, "๐ ", f09fa08d), +_c(U+1F80E, "๐ ", f09fa08e), +_c(U+1F80F, "๐ ", f09fa08f), +_c(U+1F810, "๐ ", f09fa090), +_c(U+1F811, "๐ ", f09fa091), +_c(U+1F812, "๐ ", f09fa092), +_c(U+1F813, "๐ ", f09fa093), +_c(U+1F814, "๐ ", f09fa094), +_c(U+1F815, "๐ ", f09fa095), +_c(U+1F816, "๐ ", f09fa096), +_c(U+1F817, "๐ ", f09fa097), +_c(U+1F818, "๐ ", f09fa098), +_c(U+1F819, "๐ ", f09fa099), +_c(U+1F81A, "๐ ", f09fa09a), +_c(U+1F81B, "๐ ", f09fa09b), +_c(U+1F81C, "๐ ", f09fa09c), +_c(U+1F81D, "๐ ", f09fa09d), +_c(U+1F81E, "๐ ", f09fa09e), +_c(U+1F81F, "๐ ", f09fa09f), +_c(U+1F820, "๐ ", f09fa0a0), +_c(U+1F821, "๐ ก", f09fa0a1), +_c(U+1F822, "๐ ข", f09fa0a2), +_c(U+1F823, "๐ ฃ", f09fa0a3), +_c(U+1F824, "๐ ค", f09fa0a4), +_c(U+1F825, "๐ ฅ", f09fa0a5), +_c(U+1F826, "๐ ฆ", f09fa0a6), +_c(U+1F827, "๐ ง", f09fa0a7), +_c(U+1F828, "๐ จ", f09fa0a8), +_c(U+1F829, "๐ ฉ", f09fa0a9), +_c(U+1F82A, "๐ ช", f09fa0aa), +_c(U+1F82B, "๐ ซ", f09fa0ab), +_c(U+1F82C, "๐ ฌ", f09fa0ac), +_c(U+1F82D, "๐ ญ", f09fa0ad), +_c(U+1F82E, "๐ ฎ", f09fa0ae), +_c(U+1F82F, "๐ ฏ", f09fa0af), +_c(U+1F830, "๐ ฐ", f09fa0b0), +_c(U+1F831, "๐ ฑ", f09fa0b1), +_c(U+1F832, "๐ ฒ", f09fa0b2), +_c(U+1F833, "๐ ณ", f09fa0b3), +_c(U+1F834, "๐ ด", f09fa0b4), +_c(U+1F835, "๐ ต", f09fa0b5), +_c(U+1F836, "๐ ถ", f09fa0b6), +_c(U+1F837, "๐ ท", f09fa0b7), +_c(U+1F838, "๐ ธ", f09fa0b8), +_c(U+1F839, "๐ น", f09fa0b9), +_c(U+1F83A, "๐ บ", f09fa0ba), +_c(U+1F83B, "๐ ป", f09fa0bb), +_c(U+1F83C, "๐ ผ", f09fa0bc), +_c(U+1F83D, "๐ ฝ", f09fa0bd), +_c(U+1F83E, "๐ พ", f09fa0be), +_c(U+1F83F, "๐ ฟ", f09fa0bf), +_c(U+1F840, "๐ก", f09fa180), +_c(U+1F841, "๐ก", f09fa181), +_c(U+1F842, "๐ก", f09fa182), +_c(U+1F843, "๐ก", f09fa183), +_c(U+1F844, "๐ก", f09fa184), +_c(U+1F845, "๐ก
", f09fa185), +_c(U+1F846, "๐ก", f09fa186), +_c(U+1F847, "๐ก", f09fa187), +_c(U+1F848, "๐ก", f09fa188), +_c(U+1F849, "๐ก", f09fa189), +_c(U+1F84A, "๐ก", f09fa18a), +_c(U+1F84B, "๐ก", f09fa18b), +_c(U+1F84C, "๐ก", f09fa18c), +_c(U+1F84D, "๐ก", f09fa18d), +_c(U+1F84E, "๐ก", f09fa18e), +_c(U+1F84F, "๐ก", f09fa18f), +_c(U+1F850, "๐ก", f09fa190), +_c(U+1F851, "๐ก", f09fa191), +_c(U+1F852, "๐ก", f09fa192), +_c(U+1F853, "๐ก", f09fa193), +_c(U+1F854, "๐ก", f09fa194), +_c(U+1F855, "๐ก", f09fa195), +_c(U+1F856, "๐ก", f09fa196), +_c(U+1F857, "๐ก", f09fa197), +_c(U+1F858, "๐ก", f09fa198), +_c(U+1F859, "๐ก", f09fa199), +_c(U+1F85A, "๐ก", f09fa19a), +_c(U+1F85B, "๐ก", f09fa19b), +_c(U+1F85C, "๐ก", f09fa19c), +_c(U+1F85D, "๐ก", f09fa19d), +_c(U+1F85E, "๐ก", f09fa19e), +_c(U+1F85F, "๐ก", f09fa19f), +_c(U+1F860, "๐ก ", f09fa1a0), +_c(U+1F861, "๐กก", f09fa1a1), +_c(U+1F862, "๐กข", f09fa1a2), +_c(U+1F863, "๐กฃ", f09fa1a3), +_c(U+1F864, "๐กค", f09fa1a4), +_c(U+1F865, "๐กฅ", f09fa1a5), +_c(U+1F866, "๐กฆ", f09fa1a6), +_c(U+1F867, "๐กง", f09fa1a7), +_c(U+1F868, "๐กจ", f09fa1a8), +_c(U+1F869, "๐กฉ", f09fa1a9), +_c(U+1F86A, "๐กช", f09fa1aa), +_c(U+1F86B, "๐กซ", f09fa1ab), +_c(U+1F86C, "๐กฌ", f09fa1ac), +_c(U+1F86D, "๐กญ", f09fa1ad), +_c(U+1F86E, "๐กฎ", f09fa1ae), +_c(U+1F86F, "๐กฏ", f09fa1af), +_c(U+1F870, "๐กฐ", f09fa1b0), +_c(U+1F871, "๐กฑ", f09fa1b1), +_c(U+1F872, "๐กฒ", f09fa1b2), +_c(U+1F873, "๐กณ", f09fa1b3), +_c(U+1F874, "๐กด", f09fa1b4), +_c(U+1F875, "๐กต", f09fa1b5), +_c(U+1F876, "๐กถ", f09fa1b6), +_c(U+1F877, "๐กท", f09fa1b7), +_c(U+1F878, "๐กธ", f09fa1b8), +_c(U+1F879, "๐กน", f09fa1b9), +_c(U+1F87A, "๐กบ", f09fa1ba), +_c(U+1F87B, "๐กป", f09fa1bb), +_c(U+1F87C, "๐กผ", f09fa1bc), +_c(U+1F87D, "๐กฝ", f09fa1bd), +_c(U+1F87E, "๐กพ", f09fa1be), +_c(U+1F87F, "๐กฟ", f09fa1bf), +_c(U+1F880, "๐ข", f09fa280), +_c(U+1F881, "๐ข", f09fa281), +_c(U+1F882, "๐ข", f09fa282), +_c(U+1F883, "๐ข", f09fa283), +_c(U+1F884, "๐ข", f09fa284), +_c(U+1F885, "๐ข
", f09fa285), +_c(U+1F886, "๐ข", f09fa286), +_c(U+1F887, "๐ข", f09fa287), +_c(U+1F888, "๐ข", f09fa288), +_c(U+1F889, "๐ข", f09fa289), +_c(U+1F88A, "๐ข", f09fa28a), +_c(U+1F88B, "๐ข", f09fa28b), +_c(U+1F88C, "๐ข", f09fa28c), +_c(U+1F88D, "๐ข", f09fa28d), +_c(U+1F88E, "๐ข", f09fa28e), +_c(U+1F88F, "๐ข", f09fa28f), +_c(U+1F890, "๐ข", f09fa290), +_c(U+1F891, "๐ข", f09fa291), +_c(U+1F892, "๐ข", f09fa292), +_c(U+1F893, "๐ข", f09fa293), +_c(U+1F894, "๐ข", f09fa294), +_c(U+1F895, "๐ข", f09fa295), +_c(U+1F896, "๐ข", f09fa296), +_c(U+1F897, "๐ข", f09fa297), +_c(U+1F898, "๐ข", f09fa298), +_c(U+1F899, "๐ข", f09fa299), +_c(U+1F89A, "๐ข", f09fa29a), +_c(U+1F89B, "๐ข", f09fa29b), +_c(U+1F89C, "๐ข", f09fa29c), +_c(U+1F89D, "๐ข", f09fa29d), +_c(U+1F89E, "๐ข", f09fa29e), +_c(U+1F89F, "๐ข", f09fa29f), +_c(U+1F8A0, "๐ข ", f09fa2a0), +_c(U+1F8A1, "๐ขก", f09fa2a1), +_c(U+1F8A2, "๐ขข", f09fa2a2), +_c(U+1F8A3, "๐ขฃ", f09fa2a3), +_c(U+1F8A4, "๐ขค", f09fa2a4), +_c(U+1F8A5, "๐ขฅ", f09fa2a5), +_c(U+1F8A6, "๐ขฆ", f09fa2a6), +_c(U+1F8A7, "๐ขง", f09fa2a7), +_c(U+1F8A8, "๐ขจ", f09fa2a8), +_c(U+1F8A9, "๐ขฉ", f09fa2a9), +_c(U+1F8AA, "๐ขช", f09fa2aa), +_c(U+1F8AB, "๐ขซ", f09fa2ab), +_c(U+1F8AC, "๐ขฌ", f09fa2ac), +_c(U+1F8AD, "๐ขญ", f09fa2ad), +_c(U+1F8AE, "๐ขฎ", f09fa2ae), +_c(U+1F8AF, "๐ขฏ", f09fa2af), +_c(U+1F8B0, "๐ขฐ", f09fa2b0), +_c(U+1F8B1, "๐ขฑ", f09fa2b1), +_c(U+1F8B2, "๐ขฒ", f09fa2b2), +_c(U+1F8B3, "๐ขณ", f09fa2b3), +_c(U+1F8B4, "๐ขด", f09fa2b4), +_c(U+1F8B5, "๐ขต", f09fa2b5), +_c(U+1F8B6, "๐ขถ", f09fa2b6), +_c(U+1F8B7, "๐ขท", f09fa2b7), +_c(U+1F8B8, "๐ขธ", f09fa2b8), +_c(U+1F8B9, "๐ขน", f09fa2b9), +_c(U+1F8BA, "๐ขบ", f09fa2ba), +_c(U+1F8BB, "๐ขป", f09fa2bb), +_c(U+1F8BC, "๐ขผ", f09fa2bc), +_c(U+1F8BD, "๐ขฝ", f09fa2bd), +_c(U+1F8BE, "๐ขพ", f09fa2be), +_c(U+1F8BF, "๐ขฟ", f09fa2bf), +_c(U+1F8C0, "๐ฃ", f09fa380), +_c(U+1F8C1, "๐ฃ", f09fa381), +_c(U+1F8C2, "๐ฃ", f09fa382), +_c(U+1F8C3, "๐ฃ", f09fa383), +_c(U+1F8C4, "๐ฃ", f09fa384), +_c(U+1F8C5, "๐ฃ
", f09fa385), +_c(U+1F8C6, "๐ฃ", f09fa386), +_c(U+1F8C7, "๐ฃ", f09fa387), +_c(U+1F8C8, "๐ฃ", f09fa388), +_c(U+1F8C9, "๐ฃ", f09fa389), +_c(U+1F8CA, "๐ฃ", f09fa38a), +_c(U+1F8CB, "๐ฃ", f09fa38b), +_c(U+1F8CC, "๐ฃ", f09fa38c), +_c(U+1F8CD, "๐ฃ", f09fa38d), +_c(U+1F8CE, "๐ฃ", f09fa38e), +_c(U+1F8CF, "๐ฃ", f09fa38f), +_c(U+1F8D0, "๐ฃ", f09fa390), +_c(U+1F8D1, "๐ฃ", f09fa391), +_c(U+1F8D2, "๐ฃ", f09fa392), +_c(U+1F8D3, "๐ฃ", f09fa393), +_c(U+1F8D4, "๐ฃ", f09fa394), +_c(U+1F8D5, "๐ฃ", f09fa395), +_c(U+1F8D6, "๐ฃ", f09fa396), +_c(U+1F8D7, "๐ฃ", f09fa397), +_c(U+1F8D8, "๐ฃ", f09fa398), +_c(U+1F8D9, "๐ฃ", f09fa399), +_c(U+1F8DA, "๐ฃ", f09fa39a), +_c(U+1F8DB, "๐ฃ", f09fa39b), +_c(U+1F8DC, "๐ฃ", f09fa39c), +_c(U+1F8DD, "๐ฃ", f09fa39d), +_c(U+1F8DE, "๐ฃ", f09fa39e), +_c(U+1F8DF, "๐ฃ", f09fa39f), +_c(U+1F8E0, "๐ฃ ", f09fa3a0), +_c(U+1F8E1, "๐ฃก", f09fa3a1), +_c(U+1F8E2, "๐ฃข", f09fa3a2), +_c(U+1F8E3, "๐ฃฃ", f09fa3a3), +_c(U+1F8E4, "๐ฃค", f09fa3a4), +_c(U+1F8E5, "๐ฃฅ", f09fa3a5), +_c(U+1F8E6, "๐ฃฆ", f09fa3a6), +_c(U+1F8E7, "๐ฃง", f09fa3a7), +_c(U+1F8E8, "๐ฃจ", f09fa3a8), +_c(U+1F8E9, "๐ฃฉ", f09fa3a9), +_c(U+1F8EA, "๐ฃช", f09fa3aa), +_c(U+1F8EB, "๐ฃซ", f09fa3ab), +_c(U+1F8EC, "๐ฃฌ", f09fa3ac), +_c(U+1F8ED, "๐ฃญ", f09fa3ad), +_c(U+1F8EE, "๐ฃฎ", f09fa3ae), +_c(U+1F8EF, "๐ฃฏ", f09fa3af), +_c(U+1F8F0, "๐ฃฐ", f09fa3b0), +_c(U+1F8F1, "๐ฃฑ", f09fa3b1), +_c(U+1F8F2, "๐ฃฒ", f09fa3b2), +_c(U+1F8F3, "๐ฃณ", f09fa3b3), +_c(U+1F8F4, "๐ฃด", f09fa3b4), +_c(U+1F8F5, "๐ฃต", f09fa3b5), +_c(U+1F8F6, "๐ฃถ", f09fa3b6), +_c(U+1F8F7, "๐ฃท", f09fa3b7), +_c(U+1F8F8, "๐ฃธ", f09fa3b8), +_c(U+1F8F9, "๐ฃน", f09fa3b9), +_c(U+1F8FA, "๐ฃบ", f09fa3ba), +_c(U+1F8FB, "๐ฃป", f09fa3bb), +_c(U+1F8FC, "๐ฃผ", f09fa3bc), +_c(U+1F8FD, "๐ฃฝ", f09fa3bd), +_c(U+1F8FE, "๐ฃพ", f09fa3be), +_c(U+1F8FF, "๐ฃฟ", f09fa3bf), +_c(U+1F900, "๐ค", f09fa480), +_c(U+1F901, "๐ค", f09fa481), +_c(U+1F902, "๐ค", f09fa482), +_c(U+1F903, "๐ค", f09fa483), +_c(U+1F904, "๐ค", f09fa484), +_c(U+1F905, "๐ค
", f09fa485), +_c(U+1F906, "๐ค", f09fa486), +_c(U+1F907, "๐ค", f09fa487), +_c(U+1F908, "๐ค", f09fa488), +_c(U+1F909, "๐ค", f09fa489), +_c(U+1F90A, "๐ค", f09fa48a), +_c(U+1F90B, "๐ค", f09fa48b), +_c(U+1F90C, "๐ค", f09fa48c), +_c(U+1F90D, "๐ค", f09fa48d), +_c(U+1F90E, "๐ค", f09fa48e), +_c(U+1F90F, "๐ค", f09fa48f), +_c(U+1F910, "๐ค", f09fa490), +_c(U+1F911, "๐ค", f09fa491), +_c(U+1F912, "๐ค", f09fa492), +_c(U+1F913, "๐ค", f09fa493), +_c(U+1F914, "๐ค", f09fa494), +_c(U+1F915, "๐ค", f09fa495), +_c(U+1F916, "๐ค", f09fa496), +_c(U+1F917, "๐ค", f09fa497), +_c(U+1F918, "๐ค", f09fa498), +_c(U+1F919, "๐ค", f09fa499), +_c(U+1F91A, "๐ค", f09fa49a), +_c(U+1F91B, "๐ค", f09fa49b), +_c(U+1F91C, "๐ค", f09fa49c), +_c(U+1F91D, "๐ค", f09fa49d), +_c(U+1F91E, "๐ค", f09fa49e), +_c(U+1F91F, "๐ค", f09fa49f), +_c(U+1F920, "๐ค ", f09fa4a0), +_c(U+1F921, "๐คก", f09fa4a1), +_c(U+1F922, "๐คข", f09fa4a2), +_c(U+1F923, "๐คฃ", f09fa4a3), +_c(U+1F924, "๐คค", f09fa4a4), +_c(U+1F925, "๐คฅ", f09fa4a5), +_c(U+1F926, "๐คฆ", f09fa4a6), +_c(U+1F927, "๐คง", f09fa4a7), +_c(U+1F928, "๐คจ", f09fa4a8), +_c(U+1F929, "๐คฉ", f09fa4a9), +_c(U+1F92A, "๐คช", f09fa4aa), +_c(U+1F92B, "๐คซ", f09fa4ab), +_c(U+1F92C, "๐คฌ", f09fa4ac), +_c(U+1F92D, "๐คญ", f09fa4ad), +_c(U+1F92E, "๐คฎ", f09fa4ae), +_c(U+1F92F, "๐คฏ", f09fa4af), +_c(U+1F930, "๐คฐ", f09fa4b0), +_c(U+1F931, "๐คฑ", f09fa4b1), +_c(U+1F932, "๐คฒ", f09fa4b2), +_c(U+1F933, "๐คณ", f09fa4b3), +_c(U+1F934, "๐คด", f09fa4b4), +_c(U+1F935, "๐คต", f09fa4b5), +_c(U+1F936, "๐คถ", f09fa4b6), +_c(U+1F937, "๐คท", f09fa4b7), +_c(U+1F938, "๐คธ", f09fa4b8), +_c(U+1F939, "๐คน", f09fa4b9), +_c(U+1F93A, "๐คบ", f09fa4ba), +_c(U+1F93B, "๐คป", f09fa4bb), +_c(U+1F93C, "๐คผ", f09fa4bc), +_c(U+1F93D, "๐คฝ", f09fa4bd), +_c(U+1F93E, "๐คพ", f09fa4be), +_c(U+1F93F, "๐คฟ", f09fa4bf), +_c(U+1F940, "๐ฅ", f09fa580), +_c(U+1F941, "๐ฅ", f09fa581), +_c(U+1F942, "๐ฅ", f09fa582), +_c(U+1F943, "๐ฅ", f09fa583), +_c(U+1F944, "๐ฅ", f09fa584), +_c(U+1F945, "๐ฅ
", f09fa585), +_c(U+1F946, "๐ฅ", f09fa586), +_c(U+1F947, "๐ฅ", f09fa587), +_c(U+1F948, "๐ฅ", f09fa588), +_c(U+1F949, "๐ฅ", f09fa589), +_c(U+1F94A, "๐ฅ", f09fa58a), +_c(U+1F94B, "๐ฅ", f09fa58b), +_c(U+1F94C, "๐ฅ", f09fa58c), +_c(U+1F94D, "๐ฅ", f09fa58d), +_c(U+1F94E, "๐ฅ", f09fa58e), +_c(U+1F94F, "๐ฅ", f09fa58f), +_c(U+1F950, "๐ฅ", f09fa590), +_c(U+1F951, "๐ฅ", f09fa591), +_c(U+1F952, "๐ฅ", f09fa592), +_c(U+1F953, "๐ฅ", f09fa593), +_c(U+1F954, "๐ฅ", f09fa594), +_c(U+1F955, "๐ฅ", f09fa595), +_c(U+1F956, "๐ฅ", f09fa596), +_c(U+1F957, "๐ฅ", f09fa597), +_c(U+1F958, "๐ฅ", f09fa598), +_c(U+1F959, "๐ฅ", f09fa599), +_c(U+1F95A, "๐ฅ", f09fa59a), +_c(U+1F95B, "๐ฅ", f09fa59b), +_c(U+1F95C, "๐ฅ", f09fa59c), +_c(U+1F95D, "๐ฅ", f09fa59d), +_c(U+1F95E, "๐ฅ", f09fa59e), +_c(U+1F95F, "๐ฅ", f09fa59f), +_c(U+1F960, "๐ฅ ", f09fa5a0), +_c(U+1F961, "๐ฅก", f09fa5a1), +_c(U+1F962, "๐ฅข", f09fa5a2), +_c(U+1F963, "๐ฅฃ", f09fa5a3), +_c(U+1F964, "๐ฅค", f09fa5a4), +_c(U+1F965, "๐ฅฅ", f09fa5a5), +_c(U+1F966, "๐ฅฆ", f09fa5a6), +_c(U+1F967, "๐ฅง", f09fa5a7), +_c(U+1F968, "๐ฅจ", f09fa5a8), +_c(U+1F969, "๐ฅฉ", f09fa5a9), +_c(U+1F96A, "๐ฅช", f09fa5aa), +_c(U+1F96B, "๐ฅซ", f09fa5ab), +_c(U+1F96C, "๐ฅฌ", f09fa5ac), +_c(U+1F96D, "๐ฅญ", f09fa5ad), +_c(U+1F96E, "๐ฅฎ", f09fa5ae), +_c(U+1F96F, "๐ฅฏ", f09fa5af), +_c(U+1F970, "๐ฅฐ", f09fa5b0), +_c(U+1F971, "๐ฅฑ", f09fa5b1), +_c(U+1F972, "๐ฅฒ", f09fa5b2), +_c(U+1F973, "๐ฅณ", f09fa5b3), +_c(U+1F974, "๐ฅด", f09fa5b4), +_c(U+1F975, "๐ฅต", f09fa5b5), +_c(U+1F976, "๐ฅถ", f09fa5b6), +_c(U+1F977, "๐ฅท", f09fa5b7), +_c(U+1F978, "๐ฅธ", f09fa5b8), +_c(U+1F979, "๐ฅน", f09fa5b9), +_c(U+1F97A, "๐ฅบ", f09fa5ba), +_c(U+1F97B, "๐ฅป", f09fa5bb), +_c(U+1F97C, "๐ฅผ", f09fa5bc), +_c(U+1F97D, "๐ฅฝ", f09fa5bd), +_c(U+1F97E, "๐ฅพ", f09fa5be), +_c(U+1F97F, "๐ฅฟ", f09fa5bf), +_c(U+1F980, "๐ฆ", f09fa680), +_c(U+1F981, "๐ฆ", f09fa681), +_c(U+1F982, "๐ฆ", f09fa682), +_c(U+1F983, "๐ฆ", f09fa683), +_c(U+1F984, "๐ฆ", f09fa684), +_c(U+1F985, "๐ฆ
", f09fa685), +_c(U+1F986, "๐ฆ", f09fa686), +_c(U+1F987, "๐ฆ", f09fa687), +_c(U+1F988, "๐ฆ", f09fa688), +_c(U+1F989, "๐ฆ", f09fa689), +_c(U+1F98A, "๐ฆ", f09fa68a), +_c(U+1F98B, "๐ฆ", f09fa68b), +_c(U+1F98C, "๐ฆ", f09fa68c), +_c(U+1F98D, "๐ฆ", f09fa68d), +_c(U+1F98E, "๐ฆ", f09fa68e), +_c(U+1F98F, "๐ฆ", f09fa68f), +_c(U+1F990, "๐ฆ", f09fa690), +_c(U+1F991, "๐ฆ", f09fa691), +_c(U+1F992, "๐ฆ", f09fa692), +_c(U+1F993, "๐ฆ", f09fa693), +_c(U+1F994, "๐ฆ", f09fa694), +_c(U+1F995, "๐ฆ", f09fa695), +_c(U+1F996, "๐ฆ", f09fa696), +_c(U+1F997, "๐ฆ", f09fa697), +_c(U+1F998, "๐ฆ", f09fa698), +_c(U+1F999, "๐ฆ", f09fa699), +_c(U+1F99A, "๐ฆ", f09fa69a), +_c(U+1F99B, "๐ฆ", f09fa69b), +_c(U+1F99C, "๐ฆ", f09fa69c), +_c(U+1F99D, "๐ฆ", f09fa69d), +_c(U+1F99E, "๐ฆ", f09fa69e), +_c(U+1F99F, "๐ฆ", f09fa69f), +_c(U+1F9A0, "๐ฆ ", f09fa6a0), +_c(U+1F9A1, "๐ฆก", f09fa6a1), +_c(U+1F9A2, "๐ฆข", f09fa6a2), +_c(U+1F9A3, "๐ฆฃ", f09fa6a3), +_c(U+1F9A4, "๐ฆค", f09fa6a4), +_c(U+1F9A5, "๐ฆฅ", f09fa6a5), +_c(U+1F9A6, "๐ฆฆ", f09fa6a6), +_c(U+1F9A7, "๐ฆง", f09fa6a7), +_c(U+1F9A8, "๐ฆจ", f09fa6a8), +_c(U+1F9A9, "๐ฆฉ", f09fa6a9), +_c(U+1F9AA, "๐ฆช", f09fa6aa), +_c(U+1F9AB, "๐ฆซ", f09fa6ab), +_c(U+1F9AC, "๐ฆฌ", f09fa6ac), +_c(U+1F9AD, "๐ฆญ", f09fa6ad), +_c(U+1F9AE, "๐ฆฎ", f09fa6ae), +_c(U+1F9AF, "๐ฆฏ", f09fa6af), +_c(U+1F9B0, "๐ฆฐ", f09fa6b0), +_c(U+1F9B1, "๐ฆฑ", f09fa6b1), +_c(U+1F9B2, "๐ฆฒ", f09fa6b2), +_c(U+1F9B3, "๐ฆณ", f09fa6b3), +_c(U+1F9B4, "๐ฆด", f09fa6b4), +_c(U+1F9B5, "๐ฆต", f09fa6b5), +_c(U+1F9B6, "๐ฆถ", f09fa6b6), +_c(U+1F9B7, "๐ฆท", f09fa6b7), +_c(U+1F9B8, "๐ฆธ", f09fa6b8), +_c(U+1F9B9, "๐ฆน", f09fa6b9), +_c(U+1F9BA, "๐ฆบ", f09fa6ba), +_c(U+1F9BB, "๐ฆป", f09fa6bb), +_c(U+1F9BC, "๐ฆผ", f09fa6bc), +_c(U+1F9BD, "๐ฆฝ", f09fa6bd), +_c(U+1F9BE, "๐ฆพ", f09fa6be), +_c(U+1F9BF, "๐ฆฟ", f09fa6bf), +_c(U+1F9C0, "๐ง", f09fa780), +_c(U+1F9C1, "๐ง", f09fa781), +_c(U+1F9C2, "๐ง", f09fa782), +_c(U+1F9C3, "๐ง", f09fa783), +_c(U+1F9C4, "๐ง", f09fa784), +_c(U+1F9C5, "๐ง
", f09fa785), +_c(U+1F9C6, "๐ง", f09fa786), +_c(U+1F9C7, "๐ง", f09fa787), +_c(U+1F9C8, "๐ง", f09fa788), +_c(U+1F9C9, "๐ง", f09fa789), +_c(U+1F9CA, "๐ง", f09fa78a), +_c(U+1F9CB, "๐ง", f09fa78b), +_c(U+1F9CC, "๐ง", f09fa78c), +_c(U+1F9CD, "๐ง", f09fa78d), +_c(U+1F9CE, "๐ง", f09fa78e), +_c(U+1F9CF, "๐ง", f09fa78f), +_c(U+1F9D0, "๐ง", f09fa790), +_c(U+1F9D1, "๐ง", f09fa791), +_c(U+1F9D2, "๐ง", f09fa792), +_c(U+1F9D3, "๐ง", f09fa793), +_c(U+1F9D4, "๐ง", f09fa794), +_c(U+1F9D5, "๐ง", f09fa795), +_c(U+1F9D6, "๐ง", f09fa796), +_c(U+1F9D7, "๐ง", f09fa797), +_c(U+1F9D8, "๐ง", f09fa798), +_c(U+1F9D9, "๐ง", f09fa799), +_c(U+1F9DA, "๐ง", f09fa79a), +_c(U+1F9DB, "๐ง", f09fa79b), +_c(U+1F9DC, "๐ง", f09fa79c), +_c(U+1F9DD, "๐ง", f09fa79d), +_c(U+1F9DE, "๐ง", f09fa79e), +_c(U+1F9DF, "๐ง", f09fa79f), +_c(U+1F9E0, "๐ง ", f09fa7a0), +_c(U+1F9E1, "๐งก", f09fa7a1), +_c(U+1F9E2, "๐งข", f09fa7a2), +_c(U+1F9E3, "๐งฃ", f09fa7a3), +_c(U+1F9E4, "๐งค", f09fa7a4), +_c(U+1F9E5, "๐งฅ", f09fa7a5), +_c(U+1F9E6, "๐งฆ", f09fa7a6), +_c(U+1F9E7, "๐งง", f09fa7a7), +_c(U+1F9E8, "๐งจ", f09fa7a8), +_c(U+1F9E9, "๐งฉ", f09fa7a9), +_c(U+1F9EA, "๐งช", f09fa7aa), +_c(U+1F9EB, "๐งซ", f09fa7ab), +_c(U+1F9EC, "๐งฌ", f09fa7ac), +_c(U+1F9ED, "๐งญ", f09fa7ad), +_c(U+1F9EE, "๐งฎ", f09fa7ae), +_c(U+1F9EF, "๐งฏ", f09fa7af), +_c(U+1F9F0, "๐งฐ", f09fa7b0), +_c(U+1F9F1, "๐งฑ", f09fa7b1), +_c(U+1F9F2, "๐งฒ", f09fa7b2), +_c(U+1F9F3, "๐งณ", f09fa7b3), +_c(U+1F9F4, "๐งด", f09fa7b4), +_c(U+1F9F5, "๐งต", f09fa7b5), +_c(U+1F9F6, "๐งถ", f09fa7b6), +_c(U+1F9F7, "๐งท", f09fa7b7), +_c(U+1F9F8, "๐งธ", f09fa7b8), +_c(U+1F9F9, "๐งน", f09fa7b9), +_c(U+1F9FA, "๐งบ", f09fa7ba), +_c(U+1F9FB, "๐งป", f09fa7bb), +_c(U+1F9FC, "๐งผ", f09fa7bc), +_c(U+1F9FD, "๐งฝ", f09fa7bd), +_c(U+1F9FE, "๐งพ", f09fa7be), +_c(U+1F9FF, "๐งฟ", f09fa7bf), +_c(U+100000, "๔", f4808080), +_c(U+100001, "๔", f4808081), +_c(U+100002, "๔", f4808082), +_c(U+100003, "๔", f4808083), +_c(U+100004, "๔", f4808084), +_c(U+100005, "๔
", f4808085), +_c(U+100006, "๔", f4808086), +_c(U+100007, "๔", f4808087), +_c(U+100008, "๔", f4808088), +_c(U+100009, "๔", f4808089), +_c(U+10000A, "๔", f480808a), +_c(U+10000B, "๔", f480808b), +_c(U+10000C, "๔", f480808c), +_c(U+10000D, "๔", f480808d), +_c(U+10000E, "๔", f480808e), +_c(U+10000F, "๔", f480808f), +_c(U+100010, "๔", f4808090), +_c(U+100011, "๔", f4808091), +_c(U+100012, "๔", f4808092), +_c(U+100013, "๔", f4808093), +_c(U+100014, "๔", f4808094), +_c(U+100015, "๔", f4808095), +_c(U+100016, "๔", f4808096), +_c(U+100017, "๔", f4808097), +_c(U+100018, "๔", f4808098), +_c(U+100019, "๔", f4808099), +_c(U+10001A, "๔", f480809a), +_c(U+10001B, "๔", f480809b), +_c(U+10001C, "๔", f480809c), +_c(U+10001D, "๔", f480809d), +_c(U+10001E, "๔", f480809e), +_c(U+10001F, "๔", f480809f), +_c(U+100020, "๔ ", f48080a0), +_c(U+100021, "๔ก", f48080a1), +_c(U+100022, "๔ข", f48080a2), +_c(U+100023, "๔ฃ", f48080a3), +_c(U+100024, "๔ค", f48080a4), +_c(U+100025, "๔ฅ", f48080a5), +_c(U+100026, "๔ฆ", f48080a6), +_c(U+100027, "๔ง", f48080a7), +_c(U+100028, "๔จ", f48080a8), +_c(U+100029, "๔ฉ", f48080a9), +_c(U+10002A, "๔ช", f48080aa), +_c(U+10002B, "๔ซ", f48080ab), +_c(U+10002C, "๔ฌ", f48080ac), +_c(U+10002D, "๔ญ", f48080ad), +_c(U+10002E, "๔ฎ", f48080ae), +_c(U+10002F, "๔ฏ", f48080af), +_c(U+100030, "๔ฐ", f48080b0), +_c(U+100031, "๔ฑ", f48080b1), +_c(U+100032, "๔ฒ", f48080b2), +_c(U+100033, "๔ณ", f48080b3), +_c(U+100034, "๔ด", f48080b4), +_c(U+100035, "๔ต", f48080b5), +_c(U+100036, "๔ถ", f48080b6), +_c(U+100037, "๔ท", f48080b7), +_c(U+100038, "๔ธ", f48080b8), +_c(U+100039, "๔น", f48080b9), +_c(U+10003A, "๔บ", f48080ba), +_c(U+10003B, "๔ป", f48080bb), +_c(U+10003C, "๔ผ", f48080bc), +_c(U+10003D, "๔ฝ", f48080bd), +_c(U+10003E, "๔พ", f48080be), +_c(U+10003F, "๔ฟ", f48080bf), +_c(U+100040, "๔", f4808180), +_c(U+100041, "๔", f4808181), +_c(U+100042, "๔", f4808182), +_c(U+100043, "๔", f4808183), +_c(U+100044, "๔", f4808184), +_c(U+100045, "๔
", f4808185), +_c(U+100046, "๔", f4808186), +_c(U+100047, "๔", f4808187), +_c(U+100048, "๔", f4808188), +_c(U+100049, "๔", f4808189), +_c(U+10004A, "๔", f480818a), +_c(U+10004B, "๔", f480818b), +_c(U+10004C, "๔", f480818c), +_c(U+10004D, "๔", f480818d), +_c(U+10004E, "๔", f480818e), +_c(U+10004F, "๔", f480818f), +_c(U+100050, "๔", f4808190), +_c(U+100051, "๔", f4808191), +_c(U+100052, "๔", f4808192), +_c(U+100053, "๔", f4808193), +_c(U+100054, "๔", f4808194), +_c(U+100055, "๔", f4808195), +_c(U+100056, "๔", f4808196), +_c(U+100057, "๔", f4808197), +_c(U+100058, "๔", f4808198), +_c(U+100059, "๔", f4808199), +_c(U+10005A, "๔", f480819a), +_c(U+10005B, "๔", f480819b), +_c(U+10005C, "๔", f480819c), +_c(U+10005D, "๔", f480819d), +_c(U+10005E, "๔", f480819e), +_c(U+10005F, "๔", f480819f), +_c(U+100060, "๔ ", f48081a0), +_c(U+100061, "๔ก", f48081a1), +_c(U+100062, "๔ข", f48081a2), +_c(U+100063, "๔ฃ", f48081a3), +_c(U+100064, "๔ค", f48081a4), +_c(U+100065, "๔ฅ", f48081a5), +_c(U+100066, "๔ฆ", f48081a6), +_c(U+100067, "๔ง", f48081a7), +_c(U+100068, "๔จ", f48081a8), +_c(U+100069, "๔ฉ", f48081a9), +_c(U+10006A, "๔ช", f48081aa), +_c(U+10006B, "๔ซ", f48081ab), +_c(U+10006C, "๔ฌ", f48081ac), +_c(U+10006D, "๔ญ", f48081ad), +_c(U+10006E, "๔ฎ", f48081ae), +_c(U+10006F, "๔ฏ", f48081af), +_c(U+100070, "๔ฐ", f48081b0), +_c(U+100071, "๔ฑ", f48081b1), +_c(U+100072, "๔ฒ", f48081b2), +_c(U+100073, "๔ณ", f48081b3), +_c(U+100074, "๔ด", f48081b4), +_c(U+100075, "๔ต", f48081b5), +_c(U+100076, "๔ถ", f48081b6), +_c(U+100077, "๔ท", f48081b7), +_c(U+100078, "๔ธ", f48081b8), +_c(U+100079, "๔น", f48081b9), +_c(U+10007A, "๔บ", f48081ba), +_c(U+10007B, "๔ป", f48081bb), +_c(U+10007C, "๔ผ", f48081bc), +_c(U+10007D, "๔ฝ", f48081bd), +_c(U+10007E, "๔พ", f48081be), +_c(U+10007F, "๔ฟ", f48081bf), +_c(U+100080, "๔", f4808280), +_c(U+100081, "๔", f4808281), +_c(U+100082, "๔", f4808282), +_c(U+100083, "๔", f4808283), +_c(U+100084, "๔", f4808284), +_c(U+100085, "๔
", f4808285), +_c(U+100086, "๔", f4808286), +_c(U+100087, "๔", f4808287), +_c(U+100088, "๔", f4808288), +_c(U+100089, "๔", f4808289), +_c(U+10008A, "๔", f480828a), +_c(U+10008B, "๔", f480828b), +_c(U+10008C, "๔", f480828c), +_c(U+10008D, "๔", f480828d), +_c(U+10008E, "๔", f480828e), +_c(U+10008F, "๔", f480828f), +_c(U+100090, "๔", f4808290), +_c(U+100091, "๔", f4808291), +_c(U+100092, "๔", f4808292), +_c(U+100093, "๔", f4808293), +_c(U+100094, "๔", f4808294), +_c(U+100095, "๔", f4808295), +_c(U+100096, "๔", f4808296), +_c(U+100097, "๔", f4808297), +_c(U+100098, "๔", f4808298), +_c(U+100099, "๔", f4808299), +_c(U+10009A, "๔", f480829a), +_c(U+10009B, "๔", f480829b), +_c(U+10009C, "๔", f480829c), +_c(U+10009D, "๔", f480829d), +_c(U+10009E, "๔", f480829e), +_c(U+10009F, "๔", f480829f), +_c(U+1000A0, "๔ ", f48082a0), +_c(U+1000A1, "๔ก", f48082a1), +_c(U+1000A2, "๔ข", f48082a2), +_c(U+1000A3, "๔ฃ", f48082a3), +_c(U+1000A4, "๔ค", f48082a4), +_c(U+1000A5, "๔ฅ", f48082a5), +_c(U+1000A6, "๔ฆ", f48082a6), +_c(U+1000A7, "๔ง", f48082a7), +_c(U+1000A8, "๔จ", f48082a8), +_c(U+1000A9, "๔ฉ", f48082a9), +_c(U+1000AA, "๔ช", f48082aa), +_c(U+1000AB, "๔ซ", f48082ab), +_c(U+1000AC, "๔ฌ", f48082ac), +_c(U+1000AD, "๔ญ", f48082ad), +_c(U+1000AE, "๔ฎ", f48082ae), +_c(U+1000AF, "๔ฏ", f48082af), +_c(U+1000B0, "๔ฐ", f48082b0), +_c(U+1000B1, "๔ฑ", f48082b1), +_c(U+1000B2, "๔ฒ", f48082b2), +_c(U+1000B3, "๔ณ", f48082b3), +_c(U+1000B4, "๔ด", f48082b4), +_c(U+1000B5, "๔ต", f48082b5), +_c(U+1000B6, "๔ถ", f48082b6), +_c(U+1000B7, "๔ท", f48082b7), +_c(U+1000B8, "๔ธ", f48082b8), +_c(U+1000B9, "๔น", f48082b9), +_c(U+1000BA, "๔บ", f48082ba), +_c(U+1000BB, "๔ป", f48082bb), +_c(U+1000BC, "๔ผ", f48082bc), +_c(U+1000BD, "๔ฝ", f48082bd), +_c(U+1000BE, "๔พ", f48082be), +_c(U+1000BF, "๔ฟ", f48082bf), +_c(U+1000C0, "๔", f4808380), +_c(U+1000C1, "๔", f4808381), +_c(U+1000C2, "๔", f4808382), +_c(U+1000C3, "๔", f4808383), +_c(U+1000C4, "๔", f4808384), +_c(U+1000C5, "๔
", f4808385), +_c(U+1000C6, "๔", f4808386), +_c(U+1000C7, "๔", f4808387), +_c(U+1000C8, "๔", f4808388), +_c(U+1000C9, "๔", f4808389), +_c(U+1000CA, "๔", f480838a), +_c(U+1000CB, "๔", f480838b), +_c(U+1000CC, "๔", f480838c), +_c(U+1000CD, "๔", f480838d), +_c(U+1000CE, "๔", f480838e), +_c(U+1000CF, "๔", f480838f), +_c(U+1000D0, "๔", f4808390), +_c(U+1000D1, "๔", f4808391), +_c(U+1000D2, "๔", f4808392), +_c(U+1000D3, "๔", f4808393), +_c(U+1000D4, "๔", f4808394), +_c(U+1000D5, "๔", f4808395), +_c(U+1000D6, "๔", f4808396), +_c(U+1000D7, "๔", f4808397), +_c(U+1000D8, "๔", f4808398), +_c(U+1000D9, "๔", f4808399), +_c(U+1000DA, "๔", f480839a), +_c(U+1000DB, "๔", f480839b), +_c(U+1000DC, "๔", f480839c), +_c(U+1000DD, "๔", f480839d), +_c(U+1000DE, "๔", f480839e), +_c(U+1000DF, "๔", f480839f), +_c(U+1000E0, "๔ ", f48083a0), +_c(U+1000E1, "๔ก", f48083a1), +_c(U+1000E2, "๔ข", f48083a2), +_c(U+1000E3, "๔ฃ", f48083a3), +_c(U+1000E4, "๔ค", f48083a4), +_c(U+1000E5, "๔ฅ", f48083a5), +_c(U+1000E6, "๔ฆ", f48083a6), +_c(U+1000E7, "๔ง", f48083a7), +_c(U+1000E8, "๔จ", f48083a8), +_c(U+1000E9, "๔ฉ", f48083a9), +_c(U+1000EA, "๔ช", f48083aa), +_c(U+1000EB, "๔ซ", f48083ab), +_c(U+1000EC, "๔ฌ", f48083ac), +_c(U+1000ED, "๔ญ", f48083ad), +_c(U+1000EE, "๔ฎ", f48083ae), +_c(U+1000EF, "๔ฏ", f48083af), +_c(U+1000F0, "๔ฐ", f48083b0), +_c(U+1000F1, "๔ฑ", f48083b1), +_c(U+1000F2, "๔ฒ", f48083b2), +_c(U+1000F3, "๔ณ", f48083b3), +_c(U+1000F4, "๔ด", f48083b4), +_c(U+1000F5, "๔ต", f48083b5), +_c(U+1000F6, "๔ถ", f48083b6), +_c(U+1000F7, "๔ท", f48083b7), +_c(U+1000F8, "๔ธ", f48083b8), +_c(U+1000F9, "๔น", f48083b9), +_c(U+1000FA, "๔บ", f48083ba), +_c(U+1000FB, "๔ป", f48083bb), +_c(U+1000FC, "๔ผ", f48083bc), +_c(U+1000FD, "๔ฝ", f48083bd), +_c(U+1000FE, "๔พ", f48083be), +_c(U+1000FF, "๔ฟ", f48083bf), +_c(U+100100, "๔", f4808480), +_c(U+100101, "๔", f4808481), +_c(U+100102, "๔", f4808482), +_c(U+100103, "๔", f4808483), +_c(U+100104, "๔", f4808484), +_c(U+100105, "๔
", f4808485), +_c(U+100106, "๔", f4808486), +_c(U+100107, "๔", f4808487), +_c(U+100108, "๔", f4808488), +_c(U+100109, "๔", f4808489), +_c(U+10010A, "๔", f480848a), +_c(U+10010B, "๔", f480848b), +_c(U+10010C, "๔", f480848c), +_c(U+10010D, "๔", f480848d), +_c(U+10010E, "๔", f480848e), +_c(U+10010F, "๔", f480848f), +_c(U+100110, "๔", f4808490), +_c(U+100111, "๔", f4808491), +_c(U+100112, "๔", f4808492), +_c(U+100113, "๔", f4808493), +_c(U+100114, "๔", f4808494), +_c(U+100115, "๔", f4808495), +_c(U+100116, "๔", f4808496), +_c(U+100117, "๔", f4808497), +_c(U+100118, "๔", f4808498), +_c(U+100119, "๔", f4808499), +_c(U+10011A, "๔", f480849a), +_c(U+10011B, "๔", f480849b), +_c(U+10011C, "๔", f480849c), +_c(U+10011D, "๔", f480849d), +_c(U+10011E, "๔", f480849e), +_c(U+10011F, "๔", f480849f), +_c(U+100120, "๔ ", f48084a0), +_c(U+100121, "๔ก", f48084a1), +_c(U+100122, "๔ข", f48084a2), +_c(U+100123, "๔ฃ", f48084a3), +_c(U+100124, "๔ค", f48084a4), +_c(U+100125, "๔ฅ", f48084a5), +_c(U+100126, "๔ฆ", f48084a6), +_c(U+100127, "๔ง", f48084a7), +_c(U+100128, "๔จ", f48084a8), +_c(U+100129, "๔ฉ", f48084a9), +_c(U+10012A, "๔ช", f48084aa), +_c(U+10012B, "๔ซ", f48084ab), +_c(U+10012C, "๔ฌ", f48084ac), +_c(U+10012D, "๔ญ", f48084ad), +_c(U+10012E, "๔ฎ", f48084ae), +_c(U+10012F, "๔ฏ", f48084af), +_c(U+100130, "๔ฐ", f48084b0), +_c(U+100131, "๔ฑ", f48084b1), +_c(U+100132, "๔ฒ", f48084b2), +_c(U+100133, "๔ณ", f48084b3), +_c(U+100134, "๔ด", f48084b4), +_c(U+100135, "๔ต", f48084b5), +_c(U+100136, "๔ถ", f48084b6), +_c(U+100137, "๔ท", f48084b7), +_c(U+100138, "๔ธ", f48084b8), +_c(U+100139, "๔น", f48084b9), +_c(U+10013A, "๔บ", f48084ba), +_c(U+10013B, "๔ป", f48084bb), +_c(U+10013C, "๔ผ", f48084bc), +_c(U+10013D, "๔ฝ", f48084bd), +_c(U+10013E, "๔พ", f48084be), +_c(U+10013F, "๔ฟ", f48084bf), +_c(U+100140, "๔
", f4808580), +_c(U+100141, "๔
", f4808581), +_c(U+100142, "๔
", f4808582), +_c(U+100143, "๔
", f4808583), +_c(U+100144, "๔
", f4808584), +_c(U+100145, "๔
", f4808585), +_c(U+100146, "๔
", f4808586), +_c(U+100147, "๔
", f4808587), +_c(U+100148, "๔
", f4808588), +_c(U+100149, "๔
", f4808589), +_c(U+10014A, "๔
", f480858a), +_c(U+10014B, "๔
", f480858b), +_c(U+10014C, "๔
", f480858c), +_c(U+10014D, "๔
", f480858d), +_c(U+10014E, "๔
", f480858e), +_c(U+10014F, "๔
", f480858f), +_c(U+100150, "๔
", f4808590), +_c(U+100151, "๔
", f4808591), +_c(U+100152, "๔
", f4808592), +_c(U+100153, "๔
", f4808593), +_c(U+100154, "๔
", f4808594), +_c(U+100155, "๔
", f4808595), +_c(U+100156, "๔
", f4808596), +_c(U+100157, "๔
", f4808597), +_c(U+100158, "๔
", f4808598), +_c(U+100159, "๔
", f4808599), +_c(U+10015A, "๔
", f480859a), +_c(U+10015B, "๔
", f480859b), +_c(U+10015C, "๔
", f480859c), +_c(U+10015D, "๔
", f480859d), +_c(U+10015E, "๔
", f480859e), +_c(U+10015F, "๔
", f480859f), +_c(U+100160, "๔
", f48085a0), +_c(U+100161, "๔
ก", f48085a1), +_c(U+100162, "๔
ข", f48085a2), +_c(U+100163, "๔
ฃ", f48085a3), +_c(U+100164, "๔
ค", f48085a4), +_c(U+100165, "๔
ฅ", f48085a5), +_c(U+100166, "๔
ฆ", f48085a6), +_c(U+100167, "๔
ง", f48085a7), +_c(U+100168, "๔
จ", f48085a8), +_c(U+100169, "๔
ฉ", f48085a9), +_c(U+10016A, "๔
ช", f48085aa), +_c(U+10016B, "๔
ซ", f48085ab), +_c(U+10016C, "๔
ฌ", f48085ac), +_c(U+10016D, "๔
ญ", f48085ad), +_c(U+10016E, "๔
ฎ", f48085ae), +_c(U+10016F, "๔
ฏ", f48085af), +_c(U+100170, "๔
ฐ", f48085b0), +_c(U+100171, "๔
ฑ", f48085b1), +_c(U+100172, "๔
ฒ", f48085b2), +_c(U+100173, "๔
ณ", f48085b3), +_c(U+100174, "๔
ด", f48085b4), +_c(U+100175, "๔
ต", f48085b5), +_c(U+100176, "๔
ถ", f48085b6), +_c(U+100177, "๔
ท", f48085b7), +_c(U+100178, "๔
ธ", f48085b8), +_c(U+100179, "๔
น", f48085b9), +_c(U+10017A, "๔
บ", f48085ba), +_c(U+10017B, "๔
ป", f48085bb), +_c(U+10017C, "๔
ผ", f48085bc), +_c(U+10017D, "๔
ฝ", f48085bd), +_c(U+10017E, "๔
พ", f48085be), +_c(U+10017F, "๔
ฟ", f48085bf), +_c(U+100180, "๔", f4808680), +_c(U+100181, "๔", f4808681), +_c(U+100182, "๔", f4808682), +_c(U+100183, "๔", f4808683), +_c(U+100184, "๔", f4808684), +_c(U+100185, "๔
", f4808685), +_c(U+100186, "๔", f4808686), +_c(U+100187, "๔", f4808687), +_c(U+100188, "๔", f4808688), +_c(U+100189, "๔", f4808689), +_c(U+10018A, "๔", f480868a), +_c(U+10018B, "๔", f480868b), +_c(U+10018C, "๔", f480868c), +_c(U+10018D, "๔", f480868d), +_c(U+10018E, "๔", f480868e), +_c(U+10018F, "๔", f480868f), +_c(U+100190, "๔", f4808690), +_c(U+100191, "๔", f4808691), +_c(U+100192, "๔", f4808692), +_c(U+100193, "๔", f4808693), +_c(U+100194, "๔", f4808694), +_c(U+100195, "๔", f4808695), +_c(U+100196, "๔", f4808696), +_c(U+100197, "๔", f4808697), +_c(U+100198, "๔", f4808698), +_c(U+100199, "๔", f4808699), +_c(U+10019A, "๔", f480869a), +_c(U+10019B, "๔", f480869b), +_c(U+10019C, "๔", f480869c), +_c(U+10019D, "๔", f480869d), +_c(U+10019E, "๔", f480869e), +_c(U+10019F, "๔", f480869f), +_c(U+1001A0, "๔ ", f48086a0), +_c(U+1001A1, "๔ก", f48086a1), +_c(U+1001A2, "๔ข", f48086a2), +_c(U+1001A3, "๔ฃ", f48086a3), +_c(U+1001A4, "๔ค", f48086a4), +_c(U+1001A5, "๔ฅ", f48086a5), +_c(U+1001A6, "๔ฆ", f48086a6), +_c(U+1001A7, "๔ง", f48086a7), +_c(U+1001A8, "๔จ", f48086a8), +_c(U+1001A9, "๔ฉ", f48086a9), +_c(U+1001AA, "๔ช", f48086aa), +_c(U+1001AB, "๔ซ", f48086ab), +_c(U+1001AC, "๔ฌ", f48086ac), +_c(U+1001AD, "๔ญ", f48086ad), +_c(U+1001AE, "๔ฎ", f48086ae), +_c(U+1001AF, "๔ฏ", f48086af), +_c(U+1001B0, "๔ฐ", f48086b0), +_c(U+1001B1, "๔ฑ", f48086b1), +_c(U+1001B2, "๔ฒ", f48086b2), +_c(U+1001B3, "๔ณ", f48086b3), +_c(U+1001B4, "๔ด", f48086b4), +_c(U+1001B5, "๔ต", f48086b5), +_c(U+1001B6, "๔ถ", f48086b6), +_c(U+1001B7, "๔ท", f48086b7), +_c(U+1001B8, "๔ธ", f48086b8), +_c(U+1001B9, "๔น", f48086b9), +_c(U+1001BA, "๔บ", f48086ba), +_c(U+1001BB, "๔ป", f48086bb), +_c(U+1001BC, "๔ผ", f48086bc), +_c(U+1001BD, "๔ฝ", f48086bd), +_c(U+1001BE, "๔พ", f48086be), +_c(U+1001BF, "๔ฟ", f48086bf), +_c(U+1001C0, "๔", f4808780), +_c(U+1001C1, "๔", f4808781), +_c(U+1001C2, "๔", f4808782), +_c(U+1001C3, "๔", f4808783), +_c(U+1001C4, "๔", f4808784), +_c(U+1001C5, "๔
", f4808785), +_c(U+1001C6, "๔", f4808786), +_c(U+1001C7, "๔", f4808787), +_c(U+1001C8, "๔", f4808788), +_c(U+1001C9, "๔", f4808789), +_c(U+1001CA, "๔", f480878a), +_c(U+1001CB, "๔", f480878b), +_c(U+1001CC, "๔", f480878c), +_c(U+1001CD, "๔", f480878d), +_c(U+1001CE, "๔", f480878e), +_c(U+1001CF, "๔", f480878f), +_c(U+1001D0, "๔", f4808790), +_c(U+1001D1, "๔", f4808791), +_c(U+1001D2, "๔", f4808792), +_c(U+1001D3, "๔", f4808793), +_c(U+1001D4, "๔", f4808794), +_c(U+1001D5, "๔", f4808795), +_c(U+1001D6, "๔", f4808796), +_c(U+1001D7, "๔", f4808797), +_c(U+1001D8, "๔", f4808798), +_c(U+1001D9, "๔", f4808799), +_c(U+1001DA, "๔", f480879a), +_c(U+1001DB, "๔", f480879b), +_c(U+1001DC, "๔", f480879c), +_c(U+1001DD, "๔", f480879d), +_c(U+1001DE, "๔", f480879e), +_c(U+1001DF, "๔", f480879f), +_c(U+1001E0, "๔ ", f48087a0), +_c(U+1001E1, "๔ก", f48087a1), +_c(U+1001E2, "๔ข", f48087a2), +_c(U+1001E3, "๔ฃ", f48087a3), +_c(U+1001E4, "๔ค", f48087a4), +_c(U+1001E5, "๔ฅ", f48087a5), +_c(U+1001E6, "๔ฆ", f48087a6), +_c(U+1001E7, "๔ง", f48087a7), +_c(U+1001E8, "๔จ", f48087a8), +_c(U+1001E9, "๔ฉ", f48087a9), +_c(U+1001EA, "๔ช", f48087aa), +_c(U+1001EB, "๔ซ", f48087ab), +_c(U+1001EC, "๔ฌ", f48087ac), +_c(U+1001ED, "๔ญ", f48087ad), +_c(U+1001EE, "๔ฎ", f48087ae), +_c(U+1001EF, "๔ฏ", f48087af), +_c(U+1001F0, "๔ฐ", f48087b0), +_c(U+1001F1, "๔ฑ", f48087b1), +_c(U+1001F2, "๔ฒ", f48087b2), +_c(U+1001F3, "๔ณ", f48087b3), +_c(U+1001F4, "๔ด", f48087b4), +_c(U+1001F5, "๔ต", f48087b5), +_c(U+1001F6, "๔ถ", f48087b6), +_c(U+1001F7, "๔ท", f48087b7), +_c(U+1001F8, "๔ธ", f48087b8), +_c(U+1001F9, "๔น", f48087b9), +_c(U+1001FA, "๔บ", f48087ba), +_c(U+1001FB, "๔ป", f48087bb), +_c(U+1001FC, "๔ผ", f48087bc), +_c(U+1001FD, "๔ฝ", f48087bd), +_c(U+1001FE, "๔พ", f48087be), +_c(U+1001FF, "๔ฟ", f48087bf), +_c(U+100200, "๔", f4808880), +_c(U+100201, "๔", f4808881), +_c(U+100202, "๔", f4808882), +_c(U+100203, "๔", f4808883), +_c(U+100204, "๔", f4808884), +_c(U+100205, "๔
", f4808885), +_c(U+100206, "๔", f4808886), +_c(U+100207, "๔", f4808887), +_c(U+100208, "๔", f4808888), +_c(U+100209, "๔", f4808889), +_c(U+10020A, "๔", f480888a), +_c(U+10020B, "๔", f480888b), +_c(U+10020C, "๔", f480888c), +_c(U+10020D, "๔", f480888d), +_c(U+10020E, "๔", f480888e), +_c(U+10020F, "๔", f480888f), +_c(U+100210, "๔", f4808890), +_c(U+100211, "๔", f4808891), +_c(U+100212, "๔", f4808892), +_c(U+100213, "๔", f4808893), +_c(U+100214, "๔", f4808894), +_c(U+100215, "๔", f4808895), +_c(U+100216, "๔", f4808896), +_c(U+100217, "๔", f4808897), +_c(U+100218, "๔", f4808898), +_c(U+100219, "๔", f4808899), +_c(U+10021A, "๔", f480889a), +_c(U+10021B, "๔", f480889b), +_c(U+10021C, "๔", f480889c), +_c(U+10021D, "๔", f480889d), +_c(U+10021E, "๔", f480889e), +_c(U+10021F, "๔", f480889f), +_c(U+100220, "๔ ", f48088a0), +_c(U+100221, "๔ก", f48088a1), +_c(U+100222, "๔ข", f48088a2), +_c(U+100223, "๔ฃ", f48088a3), +_c(U+100224, "๔ค", f48088a4), +_c(U+100225, "๔ฅ", f48088a5), +_c(U+100226, "๔ฆ", f48088a6), +_c(U+100227, "๔ง", f48088a7), +_c(U+100228, "๔จ", f48088a8), +_c(U+100229, "๔ฉ", f48088a9), +_c(U+10022A, "๔ช", f48088aa), +_c(U+10022B, "๔ซ", f48088ab), +_c(U+10022C, "๔ฌ", f48088ac), +_c(U+10022D, "๔ญ", f48088ad), +_c(U+10022E, "๔ฎ", f48088ae), +_c(U+10022F, "๔ฏ", f48088af), +_c(U+100230, "๔ฐ", f48088b0), +_c(U+100231, "๔ฑ", f48088b1), +_c(U+100232, "๔ฒ", f48088b2), +_c(U+100233, "๔ณ", f48088b3), +_c(U+100234, "๔ด", f48088b4), +_c(U+100235, "๔ต", f48088b5), +_c(U+100236, "๔ถ", f48088b6), +_c(U+100237, "๔ท", f48088b7), +_c(U+100238, "๔ธ", f48088b8), +_c(U+100239, "๔น", f48088b9), +_c(U+10023A, "๔บ", f48088ba), +_c(U+10023B, "๔ป", f48088bb), +_c(U+10023C, "๔ผ", f48088bc), +_c(U+10023D, "๔ฝ", f48088bd), +_c(U+10023E, "๔พ", f48088be), +_c(U+10023F, "๔ฟ", f48088bf), +_c(U+100240, "๔", f4808980), +_c(U+100241, "๔", f4808981), +_c(U+100242, "๔", f4808982), +_c(U+100243, "๔", f4808983), +_c(U+100244, "๔", f4808984), +_c(U+100245, "๔
", f4808985), +_c(U+100246, "๔", f4808986), +_c(U+100247, "๔", f4808987), +_c(U+100248, "๔", f4808988), +_c(U+100249, "๔", f4808989), +_c(U+10024A, "๔", f480898a), +_c(U+10024B, "๔", f480898b), +_c(U+10024C, "๔", f480898c), +_c(U+10024D, "๔", f480898d), +_c(U+10024E, "๔", f480898e), +_c(U+10024F, "๔", f480898f), +_c(U+100250, "๔", f4808990), +_c(U+100251, "๔", f4808991), +_c(U+100252, "๔", f4808992), +_c(U+100253, "๔", f4808993), +_c(U+100254, "๔", f4808994), +_c(U+100255, "๔", f4808995), +_c(U+100256, "๔", f4808996), +_c(U+100257, "๔", f4808997), +_c(U+100258, "๔", f4808998), +_c(U+100259, "๔", f4808999), +_c(U+10025A, "๔", f480899a), +_c(U+10025B, "๔", f480899b), +_c(U+10025C, "๔", f480899c), +_c(U+10025D, "๔", f480899d), +_c(U+10025E, "๔", f480899e), +_c(U+10025F, "๔", f480899f), +_c(U+100260, "๔ ", f48089a0), +_c(U+100261, "๔ก", f48089a1), +_c(U+100262, "๔ข", f48089a2), +_c(U+100263, "๔ฃ", f48089a3), +_c(U+100264, "๔ค", f48089a4), +_c(U+100265, "๔ฅ", f48089a5), +_c(U+100266, "๔ฆ", f48089a6), +_c(U+100267, "๔ง", f48089a7), +_c(U+100268, "๔จ", f48089a8), +_c(U+100269, "๔ฉ", f48089a9), +_c(U+10026A, "๔ช", f48089aa), +_c(U+10026B, "๔ซ", f48089ab), +_c(U+10026C, "๔ฌ", f48089ac), +_c(U+10026D, "๔ญ", f48089ad), +_c(U+10026E, "๔ฎ", f48089ae), +_c(U+10026F, "๔ฏ", f48089af), +_c(U+100270, "๔ฐ", f48089b0), +_c(U+100271, "๔ฑ", f48089b1), +_c(U+100272, "๔ฒ", f48089b2), +_c(U+100273, "๔ณ", f48089b3), +_c(U+100274, "๔ด", f48089b4), +_c(U+100275, "๔ต", f48089b5), +_c(U+100276, "๔ถ", f48089b6), +_c(U+100277, "๔ท", f48089b7), +_c(U+100278, "๔ธ", f48089b8), +_c(U+100279, "๔น", f48089b9), +_c(U+10027A, "๔บ", f48089ba), +_c(U+10027B, "๔ป", f48089bb), +_c(U+10027C, "๔ผ", f48089bc), +_c(U+10027D, "๔ฝ", f48089bd), +_c(U+10027E, "๔พ", f48089be), +_c(U+10027F, "๔ฟ", f48089bf), +_c(U+100280, "๔", f4808a80), +_c(U+100281, "๔", f4808a81), +_c(U+100282, "๔", f4808a82), +_c(U+100283, "๔", f4808a83), +_c(U+100284, "๔", f4808a84), +_c(U+100285, "๔
", f4808a85), +_c(U+100286, "๔", f4808a86), +_c(U+100287, "๔", f4808a87), +_c(U+100288, "๔", f4808a88), +_c(U+100289, "๔", f4808a89), +_c(U+10028A, "๔", f4808a8a), +_c(U+10028B, "๔", f4808a8b), +_c(U+10028C, "๔", f4808a8c), +_c(U+10028D, "๔", f4808a8d), +_c(U+10028E, "๔", f4808a8e), +_c(U+10028F, "๔", f4808a8f), +_c(U+100290, "๔", f4808a90), +_c(U+100291, "๔", f4808a91), +_c(U+100292, "๔", f4808a92), +_c(U+100293, "๔", f4808a93), +_c(U+100294, "๔", f4808a94), +_c(U+100295, "๔", f4808a95), +_c(U+100296, "๔", f4808a96), +_c(U+100297, "๔", f4808a97), +_c(U+100298, "๔", f4808a98), +_c(U+100299, "๔", f4808a99), +_c(U+10029A, "๔", f4808a9a), +_c(U+10029B, "๔", f4808a9b), +_c(U+10029C, "๔", f4808a9c), +_c(U+10029D, "๔", f4808a9d), +_c(U+10029E, "๔", f4808a9e), +_c(U+10029F, "๔", f4808a9f), +_c(U+1002A0, "๔ ", f4808aa0), +_c(U+1002A1, "๔ก", f4808aa1), +_c(U+1002A2, "๔ข", f4808aa2), +_c(U+1002A3, "๔ฃ", f4808aa3), +_c(U+1002A4, "๔ค", f4808aa4), +_c(U+1002A5, "๔ฅ", f4808aa5), +_c(U+1002A6, "๔ฆ", f4808aa6), +_c(U+1002A7, "๔ง", f4808aa7), +_c(U+1002A8, "๔จ", f4808aa8), +_c(U+1002A9, "๔ฉ", f4808aa9), +_c(U+1002AA, "๔ช", f4808aaa), +_c(U+1002AB, "๔ซ", f4808aab), +_c(U+1002AC, "๔ฌ", f4808aac), +_c(U+1002AD, "๔ญ", f4808aad), +_c(U+1002AE, "๔ฎ", f4808aae), +_c(U+1002AF, "๔ฏ", f4808aaf), +_c(U+1002B0, "๔ฐ", f4808ab0), +_c(U+1002B1, "๔ฑ", f4808ab1), +_c(U+1002B2, "๔ฒ", f4808ab2), +_c(U+1002B3, "๔ณ", f4808ab3), +_c(U+1002B4, "๔ด", f4808ab4), +_c(U+1002B5, "๔ต", f4808ab5), +_c(U+1002B6, "๔ถ", f4808ab6), +_c(U+1002B7, "๔ท", f4808ab7), +_c(U+1002B8, "๔ธ", f4808ab8), +_c(U+1002B9, "๔น", f4808ab9), +_c(U+1002BA, "๔บ", f4808aba), +_c(U+1002BB, "๔ป", f4808abb), +_c(U+1002BC, "๔ผ", f4808abc), +_c(U+1002BD, "๔ฝ", f4808abd), +_c(U+1002BE, "๔พ", f4808abe), +_c(U+1002BF, "๔ฟ", f4808abf), +_c(U+1002C0, "๔", f4808b80), +_c(U+1002C1, "๔", f4808b81), +_c(U+1002C2, "๔", f4808b82), +_c(U+1002C3, "๔", f4808b83), +_c(U+1002C4, "๔", f4808b84), +_c(U+1002C5, "๔
", f4808b85), +_c(U+1002C6, "๔", f4808b86), +_c(U+1002C7, "๔", f4808b87), +_c(U+1002C8, "๔", f4808b88), +_c(U+1002C9, "๔", f4808b89), +_c(U+1002CA, "๔", f4808b8a), +_c(U+1002CB, "๔", f4808b8b), +_c(U+1002CC, "๔", f4808b8c), +_c(U+1002CD, "๔", f4808b8d), +_c(U+1002CE, "๔", f4808b8e), +_c(U+1002CF, "๔", f4808b8f), +_c(U+1002D0, "๔", f4808b90), +_c(U+1002D1, "๔", f4808b91), +_c(U+1002D2, "๔", f4808b92), +_c(U+1002D3, "๔", f4808b93), +_c(U+1002D4, "๔", f4808b94), +_c(U+1002D5, "๔", f4808b95), +_c(U+1002D6, "๔", f4808b96), +_c(U+1002D7, "๔", f4808b97), +_c(U+1002D8, "๔", f4808b98), +_c(U+1002D9, "๔", f4808b99), +_c(U+1002DA, "๔", f4808b9a), +_c(U+1002DB, "๔", f4808b9b), +_c(U+1002DC, "๔", f4808b9c), +_c(U+1002DD, "๔", f4808b9d), +_c(U+1002DE, "๔", f4808b9e), +_c(U+1002DF, "๔", f4808b9f), +_c(U+1002E0, "๔ ", f4808ba0), +_c(U+1002E1, "๔ก", f4808ba1), +_c(U+1002E2, "๔ข", f4808ba2), +_c(U+1002E3, "๔ฃ", f4808ba3), +_c(U+1002E4, "๔ค", f4808ba4), +_c(U+1002E5, "๔ฅ", f4808ba5), +_c(U+1002E6, "๔ฆ", f4808ba6), +_c(U+1002E7, "๔ง", f4808ba7), +_c(U+1002E8, "๔จ", f4808ba8), +_c(U+1002E9, "๔ฉ", f4808ba9), +_c(U+1002EA, "๔ช", f4808baa), +_c(U+1002EB, "๔ซ", f4808bab), +_c(U+1002EC, "๔ฌ", f4808bac), +_c(U+1002ED, "๔ญ", f4808bad), +_c(U+1002EE, "๔ฎ", f4808bae), +_c(U+1002EF, "๔ฏ", f4808baf), +_c(U+1002F0, "๔ฐ", f4808bb0), +_c(U+1002F1, "๔ฑ", f4808bb1), +_c(U+1002F2, "๔ฒ", f4808bb2), +_c(U+1002F3, "๔ณ", f4808bb3), +_c(U+1002F4, "๔ด", f4808bb4), +_c(U+1002F5, "๔ต", f4808bb5), +_c(U+1002F6, "๔ถ", f4808bb6), +_c(U+1002F7, "๔ท", f4808bb7), +_c(U+1002F8, "๔ธ", f4808bb8), +_c(U+1002F9, "๔น", f4808bb9), +_c(U+1002FA, "๔บ", f4808bba), +_c(U+1002FB, "๔ป", f4808bbb), +_c(U+1002FC, "๔ผ", f4808bbc), +_c(U+1002FD, "๔ฝ", f4808bbd), +_c(U+1002FE, "๔พ", f4808bbe), +_c(U+1002FF, "๔ฟ", f4808bbf), +_c(U+100300, "๔", f4808c80), +_c(U+100301, "๔", f4808c81), +_c(U+100302, "๔", f4808c82), +_c(U+100303, "๔", f4808c83), +_c(U+100304, "๔", f4808c84), +_c(U+100305, "๔
", f4808c85), +_c(U+100306, "๔", f4808c86), +_c(U+100307, "๔", f4808c87), +_c(U+100308, "๔", f4808c88), +_c(U+100309, "๔", f4808c89), +_c(U+10030A, "๔", f4808c8a), +_c(U+10030B, "๔", f4808c8b), +_c(U+10030C, "๔", f4808c8c), +_c(U+10030D, "๔", f4808c8d), +_c(U+10030E, "๔", f4808c8e), +_c(U+10030F, "๔", f4808c8f), +_c(U+100310, "๔", f4808c90), +_c(U+100311, "๔", f4808c91), +_c(U+100312, "๔", f4808c92), +_c(U+100313, "๔", f4808c93), +_c(U+100314, "๔", f4808c94), +_c(U+100315, "๔", f4808c95), +_c(U+100316, "๔", f4808c96), +_c(U+100317, "๔", f4808c97), +_c(U+100318, "๔", f4808c98), +_c(U+100319, "๔", f4808c99), +_c(U+10031A, "๔", f4808c9a), +_c(U+10031B, "๔", f4808c9b), +_c(U+10031C, "๔", f4808c9c), +_c(U+10031D, "๔", f4808c9d), +_c(U+10031E, "๔", f4808c9e), +_c(U+10031F, "๔", f4808c9f), +_c(U+100320, "๔ ", f4808ca0), +_c(U+100321, "๔ก", f4808ca1), +_c(U+100322, "๔ข", f4808ca2), +_c(U+100323, "๔ฃ", f4808ca3), +_c(U+100324, "๔ค", f4808ca4), +_c(U+100325, "๔ฅ", f4808ca5), +_c(U+100326, "๔ฆ", f4808ca6), +_c(U+100327, "๔ง", f4808ca7), +_c(U+100328, "๔จ", f4808ca8), +_c(U+100329, "๔ฉ", f4808ca9), +_c(U+10032A, "๔ช", f4808caa), +_c(U+10032B, "๔ซ", f4808cab), +_c(U+10032C, "๔ฌ", f4808cac), +_c(U+10032D, "๔ญ", f4808cad), +_c(U+10032E, "๔ฎ", f4808cae), +_c(U+10032F, "๔ฏ", f4808caf), +_c(U+100330, "๔ฐ", f4808cb0), +_c(U+100331, "๔ฑ", f4808cb1), +_c(U+100332, "๔ฒ", f4808cb2), +_c(U+100333, "๔ณ", f4808cb3), +_c(U+100334, "๔ด", f4808cb4), +_c(U+100335, "๔ต", f4808cb5), +_c(U+100336, "๔ถ", f4808cb6), +_c(U+100337, "๔ท", f4808cb7), +_c(U+100338, "๔ธ", f4808cb8), +_c(U+100339, "๔น", f4808cb9), +_c(U+10033A, "๔บ", f4808cba), +_c(U+10033B, "๔ป", f4808cbb), +_c(U+10033C, "๔ผ", f4808cbc), +_c(U+10033D, "๔ฝ", f4808cbd), +_c(U+10033E, "๔พ", f4808cbe), +_c(U+10033F, "๔ฟ", f4808cbf), +_c(U+100340, "๔", f4808d80), +_c(U+100341, "๔", f4808d81), +_c(U+100342, "๔", f4808d82), +_c(U+100343, "๔", f4808d83), +_c(U+100344, "๔", f4808d84), +_c(U+100345, "๔
", f4808d85), +_c(U+100346, "๔", f4808d86), +_c(U+100347, "๔", f4808d87), +_c(U+100348, "๔", f4808d88), +_c(U+100349, "๔", f4808d89), +_c(U+10034A, "๔", f4808d8a), +_c(U+10034B, "๔", f4808d8b), +_c(U+10034C, "๔", f4808d8c), +_c(U+10034D, "๔", f4808d8d), +_c(U+10034E, "๔", f4808d8e), +_c(U+10034F, "๔", f4808d8f), +_c(U+100350, "๔", f4808d90), +_c(U+100351, "๔", f4808d91), +_c(U+100352, "๔", f4808d92), +_c(U+100353, "๔", f4808d93), +_c(U+100354, "๔", f4808d94), +_c(U+100355, "๔", f4808d95), +_c(U+100356, "๔", f4808d96), +_c(U+100357, "๔", f4808d97), +_c(U+100358, "๔", f4808d98), +_c(U+100359, "๔", f4808d99), +_c(U+10035A, "๔", f4808d9a), +_c(U+10035B, "๔", f4808d9b), +_c(U+10035C, "๔", f4808d9c), +_c(U+10035D, "๔", f4808d9d), +_c(U+10035E, "๔", f4808d9e), +_c(U+10035F, "๔", f4808d9f), +_c(U+100360, "๔ ", f4808da0), +_c(U+100361, "๔ก", f4808da1), +_c(U+100362, "๔ข", f4808da2), +_c(U+100363, "๔ฃ", f4808da3), +_c(U+100364, "๔ค", f4808da4), +_c(U+100365, "๔ฅ", f4808da5), +_c(U+100366, "๔ฆ", f4808da6), +_c(U+100367, "๔ง", f4808da7), +_c(U+100368, "๔จ", f4808da8), +_c(U+100369, "๔ฉ", f4808da9), +_c(U+10036A, "๔ช", f4808daa), +_c(U+10036B, "๔ซ", f4808dab), +_c(U+10036C, "๔ฌ", f4808dac), +_c(U+10036D, "๔ญ", f4808dad), +_c(U+10036E, "๔ฎ", f4808dae), +_c(U+10036F, "๔ฏ", f4808daf), +_c(U+100370, "๔ฐ", f4808db0), +_c(U+100371, "๔ฑ", f4808db1), +_c(U+100372, "๔ฒ", f4808db2), +_c(U+100373, "๔ณ", f4808db3), +_c(U+100374, "๔ด", f4808db4), +_c(U+100375, "๔ต", f4808db5), +_c(U+100376, "๔ถ", f4808db6), +_c(U+100377, "๔ท", f4808db7), +_c(U+100378, "๔ธ", f4808db8), +_c(U+100379, "๔น", f4808db9), +_c(U+10037A, "๔บ", f4808dba), +_c(U+10037B, "๔ป", f4808dbb), +_c(U+10037C, "๔ผ", f4808dbc), +_c(U+10037D, "๔ฝ", f4808dbd), +_c(U+10037E, "๔พ", f4808dbe), +_c(U+10037F, "๔ฟ", f4808dbf), +_c(U+100380, "๔", f4808e80), +_c(U+100381, "๔", f4808e81), +_c(U+100382, "๔", f4808e82), +_c(U+100383, "๔", f4808e83), +_c(U+100384, "๔", f4808e84), +_c(U+100385, "๔
", f4808e85), +_c(U+100386, "๔", f4808e86), +_c(U+100387, "๔", f4808e87), +_c(U+100388, "๔", f4808e88), +_c(U+100389, "๔", f4808e89), +_c(U+10038A, "๔", f4808e8a), +_c(U+10038B, "๔", f4808e8b), +_c(U+10038C, "๔", f4808e8c), +_c(U+10038D, "๔", f4808e8d), +_c(U+10038E, "๔", f4808e8e), +_c(U+10038F, "๔", f4808e8f), +_c(U+100390, "๔", f4808e90), +_c(U+100391, "๔", f4808e91), +_c(U+100392, "๔", f4808e92), +_c(U+100393, "๔", f4808e93), +_c(U+100394, "๔", f4808e94), +_c(U+100395, "๔", f4808e95), +_c(U+100396, "๔", f4808e96), +_c(U+100397, "๔", f4808e97), +_c(U+100398, "๔", f4808e98), +_c(U+100399, "๔", f4808e99), +_c(U+10039A, "๔", f4808e9a), +_c(U+10039B, "๔", f4808e9b), +_c(U+10039C, "๔", f4808e9c), +_c(U+10039D, "๔", f4808e9d), +_c(U+10039E, "๔", f4808e9e), +_c(U+10039F, "๔", f4808e9f), +_c(U+1003A0, "๔ ", f4808ea0), +_c(U+1003A1, "๔ก", f4808ea1), +_c(U+1003A2, "๔ข", f4808ea2), +_c(U+1003A3, "๔ฃ", f4808ea3), +_c(U+1003A4, "๔ค", f4808ea4), +_c(U+1003A5, "๔ฅ", f4808ea5), +_c(U+1003A6, "๔ฆ", f4808ea6), +_c(U+1003A7, "๔ง", f4808ea7), +_c(U+1003A8, "๔จ", f4808ea8), +_c(U+1003A9, "๔ฉ", f4808ea9), +_c(U+1003AA, "๔ช", f4808eaa), +_c(U+1003AB, "๔ซ", f4808eab), +_c(U+1003AC, "๔ฌ", f4808eac), +_c(U+1003AD, "๔ญ", f4808ead), +_c(U+1003AE, "๔ฎ", f4808eae), +_c(U+1003AF, "๔ฏ", f4808eaf), +_c(U+1003B0, "๔ฐ", f4808eb0), +_c(U+1003B1, "๔ฑ", f4808eb1), +_c(U+1003B2, "๔ฒ", f4808eb2), +_c(U+1003B3, "๔ณ", f4808eb3), +_c(U+1003B4, "๔ด", f4808eb4), +_c(U+1003B5, "๔ต", f4808eb5), +_c(U+1003B6, "๔ถ", f4808eb6), +_c(U+1003B7, "๔ท", f4808eb7), +_c(U+1003B8, "๔ธ", f4808eb8), +_c(U+1003B9, "๔น", f4808eb9), +_c(U+1003BA, "๔บ", f4808eba), +_c(U+1003BB, "๔ป", f4808ebb), +_c(U+1003BC, "๔ผ", f4808ebc), +_c(U+1003BD, "๔ฝ", f4808ebd), +_c(U+1003BE, "๔พ", f4808ebe), +_c(U+1003BF, "๔ฟ", f4808ebf), +_c(U+1003C0, "๔", f4808f80), +_c(U+1003C1, "๔", f4808f81), +_c(U+1003C2, "๔", f4808f82), +_c(U+1003C3, "๔", f4808f83), +_c(U+1003C4, "๔", f4808f84), +_c(U+1003C5, "๔
", f4808f85), +_c(U+1003C6, "๔", f4808f86), +_c(U+1003C7, "๔", f4808f87), +_c(U+1003C8, "๔", f4808f88), +_c(U+1003C9, "๔", f4808f89), +_c(U+1003CA, "๔", f4808f8a), +_c(U+1003CB, "๔", f4808f8b), +_c(U+1003CC, "๔", f4808f8c), +_c(U+1003CD, "๔", f4808f8d), +_c(U+1003CE, "๔", f4808f8e), +_c(U+1003CF, "๔", f4808f8f), +_c(U+1003D0, "๔", f4808f90), +_c(U+1003D1, "๔", f4808f91), +_c(U+1003D2, "๔", f4808f92), +_c(U+1003D3, "๔", f4808f93), +_c(U+1003D4, "๔", f4808f94), +_c(U+1003D5, "๔", f4808f95), +_c(U+1003D6, "๔", f4808f96), +_c(U+1003D7, "๔", f4808f97), +_c(U+1003D8, "๔", f4808f98), +_c(U+1003D9, "๔", f4808f99), +_c(U+1003DA, "๔", f4808f9a), +_c(U+1003DB, "๔", f4808f9b), +_c(U+1003DC, "๔", f4808f9c), +_c(U+1003DD, "๔", f4808f9d), +_c(U+1003DE, "๔", f4808f9e), +_c(U+1003DF, "๔", f4808f9f), +_c(U+1003E0, "๔ ", f4808fa0), +_c(U+1003E1, "๔ก", f4808fa1), +_c(U+1003E2, "๔ข", f4808fa2), +_c(U+1003E3, "๔ฃ", f4808fa3), +_c(U+1003E4, "๔ค", f4808fa4), +_c(U+1003E5, "๔ฅ", f4808fa5), +_c(U+1003E6, "๔ฆ", f4808fa6), +_c(U+1003E7, "๔ง", f4808fa7), +_c(U+1003E8, "๔จ", f4808fa8), +_c(U+1003E9, "๔ฉ", f4808fa9), +_c(U+1003EA, "๔ช", f4808faa), +_c(U+1003EB, "๔ซ", f4808fab), +_c(U+1003EC, "๔ฌ", f4808fac), +_c(U+1003ED, "๔ญ", f4808fad), +_c(U+1003EE, "๔ฎ", f4808fae), +_c(U+1003EF, "๔ฏ", f4808faf), +_c(U+1003F0, "๔ฐ", f4808fb0), +_c(U+1003F1, "๔ฑ", f4808fb1), +_c(U+1003F2, "๔ฒ", f4808fb2), +_c(U+1003F3, "๔ณ", f4808fb3), +_c(U+1003F4, "๔ด", f4808fb4), +_c(U+1003F5, "๔ต", f4808fb5), +_c(U+1003F6, "๔ถ", f4808fb6), +_c(U+1003F7, "๔ท", f4808fb7), +_c(U+1003F8, "๔ธ", f4808fb8), +_c(U+1003F9, "๔น", f4808fb9), +_c(U+1003FA, "๔บ", f4808fba), +_c(U+1003FB, "๔ป", f4808fbb), +_c(U+1003FC, "๔ผ", f4808fbc), +_c(U+1003FD, "๔ฝ", f4808fbd), +_c(U+1003FE, "๔พ", f4808fbe), +_c(U+1003FF, "๔ฟ", f4808fbf), +#undef _c |