aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/include/derivation_clause_suite.hpp11
-rw-r--r--test/include/kawaii.hpp142
-rw-r--r--test/include/new_type_constructor_suite.hpp11
-rw-r--r--test/src/derivation_clause_suite.cpp312
-rw-r--r--test/src/driver.cpp89
-rw-r--r--test/src/new_type_constructor_suite.cpp68
6 files changed, 633 insertions, 0 deletions
diff --git a/test/include/derivation_clause_suite.hpp b/test/include/derivation_clause_suite.hpp
new file mode 100644
index 0000000..b5ef5c2
--- /dev/null
+++ b/test/include/derivation_clause_suite.hpp
@@ -0,0 +1,11 @@
+#ifndef NEWTYPE_TEST_DERIVATION_CLAUSE_SUITE_HPP
+#define NEWTYPE_TEST_DERIVATION_CLAUSE_SUITE_HPP
+
+#include <cute/cute_suite.h>
+
+#include <string>
+#include <utility>
+
+auto derivation_clause_suite() -> std::pair<cute::suite, std::string>;
+
+#endif \ No newline at end of file
diff --git a/test/include/kawaii.hpp b/test/include/kawaii.hpp
new file mode 100644
index 0000000..787f38a
--- /dev/null
+++ b/test/include/kawaii.hpp
@@ -0,0 +1,142 @@
+#ifndef NEWTYPE_TEST_KAWAII_HPP
+#define NEWTYPE_TEST_KAWAII_HPP
+
+#include <cute/cute_test.h>
+
+#include <algorithm>
+#include <array>
+#include <cctype>
+#include <iterator>
+#include <sstream>
+#include <string>
+#include <utility>
+
+namespace nt::test
+{
+
+ namespace impl
+ {
+ auto constexpr prepositions = std::array{"a", "an", "and", "as", "at", "by", "for", "in", "of", "on", "or", "the", "to"};
+
+ auto constexpr type_names = std::array{"new_type", "derivation_clause"};
+
+ auto inline replace_template_argument_syntax(std::string const & name) -> std::string
+ {
+ using namespace std::string_literals;
+
+ auto template_argument_start = find(cbegin(name), cend(name), '<');
+
+ if (template_argument_start == cend(name))
+ {
+ return name;
+ }
+
+ auto replaced{""s};
+
+ copy(cbegin(name), template_argument_start, back_inserter(replaced));
+
+ replaced += " [ T = ";
+
+ auto template_argument_end = find(template_argument_start, cend(name), '>');
+
+ copy(template_argument_start + 1, template_argument_end, back_inserter(replaced));
+
+ return replaced + " ]";
+ }
+
+ auto inline is_prefix(std::string const & suspect, std::string const & of) -> bool
+ {
+ if (suspect.size() > of.size())
+ {
+ return false;
+ }
+ return equal(cbegin(suspect), cend(suspect), cbegin(of));
+ }
+
+ auto inline is_type_name_prefix(std::string const & suspect) -> bool
+ {
+ return std::any_of(cbegin(type_names), cend(type_names), [&](auto type_name) { return is_prefix(suspect, type_name); });
+ }
+
+ auto inline wordify(std::string const & name)
+ {
+ using namespace std::string_literals;
+ using namespace impl;
+
+ auto stream = std::stringstream{name};
+ auto output{""s};
+
+ while (stream)
+ {
+ auto current_char = static_cast<char>(stream.get());
+
+ if (current_char == '_')
+ {
+ if (stream.peek() != '_')
+ {
+ output += ' ';
+ }
+ else
+ {
+ output += current_char;
+ stream.ignore();
+ }
+ }
+ else if (current_char != EOF)
+ {
+ output += current_char;
+ }
+ }
+
+ return output;
+ }
+
+ auto inline titelize(std::string const & name) -> std::string
+ {
+ using namespace std::string_literals;
+
+ auto stream = std::istringstream{name};
+ auto buffer{""s};
+ auto word{""s};
+ auto first{false};
+
+ while (stream >> word && word != "[")
+ {
+ auto is_preposition = std::find(cbegin(prepositions), cend(prepositions), word) != cend(prepositions);
+ auto is_type_name = std::find(cbegin(type_names), cend(type_names), word) != cend(type_names);
+ if ((!is_preposition || buffer.empty()) && !is_type_name)
+ {
+ word.front() = std::toupper(word.front());
+ }
+ buffer += (first ? "" : " ") + word;
+ first = false;
+ }
+
+ auto rest{""s};
+
+ if (stream)
+ {
+ buffer += " " + word;
+ std::getline(stream, rest);
+ }
+
+ return buffer + rest;
+ }
+
+ } // namespace impl
+
+ auto inline go_full_kawaii(std::string kowai) -> std::string
+ {
+ using namespace impl;
+
+ auto template_free = replace_template_argument_syntax(kowai);
+ auto wordified = wordify(template_free);
+
+ return titelize(wordified);
+ }
+
+} // namespace nt::test
+
+#define KAWAII(name) cute::test((&name), nt::test::go_full_kawaii(#name))
+
+#endif \ No newline at end of file
diff --git a/test/include/new_type_constructor_suite.hpp b/test/include/new_type_constructor_suite.hpp
new file mode 100644
index 0000000..38c3cba
--- /dev/null
+++ b/test/include/new_type_constructor_suite.hpp
@@ -0,0 +1,11 @@
+#ifndef NEWTYPE_TEST_NEW_TYPE_SUITE_HPP
+#define NEWTYPE_TEST_NEW_TYPE_SUITE_HPP
+
+#include <cute/cute_suite.h>
+
+#include <string>
+#include <utility>
+
+auto new_type_constructor_suite() -> std::pair<cute::suite, std::string>;
+
+#endif \ No newline at end of file
diff --git a/test/src/derivation_clause_suite.cpp b/test/src/derivation_clause_suite.cpp
new file mode 100644
index 0000000..86a34ab
--- /dev/null
+++ b/test/src/derivation_clause_suite.cpp
@@ -0,0 +1,312 @@
+#include "derivation_clause_suite.hpp"
+
+#include "kawaii.hpp"
+#include "newtype/derivable.hpp"
+#include "newtype/deriving.hpp"
+
+#include <cute/cute.h>
+
+#include <string>
+
+inline namespace subset_tests
+{
+
+ auto an_empty_derivation_clause_does_not_contain_any_derivable() -> void
+ {
+ auto derivation_clause = nt::deriving();
+ ASSERT(!derivation_clause(nt::Show));
+ }
+
+ auto a_derivation_clause_containing_only_show_does_not_contain_eqbase() -> void
+ {
+ auto derivation_clause = deriving(nt::Show);
+ ASSERT(!derivation_clause(nt::EqBase));
+ }
+
+ auto a_derivation_clause_containing_only_show_does_contain_show() -> void
+ {
+ auto derivation_clause = deriving(nt::Show);
+ ASSERT(derivation_clause(nt::Show));
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_does_contain_show() -> void
+ {
+ auto derivation_clause = deriving(nt::Show, nt::EqBase);
+ ASSERT(derivation_clause(nt::Show));
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_does_contain_both_show_and_eqbase() -> void
+ {
+ auto derivation_clause = deriving(nt::Show, nt::EqBase);
+ ASSERT(derivation_clause(nt::Show, nt::EqBase));
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_does_not_contain_arithmetic() -> void
+ {
+ auto derivation_clause = deriving(nt::Show, nt::EqBase);
+ ASSERT(!derivation_clause(nt::Arithmetic));
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_does_not_contain_both_show_and_arithmetic() -> void
+ {
+ auto derivation_clause = deriving(nt::Show, nt::EqBase);
+ ASSERT(!derivation_clause(nt::Show, nt::Arithmetic));
+ }
+
+} // namespace subset_tests
+
+inline namespace less_than_tests
+{
+
+ auto a_derivation_clause_containing_only_show_compares_less_than_one_containing_show_and_eqbase() -> void
+ {
+ auto only_show = deriving(nt::Show);
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT(only_show < show_and_eqbase);
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_does_not_compare_less_than_one_containing_show_and_eqbase() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto also_show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT(!(show_and_eqbase < also_show_and_eqbase));
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_does_not_compare_less_than_one_containing_eqbase_and_show() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto eqbase_and_show = deriving(nt::EqBase, nt::Show);
+
+ ASSERT(!(show_and_eqbase < eqbase_and_show));
+ }
+
+ auto a_derivation_clause_containing_only_show_does_not_compare_less_than_one_containing_only_eqbase() -> void
+ {
+ auto show = deriving(nt::Show);
+ auto eqbase = deriving(nt::EqBase);
+
+ ASSERT(!(show < eqbase));
+ }
+
+} // namespace less_than_tests
+
+inline namespace greater_than_tests
+{
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_compares_greater_than_one_containing_only_show() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto show = deriving(nt::Show);
+
+ ASSERT(show_and_eqbase > show);
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_does_not_compare_greater_than_one_containing_only_show_and_eqbase() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto also_show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT(!(show_and_eqbase > also_show_and_eqbase));
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_does_not_compare_greater_than_one_containing_only_eqbase_and_show() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto eqbase_and_show = deriving(nt::EqBase, nt::Show);
+
+ ASSERT(!(show_and_eqbase > eqbase_and_show));
+ }
+
+ auto a_derivation_clause_containing_only_show_does_not_compare_greater_than_one_containing_only_eqbase() -> void
+ {
+ auto show = deriving(nt::Show);
+ auto eqbase = deriving(nt::EqBase);
+
+ ASSERT(!(show > eqbase));
+ }
+
+} // namespace greater_than_tests
+
+inline namespace eqbaseuals_tests
+{
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_is_eqbaseual_to_one_containing_only_show_and_eqbase() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto also_show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT_EQUAL(show_and_eqbase, also_show_and_eqbase);
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_is_eqbaseual_to_one_containing_only_eqbase_and_show() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto eqbase_and_show = deriving(nt::EqBase, nt::Show);
+
+ ASSERT_EQUAL(show_and_eqbase, eqbase_and_show);
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_is_not_eqbaseual_to_one_containing_only_arithmetic() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto arithmetic = deriving(nt::Arithmetic);
+
+ ASSERT(!(show_and_eqbase == arithmetic));
+ }
+
+ auto a_derivation_clause_containing_only_show_is_not_eqbaseual_to_one_containing_only_arithmetic() -> void
+ {
+ auto show = deriving(nt::Show);
+ auto arithmetic = deriving(nt::Arithmetic);
+
+ ASSERT(!(show == arithmetic));
+ }
+
+} // namespace eqbaseuals_tests
+
+inline namespace not_eqbaseuals_tests
+{
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_is_not_not_eqbaseual_to_one_containing_only_show_and_eqbase() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto also_show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT(!(show_and_eqbase != also_show_and_eqbase));
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_is_not_not_eqbaseual_to_one_containing_only_eqbase_and_show() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto eqbase_and_show = deriving(nt::EqBase, nt::Show);
+
+ ASSERT(!(show_and_eqbase != eqbase_and_show));
+ }
+
+ auto a_derivation_clause_containing_only_eqbase_and_show_is_not_eqbaseual_to_one_containing_only_arithmetic() -> void
+ {
+ auto eqbase_and_show = deriving(nt::EqBase, nt::Show);
+ auto arithmetic = deriving(nt::Arithmetic);
+
+ ASSERT(eqbase_and_show != arithmetic);
+ }
+
+ auto a_derivation_clause_containing_only_eqbase_is_not_eqbaseual_to_one_containing_only_arithmetic() -> void
+ {
+ auto eqbase = deriving(nt::EqBase);
+ auto arithmetic = deriving(nt::Arithmetic);
+
+ ASSERT(eqbase != arithmetic);
+ }
+
+} // namespace not_eqbaseuals_tests
+
+inline namespace less_than_or_eqbaseual_tests
+{
+
+ auto a_derivation_clause_containing_only_show_is_less_than_or_eqbaseual_to_one_containing_only_show_and_eqbase() -> void
+ {
+ auto only_show = deriving(nt::Show);
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT(only_show <= show_and_eqbase);
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_is_less_than_or_eqbaseual_to_one_containing_only_show_and_eqbase() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto also_show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT(show_and_eqbase <= also_show_and_eqbase);
+ }
+
+ auto a_derivation_clause_containing_only_arithmetic_is_neither_less_than_nor_eqbaseual_to_on_containing_only_show_and_eqbase() -> void
+ {
+ auto arithmetic = deriving(nt::Arithmetic);
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT(!(arithmetic <= show_and_eqbase));
+ }
+
+} // namespace less_than_or_eqbaseual_tests
+
+inline namespace greater_than_or_eqbaseual_tests
+{
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_is_greater_than_or_eqbaseual_to_one_containing_only_show() -> void
+ {
+ auto only_show = deriving(nt::Show);
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT(show_and_eqbase >= only_show);
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_is_greater_than_or_eqbaseual_to_one_containing_only_show_and_eqbase() -> void
+ {
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+ auto also_show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT(show_and_eqbase >= also_show_and_eqbase);
+ }
+
+ auto a_derivation_clause_containing_only_show_and_eqbase_is_neither_greater_than_nor_eqbaseual_to_on_containing_only_arithmetic() -> void
+ {
+ auto arithmetic = deriving(nt::Arithmetic);
+ auto show_and_eqbase = deriving(nt::Show, nt::EqBase);
+
+ ASSERT(!(show_and_eqbase >= arithmetic));
+ }
+
+} // namespace greater_than_or_eqbaseual_tests
+
+auto derivation_clause_suite() -> std::pair<cute::suite, std::string>
+{
+ return {
+ {
+ /// Subset tests
+ KAWAII(an_empty_derivation_clause_does_not_contain_any_derivable),
+ KAWAII(a_derivation_clause_containing_only_show_does_not_contain_eqbase),
+ KAWAII(a_derivation_clause_containing_only_show_does_contain_show),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_does_contain_show),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_does_contain_both_show_and_eqbase),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_does_not_contain_arithmetic),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_does_not_contain_both_show_and_arithmetic),
+
+ /// Less-than tests
+ KAWAII(a_derivation_clause_containing_only_show_compares_less_than_one_containing_show_and_eqbase),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_does_not_compare_less_than_one_containing_show_and_eqbase),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_does_not_compare_less_than_one_containing_eqbase_and_show),
+ KAWAII(a_derivation_clause_containing_only_show_does_not_compare_less_than_one_containing_only_eqbase),
+
+ /// Greater-than tests
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_compares_greater_than_one_containing_only_show),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_does_not_compare_greater_than_one_containing_only_show_and_eqbase),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_does_not_compare_greater_than_one_containing_only_eqbase_and_show),
+ KAWAII(a_derivation_clause_containing_only_show_does_not_compare_greater_than_one_containing_only_eqbase),
+
+ /// Equals tests
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_is_eqbaseual_to_one_containing_only_show_and_eqbase),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_is_eqbaseual_to_one_containing_only_eqbase_and_show),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_is_not_eqbaseual_to_one_containing_only_arithmetic),
+ KAWAII(a_derivation_clause_containing_only_show_is_not_eqbaseual_to_one_containing_only_arithmetic),
+
+ /// Not-Equals tests
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_is_not_not_eqbaseual_to_one_containing_only_show_and_eqbase),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_is_not_not_eqbaseual_to_one_containing_only_eqbase_and_show),
+ KAWAII(a_derivation_clause_containing_only_eqbase_and_show_is_not_eqbaseual_to_one_containing_only_arithmetic),
+ KAWAII(a_derivation_clause_containing_only_eqbase_is_not_eqbaseual_to_one_containing_only_arithmetic),
+
+ /// Less-than or Equals tests
+ KAWAII(a_derivation_clause_containing_only_show_is_less_than_or_eqbaseual_to_one_containing_only_show_and_eqbase),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_is_less_than_or_eqbaseual_to_one_containing_only_show_and_eqbase),
+ KAWAII(a_derivation_clause_containing_only_arithmetic_is_neither_less_than_nor_eqbaseual_to_on_containing_only_show_and_eqbase),
+
+ /// Greater-than or Equals tests
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_is_greater_than_or_eqbaseual_to_one_containing_only_show),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_is_greater_than_or_eqbaseual_to_one_containing_only_show_and_eqbase),
+ KAWAII(a_derivation_clause_containing_only_show_and_eqbase_is_neither_greater_than_nor_eqbaseual_to_on_containing_only_arithmetic),
+ },
+ "Derivation Clause Tests"};
+} \ No newline at end of file
diff --git a/test/src/driver.cpp b/test/src/driver.cpp
new file mode 100644
index 0000000..22e1ab9
--- /dev/null
+++ b/test/src/driver.cpp
@@ -0,0 +1,89 @@
+#include "derivation_clause_suite.hpp"
+#include "new_type_constructor_suite.hpp"
+
+#include <cute/cute.h>
+#include <cute/cute_runner.h>
+#include <cute/tap_listener.h>
+
+#include <lyra/arg.hpp>
+#include <lyra/cli_parser.hpp>
+#include <lyra/help.hpp>
+#include <lyra/opt.hpp>
+
+#include <algorithm>
+#include <cstdlib>
+#include <iostream>
+#include <iterator>
+#include <numeric>
+#include <string>
+#include <utility>
+#include <vector>
+
+using suite_list = std::vector<std::pair<cute::suite, std::string>>;
+
+auto get_test_selectors(suite_list const & suites) -> std::vector<std::string>
+{
+ auto selectors = std::vector<std::string>{};
+
+ for_each(cbegin(suites), cend(suites), [&](auto descriptor) {
+ auto const & [suite, name] = descriptor;
+ transform(cbegin(suite), cend(suite), std::back_inserter(selectors), [&, name = name](auto test) {
+ return name + "#" + test.name();
+ });
+ });
+
+ return selectors;
+}
+
+auto do_run_tests(suite_list const & suites, int argc, char ** argv) -> bool
+{
+ auto listener = cute::tap_listener<>{};
+ auto runner = cute::makeRunner(listener, argc, argv);
+
+ return accumulate(cbegin(suites), cend(suites), true, [&](auto accumulator, auto const & descriptor) {
+ auto const & [suite, name] = descriptor;
+ return accumulator && runner(suite, name.c_str());
+ });
+}
+
+int main(int argc, char ** argv)
+{
+ auto suites = std::vector{
+ derivation_clause_suite(),
+ new_type_constructor_suite(),
+ };
+
+ auto selectors = get_test_selectors(suites);
+
+ auto list_tests{false};
+ auto list_suites{false};
+ auto show_help{false};
+ auto selected_tests = std::vector<std::string>{};
+
+ auto cli = lyra::cli_parser() | //
+ lyra::opt(list_tests)["-t"]["--tests"]("List all registered tests") | //
+ lyra::opt(list_suites)["-s"]["--suites"]("List all registered suites") | //
+ lyra::arg(selected_tests, "test selector")("A pattern to select a specific test") | //
+ lyra::help(show_help);
+ auto result = cli.parse({argc, argv});
+
+ if (list_tests)
+ {
+ copy(cbegin(selectors), cend(selectors), std::ostream_iterator<std::string>{std::cout, "\n"});
+ }
+ if (list_suites)
+ {
+ transform(cbegin(suites), cend(suites), std::ostream_iterator<std::string>{std::cout, "\n"}, [](auto descriptor) {
+ auto const & [_, name] = descriptor;
+ return name;
+ });
+ }
+ else if (!result || show_help)
+ {
+ std::cout << cli;
+ }
+ else
+ {
+ return do_run_tests(suites, argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;
+ }
+} \ No newline at end of file
diff --git a/test/src/new_type_constructor_suite.cpp b/test/src/new_type_constructor_suite.cpp
new file mode 100644
index 0000000..fa4c0b7
--- /dev/null
+++ b/test/src/new_type_constructor_suite.cpp
@@ -0,0 +1,68 @@
+#include "new_type_constructor_suite.hpp"
+
+#include "kawaii.hpp"
+#include "newtype/derivable.hpp"
+#include "newtype/new_type.hpp"
+
+#include <cute/cute.h>
+
+#include <type_traits>
+
+inline namespace constructor_tests
+{
+
+ struct not_default_constructible
+ {
+ not_default_constructible() = delete;
+ };
+
+ auto a_new__type_based_on_a_type_that_is_default_constructible_is_default_constructible_too() -> void
+ {
+ using nt_float = nt::new_type<float, struct nt_float_tag>;
+
+ ASSERT(std::is_default_constructible_v<nt_float>);
+ }
+
+ auto a_new__type_based_on_a_type_that_is_not_default_constructible_is_not_default_constructible_too() -> void
+ {
+ using nt_not_default_constructible = nt::new_type<not_default_constructible, struct nt_not_default_constructible_tag>;
+
+ ASSERT(!std::is_default_constructible_v<nt_not_default_constructible>);
+ }
+
+ template<typename OldType>
+ auto a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type() -> void
+ {
+ using nt_old = nt::new_type<OldType, struct nt_old_tag>;
+
+ ASSERT((std::is_constructible_v<nt_old, OldType>));
+ }
+
+} // namespace constructor_tests
+
+auto new_type_constructor_suite() -> std::pair<cute::suite, std::string>
+{
+ return {{
+ KAWAII(a_new__type_based_on_a_type_that_is_default_constructible_is_default_constructible_too),
+ KAWAII(a_new__type_based_on_a_type_that_is_not_default_constructible_is_not_default_constructible_too),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<bool>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<char>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<unsigned char>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<signed char>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<wchar_t>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<char16_t>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<char32_t>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<short>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<unsigned short>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<int>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<unsigned int>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<long>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<unsigned long>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<long long>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<unsigned long long>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<float>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<double>),
+ KAWAII(a_new__type_based_on_a_fundamental_type_can_be_constructed_with_a_value_of_fundamental_type<long double>),
+ },
+ "new_type Constructor Tests"};
+} \ No newline at end of file