\hypertarget{build_8cpp_source}{}\doxysection{build.\+cpp}
\label{build_8cpp_source}\index{tests/build.cpp@{tests/build.cpp}}
\mbox{\hyperlink{build_8cpp}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00001}00001 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{build_8h}{kblib/build.h}}"{}}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00002}00002 \textcolor{preprocessor}{\#include "{}catch.hpp"{}}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00003}00003 \textcolor{preprocessor}{\#include <array>}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00004}00004 \textcolor{preprocessor}{\#include <iostream>}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00005}00005 }
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00006}00006 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{containers_8h}{kblib/containers.h}}"{}}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00007}00007 }
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00008}\mbox{\hyperlink{build_8cpp_a8daf625fa06840cc57b37ae7b8caf296}{00008}} \mbox{\hyperlink{build_8cpp_a8daf625fa06840cc57b37ae7b8caf296}{TEST\_CASE}}(\textcolor{stringliteral}{"{}build family"{}}, \textcolor{stringliteral}{"{}[build]"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00009}00009    \textcolor{keyword}{using }arr = std::array<int, 8>;}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00010}00010    \textcolor{keyword}{const} arr input = \{2, 3, 5, 7, 11, 13, 17, 19\};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00011}00011    \textcolor{keyword}{const} arr input2 = \{1, 1, 1, 1, 1, 1, 1, 1\};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00012}00012    \textcolor{keyword}{const} \textcolor{keyword}{auto} unary\_f = [](\textcolor{keywordtype}{int} x) \{ \textcolor{keywordflow}{return} x * x; \};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00013}00013    \textcolor{keyword}{const} \textcolor{keyword}{auto} binary\_f = [](\textcolor{keywordtype}{int} \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}, \textcolor{keywordtype}{int} b) \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}} -\/ b; \};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00014}00014    \textcolor{keyword}{const} arr squared = \{4, 9, 25, 49, 121, 169, 289, 361\};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00015}00015    \textcolor{keyword}{const} arr pminusone = \{1, 2, 4, 6, 10, 12, 16, 18\};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00016}00016 }
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00017}00017    \textcolor{keyword}{const} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}} = [](\textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}, \textcolor{keyword}{auto} b) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00018}00018       \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{std::equal}}(std::begin(\mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}), std::end(\mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}), std::begin(b), std::end(b));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00019}00019    \};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00020}00020    \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} \textcolor{keyword}{auto} print\_arr = [\&](\textcolor{keyword}{auto} c) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00021}00021       \textcolor{keywordflow}{for} (\textcolor{keyword}{const} \textcolor{keyword}{auto}\& v : c) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00022}00022          std::cout << v << \textcolor{stringliteral}{"{}, "{}};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00023}00023       \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00024}00024       std::cout << \textcolor{charliteral}{'\(\backslash\)n'};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00025}00025    \};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00026}00026 }
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00027}00027    SECTION(\textcolor{stringliteral}{"{}unary dynamic build"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00028}00028       \textcolor{keyword}{auto} built}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00029}00029           = kblib::build<std::vector<int>>(input.begin(), input.end(), unary\_f);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00030}00030       REQUIRE(\mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(squared, built));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00031}00031    \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00032}00032    SECTION(\textcolor{stringliteral}{"{}binary dynamic build"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00033}00033       \textcolor{keyword}{auto} built = kblib::build<std::vector<int>>(input.begin(), input.end(),}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00034}00034                                                   input2.begin(), binary\_f);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00035}00035       REQUIRE(\mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(pminusone, built));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00036}00036    \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00037}00037    SECTION(\textcolor{stringliteral}{"{}unary array build"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00038}00038       \textcolor{keyword}{auto} built = kblib::build<arr>(input.begin(), input.end(), unary\_f);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00039}00039       REQUIRE(\mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(squared, built));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00040}00040    \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00041}00041    SECTION(\textcolor{stringliteral}{"{}binary array build"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00042}00042       \textcolor{keyword}{auto} built = kblib::build<arr>(input.begin(), input.end(), input2.begin(),}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00043}00043                                      binary\_f);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00044}00044       REQUIRE(\mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(pminusone, built));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00045}00045    \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00046}00046    \textcolor{keyword}{const} arr \mbox{\hyperlink{namespacekblib_a40d0e463984f5ab01f6db106dbad9fb0}{iota}} = \{0, 1, 2, 3, 4, 5, 6, 7\};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00047}00047    SECTION(\textcolor{stringliteral}{"{}dynamic generator build"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00048}00048       \textcolor{keyword}{auto} built = kblib::build<std::vector<int>>(}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00049}00049           [x = 0]() \textcolor{keyword}{mutable} \{ \textcolor{keywordflow}{return} x++; \}, 8u);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00050}00050       REQUIRE(\mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(\mbox{\hyperlink{namespacekblib_a40d0e463984f5ab01f6db106dbad9fb0}{iota}}, built));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00051}00051    \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00052}00052    SECTION(\textcolor{stringliteral}{"{}array generator build"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00053}00053       \textcolor{keyword}{auto} built = kblib::build<arr>([x = 0]() \textcolor{keyword}{mutable} \{ \textcolor{keywordflow}{return} x++; \});}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00054}00054       REQUIRE(\mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(\mbox{\hyperlink{namespacekblib_a40d0e463984f5ab01f6db106dbad9fb0}{iota}}, built));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00055}00055    \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00056}00056    SECTION(\textcolor{stringliteral}{"{}dynamic buildiota"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00057}00057       \textcolor{keyword}{auto} built = kblib::buildiota<std::vector<int>>(8u, 0);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00058}00058       REQUIRE(\mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(\mbox{\hyperlink{namespacekblib_a40d0e463984f5ab01f6db106dbad9fb0}{iota}}, built));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00059}00059    \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00060}00060    SECTION(\textcolor{stringliteral}{"{}array buildiota"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00061}00061       \textcolor{keyword}{auto} built = kblib::buildiota<arr>(0);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00062}00062       REQUIRE(\mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(\mbox{\hyperlink{namespacekblib_a40d0e463984f5ab01f6db106dbad9fb0}{iota}}, built));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00063}00063    \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00064}00064 \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00066}\mbox{\hyperlink{build_8cpp_a5b9f48d4561fef660b23a8523d2f777b}{00066}} \mbox{\hyperlink{build_8cpp_a8daf625fa06840cc57b37ae7b8caf296}{TEST\_CASE}}(\textcolor{stringliteral}{"{}buildiota"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00067}00067    \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}} = [](\textcolor{keyword}{auto} r1, \textcolor{keyword}{auto} r2) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00068}00068       \textcolor{keyword}{auto} r1b = r1.begin();}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00069}00069       \textcolor{keyword}{auto} r1e = r1.end();}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00070}00070       \textcolor{keyword}{auto} r2b = r2.begin();}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00071}00071       \textcolor{keyword}{auto} r2e = r2.end();}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00072}00072       \textcolor{keywordflow}{return} (std::distance(r1b, r1e) == std::distance(r2b, r2e))}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00073}00073              and \mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{kblib::equal}}(r1b, r1e, r2b);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00074}00074    \};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00075}00075 }
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00076}00076    \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} target = std::array<int, 10>\{\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}\};}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00077}00077    \textcolor{keyword}{auto} i1 = kblib::buildiota<std::vector<int>>(10u, 0);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00078}00078    \textcolor{keyword}{auto} i2 = kblib::buildiota<std::vector<int>>(10u, 0, 1);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00079}00079    \textcolor{keyword}{auto} i3 = kblib::buildiota<std::array<int, 10>>(0);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00080}00080    \textcolor{keyword}{auto} i4 = kblib::buildiota<std::array<int, 10>>(0, 1);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00081}00081    \textcolor{keyword}{auto} i5}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00082}00082        = kblib::buildiota<kblib::construct\_with\_size<std::vector<int>, 10>>(0);}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00083}00083 }
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00084}00084    REQUIRE((i1.size() == target.size() and \mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(i1, target)));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00085}00085    REQUIRE((i2.size() == target.size() and \mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(i2, target)));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00086}00086    REQUIRE((i3.size() == target.size() and \mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(i3, target)));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00087}00087    REQUIRE((i4.size() == target.size() and \mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(i4, target)));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00088}00088    REQUIRE((i5.size() == target.size() and \mbox{\hyperlink{namespacekblib_afbec3807c1be9d0aea88c620d673823c}{equal}}(i5, target)));}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00089}00089 \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00090}00090 }
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00091}\mbox{\hyperlink{build_8cpp_aee822abba341493cfea79503f4cb4229}{00091}} \mbox{\hyperlink{build_8cpp_a8daf625fa06840cc57b37ae7b8caf296}{TEST\_CASE}}(\textcolor{stringliteral}{"{}build\_copy family"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00093}00093 \}}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00094}00094 }
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00095}\mbox{\hyperlink{build_8cpp_afd7a12c5f1ee189f81d2bc536b040a36}{00095}} \mbox{\hyperlink{build_8cpp_a8daf625fa06840cc57b37ae7b8caf296}{TEST\_CASE}}(\textcolor{stringliteral}{"{}build.h iterators"{}}) \{}
\DoxyCodeLine{\Hypertarget{build_8cpp_source_l00097}00097 \}}

\end{DoxyCode}
