\hypertarget{main_8cpp_source}{}\doxysection{main.\+cpp} \label{main_8cpp_source}\index{tests/main.cpp@{tests/main.cpp}} \mbox{\hyperlink{main_8cpp}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00001}00001 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{containers_8h}{kblib/containers.h}}"{}}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00002}00002 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{icu_8h}{kblib/icu.h}}"{}}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00003}00003 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{kblib_8h}{kblib/kblib.h}}"{}}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00004}00004 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00005}00005 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00006}00006 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00007}00007 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00008}00008 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00009}00009 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00010}00010 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00011}00011 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00012}00012 \textcolor{preprocessor}{\#include "{}catch.hpp"{}}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00013}00013 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00014}00014 \textcolor{preprocessor}{\#if KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00015}00015 \textcolor{keyword}{template} <\textcolor{keyword}{class} T>} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00016}\mbox{\hyperlink{main_8cpp_a31275df6c2b5cdfef4c9063d60d1e742}{00016}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{main_8cpp_a31275df6c2b5cdfef4c9063d60d1e742}{type\_name\_f}}() -\/> std::string\_view \{} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00017}00017 \textcolor{keyword}{using namespace }\mbox{\hyperlink{namespacestd}{std}};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00018}00018 \textcolor{keyword}{auto} sz = \textcolor{keyword}{sizeof}(\textcolor{stringliteral}{"{}type\_name\_f"{}}) -\/ 1;} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00019}00019 \textcolor{preprocessor}{\# ifdef \_\_clang\_\_}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00020}00020 string\_view p = \_\_PRETTY\_FUNCTION\_\_;} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00021}00021 \textcolor{keyword}{auto} begin = 25 + sz;} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00022}00022 \textcolor{keywordflow}{return} string\_view(p.data() + begin, p.size() -\/ begin -\/ 1);} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00023}00023 \textcolor{preprocessor}{\# elif defined(\_\_GNUC\_\_)}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00024}00024 string\_view p = \_\_PRETTY\_FUNCTION\_\_;} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00025}00025 \textcolor{preprocessor}{\# ifdef \_\_INTEL\_COMPILER}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00026}00026 \textcolor{keyword}{auto} begin = 76 + sz;} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00027}00027 \textcolor{keywordflow}{return} string\_view(p.data() + begin, p.size() -\/ begin -\/ 1);} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00028}00028 \textcolor{preprocessor}{\# elif \_\_cplusplus < 201402}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00029}00029 \textcolor{keyword}{auto} begin = 17 + sz;} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00030}00030 \textcolor{keywordflow}{return} string\_view(p.data() + begin, p.size() -\/ begin -\/ 1);} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00031}00031 \textcolor{preprocessor}{\# else}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00032}00032 \textcolor{keyword}{auto} begin = 40 + sz;} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00033}00033 \textcolor{keywordflow}{return} string\_view(p.data() + begin, p.find(\textcolor{charliteral}{';'}, begin) -\/ begin);} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00034}00034 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00035}00035 \textcolor{preprocessor}{\# elif defined(\_MSC\_VER)}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00036}00036 string\_view p = \_\_FUNCSIG\_\_;} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00037}00037 \textcolor{keyword}{auto} begin = 75 + sz;} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00038}00038 \textcolor{keywordflow}{return} string\_view(p.data() + begin, p.size() -\/ begin -\/ 7);} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00039}00039 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00040}00040 \}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00041}00041 \textcolor{keyword}{static\_assert}(type\_name\_f() == \textcolor{stringliteral}{"{}char"{}});} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00042}00042 \textcolor{preprocessor}{\#endif}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00043}00043 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00044}00044 \textcolor{keyword}{template} <\textcolor{keyword}{typename} C>} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00045}\mbox{\hyperlink{main_8cpp_a8ba42fd5a979f45fd45102954c8d009a}{00045}} \textcolor{keyword}{constexpr} \textcolor{keyword}{const} \textcolor{keywordtype}{char} \mbox{\hyperlink{main_8cpp_a8ba42fd5a979f45fd45102954c8d009a}{type\_name}}[] = \textcolor{stringliteral}{"{}unknown"{}};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00046}00046 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00047}00047 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00048}\mbox{\hyperlink{main_8cpp_a2f9235ec873f5bd62f287ccf1ca119de}{00048}} \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} \textcolor{keyword}{constexpr} \textcolor{keyword}{const} \textcolor{keywordtype}{char} \mbox{\hyperlink{main_8cpp_a2f9235ec873f5bd62f287ccf1ca119de}{type\_name}}[] = \textcolor{stringliteral}{"{}char"{}};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00049}00049 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00050}\mbox{\hyperlink{main_8cpp_a57cb7914b7ed8228c2ec5402affb87c8}{00050}} \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} \textcolor{keyword}{constexpr} \textcolor{keyword}{const} \textcolor{keywordtype}{char} \mbox{\hyperlink{main_8cpp_a57cb7914b7ed8228c2ec5402affb87c8}{type\_name}}[] = \textcolor{stringliteral}{"{}unsigned char"{}};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00051}00051 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00052}\mbox{\hyperlink{main_8cpp_a03ef1c670f8484c2df28fd82961c13cb}{00052}} \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} \textcolor{keyword}{constexpr} \textcolor{keyword}{const} \textcolor{keywordtype}{char} \mbox{\hyperlink{main_8cpp_a03ef1c670f8484c2df28fd82961c13cb}{type\_name}}[] = \textcolor{stringliteral}{"{}signed char"{}};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00053}00053 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00054}00054 \textcolor{keyword}{template} <\textcolor{keywordtype}{int} depth>} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00055}\mbox{\hyperlink{structbad__iterator}{00055}} \textcolor{keyword}{struct }\mbox{\hyperlink{structbad__iterator}{bad\_iterator}} \{} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00056}\mbox{\hyperlink{structbad__iterator_a5161250bbec61c6b6df7fa5964c44fa4}{00056}} \textcolor{keywordtype}{int}* \mbox{\hyperlink{structbad__iterator_a5161250bbec61c6b6df7fa5964c44fa4}{p}};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00057}\mbox{\hyperlink{structbad__iterator_a3426aea3ae84f212fae1febf8b8dfaba}{00057}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{structbad__iterator_a3426aea3ae84f212fae1febf8b8dfaba}{operator-\/>}}() const noexcept -\/> \mbox{\hyperlink{structbad__iterator}{bad\_iterator}} \{} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00058}00058 \textcolor{keywordflow}{return} \{\mbox{\hyperlink{structbad__iterator_a5161250bbec61c6b6df7fa5964c44fa4}{p}}\};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00059}00059 \}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00060}00060 \};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00061}00061 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00062}00062 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00063}\mbox{\hyperlink{structbad__iterator_3_010_01_4}{00063}} \textcolor{keyword}{struct }\mbox{\hyperlink{structbad__iterator}{bad\_iterator}}<0> \{} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00064}\mbox{\hyperlink{structbad__iterator_3_010_01_4_afb024ea81e308c1dc3da0fe290ed9adb}{00064}} \textcolor{keywordtype}{int}* \mbox{\hyperlink{structbad__iterator_3_010_01_4_afb024ea81e308c1dc3da0fe290ed9adb}{p}};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00065}\mbox{\hyperlink{structbad__iterator_3_010_01_4_afcafbb5e7addeccaacdf0ea0c0851cf8}{00065}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{structbad__iterator_3_010_01_4_afcafbb5e7addeccaacdf0ea0c0851cf8}{operator-\/>}}() const noexcept -\/> \textcolor{keywordtype}{int}* \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structbad__iterator_a5161250bbec61c6b6df7fa5964c44fa4}{p}}; \}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00066}00066 \};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00067}00067 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00068}\mbox{\hyperlink{main_8cpp_a87feefefd3868afd53b1f40314e0dce0}{00068}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{main_8cpp_a87feefefd3868afd53b1f40314e0dce0}{test}}() noexcept -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00069}00069 \textcolor{keywordtype}{int} i\{\};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00070}00070 \textcolor{keywordflow}{return} \&i == \mbox{\hyperlink{namespacekblib_a1c2aa67048789f77bea56734a583d3d1}{kblib::to\_pointer}}(\&i)} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00071}00071 and \&i == \mbox{\hyperlink{namespacekblib_a1c2aa67048789f77bea56734a583d3d1}{kblib::to\_pointer}}(\mbox{\hyperlink{structbad__iterator_3_010_01_4}{bad\_iterator<0>}}\{\&i\})} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00072}00072 and \&i == \mbox{\hyperlink{namespacekblib_a1c2aa67048789f77bea56734a583d3d1}{kblib::to\_pointer}}(\mbox{\hyperlink{structbad__iterator}{bad\_iterator<1>}}\{\&i\})} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00073}00073 and \&i == \mbox{\hyperlink{namespacekblib_a1c2aa67048789f77bea56734a583d3d1}{kblib::to\_pointer}}(\mbox{\hyperlink{structbad__iterator}{bad\_iterator<100>}}\{\&i\});} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00074}00074 \}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00075}00075 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00076}00076 \textcolor{keyword}{static\_assert}(\mbox{\hyperlink{main_8cpp_a87feefefd3868afd53b1f40314e0dce0}{test}}(), \textcolor{stringliteral}{"{}"{}});} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00077}00077 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00078}\mbox{\hyperlink{main_8cpp_a65a92e2d82efaf19ea3ea77e6ea8e79a}{00078}} \textcolor{keyword}{auto} \mbox{\hyperlink{main_8cpp_a87feefefd3868afd53b1f40314e0dce0}{test}}(std::streamsize s) -\/> \textcolor{keywordtype}{void} \{ std::cout << s << \textcolor{charliteral}{'\(\backslash\)n'}; \}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00079}\mbox{\hyperlink{main_8cpp_a90c8cb395c686c8b3aad41711e69481b}{00079}} \textcolor{keywordtype}{void} \mbox{\hyperlink{main_8cpp_a90c8cb395c686c8b3aad41711e69481b}{test\_trie}}();} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00080}00080 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00081}\mbox{\hyperlink{main_8cpp_afffae7387e74be624b8899566ad4aeff}{00081}} \mbox{\hyperlink{main_8cpp_afffae7387e74be624b8899566ad4aeff}{TEST\_CASE}}(\textcolor{stringliteral}{"{}main"{}}) \{} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00082}00082 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00083}00083 \textcolor{keywordflow}{for} (\textcolor{keywordtype}{unsigned} b = 0; b < 62; ++b) \{} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00084}00084 std::uint64\_t i = 1ull << b;} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00085}00085 std::pair lengths[] = \{} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00086}00086 \{\mbox{\hyperlink{namespacekblib_a9d7e23caee89855a71fb84c7f245f977}{std::to\_string}}(i).length(), \mbox{\hyperlink{namespacekblib_ab5e75c9314c76b12efd507259206a546}{kblib::count\_digits}}(i)\},} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00087}00087 \{\mbox{\hyperlink{namespacekblib_a9d7e23caee89855a71fb84c7f245f977}{std::to\_string}}(-\/i).length(), \mbox{\hyperlink{namespacekblib_ab5e75c9314c76b12efd507259206a546}{kblib::count\_digits}}(-\/i)\},} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00088}00088 \};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00089}00089 \textcolor{keywordflow}{for} (\textcolor{keyword}{auto} \mbox{\hyperlink{main_8cpp_a87feefefd3868afd53b1f40314e0dce0}{test}} : lengths) \{} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00090}00090 \textcolor{keywordflow}{if} (\mbox{\hyperlink{main_8cpp_a87feefefd3868afd53b1f40314e0dce0}{test}}.first != \mbox{\hyperlink{main_8cpp_a87feefefd3868afd53b1f40314e0dce0}{test}}.second) \{} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00091}00091 std::cout << \textcolor{stringliteral}{"{}count\_digits failure at: "{}} << i << \textcolor{stringliteral}{"{}.\(\backslash\)nExpected "{}}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00092}00092 << \mbox{\hyperlink{main_8cpp_a87feefefd3868afd53b1f40314e0dce0}{test}}.first << \textcolor{stringliteral}{"{}, got "{}} << \mbox{\hyperlink{main_8cpp_a87feefefd3868afd53b1f40314e0dce0}{test}}.second << \textcolor{stringliteral}{"{}.\(\backslash\)n"{}};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00093}00093 \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00094}00094 \}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00095}00095 \}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00096}00096 \}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00097}00097 } \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00098}00098 \textcolor{comment}{// test\_trie();}} \DoxyCodeLine{\Hypertarget{main_8cpp_source_l00099}00099 \}} \end{DoxyCode}