aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2023-06-07 16:41:32 +0200
committerFelix Morgner <felix.morgner@gmail.com>2023-06-07 16:41:32 +0200
commitaa7c021962f529f3ed2f482fd6f02e5497532a8a (patch)
treec8a3eff796c94f757cc8ae7d3b2324f53038e0c3 /test
parent741b6d177865f20908b1b290c5170025964d3d9a (diff)
downloadnewtype-aa7c021962f529f3ed2f482fd6f02e5497532a8a.tar.xz
newtype-aa7c021962f529f3ed2f482fd6f02e5497532a8a.zip
project: begin restructuring
Diffstat (limited to 'test')
-rw-r--r--test/include/arithmetic_suite.hpp11
-rw-r--r--test/include/conversion_suite.hpp11
-rw-r--r--test/include/derivation_clause_suite.hpp11
-rw-r--r--test/include/equality_comparison_suite.hpp11
-rw-r--r--test/include/hash_suite.hpp11
-rw-r--r--test/include/io_operators_suite.hpp11
-rw-r--r--test/include/iterable_suite.hpp11
-rw-r--r--test/include/kawaii.hpp143
-rw-r--r--test/include/new_type_constructor_suite.hpp11
-rw-r--r--test/include/relational_operators_suite.hpp11
-rw-r--r--test/src/arithmetic_suite.cpp330
-rw-r--r--test/src/conversion_suite.cpp201
-rw-r--r--test/src/derivation_clause_suite.cpp312
-rw-r--r--test/src/driver.cpp101
-rw-r--r--test/src/equality_comparison_suite.cpp188
-rw-r--r--test/src/hash_suite.cpp69
-rw-r--r--test/src/io_operators_suite.cpp121
-rw-r--r--test/src/iterable_suite.cpp719
-rw-r--r--test/src/new_type_constructor_suite.cpp91
-rw-r--r--test/src/relational_operators_suite.cpp321
20 files changed, 0 insertions, 2695 deletions
diff --git a/test/include/arithmetic_suite.hpp b/test/include/arithmetic_suite.hpp
deleted file mode 100644
index 1eb4af8..0000000
--- a/test/include/arithmetic_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_ARITHMETIC_SUITE_HPP
-#define NEWTYPE_TEST_ARITHMETIC_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto arithmetic_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/conversion_suite.hpp b/test/include/conversion_suite.hpp
deleted file mode 100644
index 8b9c337..0000000
--- a/test/include/conversion_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_CONVERSION_SUITE_HPP
-#define NEWTYPE_TEST_CONVERSION_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto conversion_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/derivation_clause_suite.hpp b/test/include/derivation_clause_suite.hpp
deleted file mode 100644
index b5ef5c2..0000000
--- a/test/include/derivation_clause_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#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/equality_comparison_suite.hpp b/test/include/equality_comparison_suite.hpp
deleted file mode 100644
index 80abbe7..0000000
--- a/test/include/equality_comparison_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_EQUALITY_COMPARISON_SUITE_HPP
-#define NEWTYPE_TEST_EQUALITY_COMPARISON_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto equality_comparison_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/hash_suite.hpp b/test/include/hash_suite.hpp
deleted file mode 100644
index 0ef51bc..0000000
--- a/test/include/hash_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_HASH_SUITE_HPP
-#define NEWTYPE_TEST_HASH_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto hash_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/io_operators_suite.hpp b/test/include/io_operators_suite.hpp
deleted file mode 100644
index c7af2ee..0000000
--- a/test/include/io_operators_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_IO_OPERATORS_SUITE_HPP
-#define NEWTYPE_TEST_IO_OPERATORS_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto io_operators_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/iterable_suite.hpp b/test/include/iterable_suite.hpp
deleted file mode 100644
index c2bbc6e..0000000
--- a/test/include/iterable_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_ITERABLE_SUITE_HPP
-#define NEWTYPE_TEST_ITERABLE_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto iterable_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
deleted file mode 100644
index 9084b56..0000000
--- a/test/include/kawaii.hpp
+++ /dev/null
@@ -1,143 +0,0 @@
-#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 keywords = std::array{"noexcept"};
- auto constexpr type_names = std::array{"new_type", "derivation_clause", "unordered_map"};
-
- 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_keyword = std::find(cbegin(keywords), cend(keywords), word) != cend(keywords);
- auto is_type_name = std::find(cbegin(type_names), cend(type_names), word) != cend(type_names);
- if ((!(is_preposition || is_keyword) || 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
deleted file mode 100644
index 38c3cba..0000000
--- a/test/include/new_type_constructor_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#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/include/relational_operators_suite.hpp b/test/include/relational_operators_suite.hpp
deleted file mode 100644
index 259834b..0000000
--- a/test/include/relational_operators_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_RELATIONAL_OPERATORS_SUITE_HPP
-#define NEWTYPE_TEST_RELATIONAL_OPERATORS_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto relational_operators_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/src/arithmetic_suite.cpp b/test/src/arithmetic_suite.cpp
deleted file mode 100644
index 0d8cfa8..0000000
--- a/test/src/arithmetic_suite.cpp
+++ /dev/null
@@ -1,330 +0,0 @@
-#include "arithmetic_suite.hpp"
-
-#include "kawaii.hpp"
-#include "newtype/derivable.hpp"
-#include "newtype/deriving.hpp"
-#include "newtype/impl/type_traits_extensions.hpp"
-#include "newtype/newtype.hpp"
-
-#include <cute/cute.h>
-
-#include <type_traits>
-
-namespace
-{
-
- struct addable_type
- {
- auto constexpr operator+(addable_type const &) const -> addable_type
- {
- return {};
- };
- };
-
- struct subtractable_type
- {
- auto constexpr operator-(subtractable_type const &) const -> subtractable_type
- {
- return {};
- };
- };
-
- struct multipliable_type
- {
- auto constexpr operator*(multipliable_type const &)const -> multipliable_type
- {
- return {};
- };
- };
-
- struct dividable_type
- {
- auto constexpr operator/(dividable_type const &) const -> dividable_type
- {
- return {};
- };
- };
-
-} // namespace
-
-inline namespace addition_tests
-{
-
- auto a_new__type_not_deriving_arithmetic_is_not_addable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag>;
- ASSERT(!(nt::impl::is_addable_v<type_alias>));
- }
-
- auto a_new__type_deriving_arithmetic_is_addable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT(nt::impl::is_addable_v<type_alias>);
- }
-
- template<typename T>
- auto a_new__type_deriving_arithmetic_is_addable_with_instances_of_itself_if_the_base_type_is_addable() -> void
- {
- static_assert(nt::impl::is_addable_v<T>, "Sanity Check");
- using type_alias = nt::new_type<T, struct tag, deriving(nt::Arithmetic)>;
- ASSERT_EQUAL(nt::impl::is_addable_v<T>, nt::impl::is_addable_v<type_alias>);
- }
-
- auto addition_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() + std::declval<type_alias const &>())>));
- }
-
- auto addition_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto lhs = type_alias{24};
- auto rhs = type_alias{18};
- ASSERT_EQUAL(24 + 18, (lhs + rhs).decay());
- }
-
-} // namespace addition_tests
-
-inline namespace subtraction_tests
-{
-
- auto a_new__type_not_deriving_arithmetic_is_not_subtractable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag>;
- ASSERT(!(nt::impl::is_subtractable_v<type_alias>));
- }
-
- auto a_new__type_deriving_arithmetic_is_subtractable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT(nt::impl::is_subtractable_v<type_alias>);
- }
-
- template<typename T>
- auto a_new__type_deriving_arithmetic_is_subtractable_with_instances_of_itself_if_the_base_type_is_subtractable() -> void
- {
- static_assert(nt::impl::is_subtractable_v<T>, "Sanity Check");
- using type_alias = nt::new_type<T, struct tag, deriving(nt::Arithmetic)>;
- ASSERT_EQUAL(nt::impl::is_subtractable_v<T>, nt::impl::is_subtractable_v<type_alias>);
- }
-
- auto subtraction_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() - std::declval<type_alias const &>())>));
- }
-
- auto subtraction_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto lhs = type_alias{24};
- auto rhs = type_alias{18};
- ASSERT_EQUAL(24 - 18, (lhs - rhs).decay());
- }
-
-} // namespace subtraction_tests
-
-inline namespace multiplication_tests
-{
-
- auto a_new__type_not_deriving_arithmetic_is_not_multipliable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag>;
- ASSERT(!(nt::impl::is_multipliable_v<type_alias>));
- }
-
- auto a_new__type_deriving_arithmetic_is_multipliable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT(nt::impl::is_multipliable_v<type_alias>);
- }
-
- template<typename T>
- auto a_new__type_deriving_arithmetic_is_multipliable_with_instances_of_itself_if_the_base_type_is_multipliable() -> void
- {
- static_assert(nt::impl::is_multipliable_v<T>, "Sanity Check");
- using type_alias = nt::new_type<T, struct tag, deriving(nt::Arithmetic)>;
- ASSERT_EQUAL(nt::impl::is_multipliable_v<T>, nt::impl::is_multipliable_v<type_alias>);
- }
-
- auto multiplication_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() * std::declval<type_alias const &>())>));
- }
-
- auto multiplication_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto lhs = type_alias{24};
- auto rhs = type_alias{18};
- ASSERT_EQUAL(24 * 18, (lhs * rhs).decay());
- }
-
-} // namespace multiplication_tests
-
-inline namespace division_tests
-{
-
- auto a_new__type_not_deriving_arithmetic_is_not_dividable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag>;
- ASSERT(!(nt::impl::is_dividable_v<type_alias>));
- }
-
- auto a_new__type_deriving_arithmetic_is_dividable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT(nt::impl::is_dividable_v<type_alias>);
- }
-
- template<typename T>
- auto a_new__type_deriving_arithmetic_is_dividable_with_instances_of_itself_if_the_base_type_is_dividable() -> void
- {
- static_assert(nt::impl::is_dividable_v<T>, "Sanity Check");
- using type_alias = nt::new_type<T, struct tag, deriving(nt::Arithmetic)>;
- ASSERT_EQUAL(nt::impl::is_dividable_v<T>, nt::impl::is_dividable_v<type_alias>);
- }
-
- auto division_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() / std::declval<type_alias const &>())>));
- }
-
- auto division_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto lhs = type_alias{24};
- auto rhs = type_alias{2};
- ASSERT_EQUAL(24 / 2, (lhs / rhs).decay());
- }
-
-} // namespace division_tests
-
-inline namespace compound_arithmetic
-{
-
- auto addition_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias &, decltype(std::declval<type_alias &>() += std::declval<type_alias const &>())>));
- }
-
- auto addition_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type()
- -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto elhs = 42;
- auto erhs = 18;
- auto lhs = type_alias{elhs};
- auto rhs = type_alias{erhs};
- ASSERT_EQUAL(elhs += erhs, (lhs += rhs).decay());
- }
-
- auto subtraction_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias &, decltype(std::declval<type_alias &>() -= std::declval<type_alias const &>())>));
- }
-
- auto subtraction_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type()
- -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto elhs = 42;
- auto erhs = 18;
- auto lhs = type_alias{elhs};
- auto rhs = type_alias{erhs};
- ASSERT_EQUAL(elhs -= erhs, (lhs -= rhs).decay());
- }
-
- auto multiplication_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias &, decltype(std::declval<type_alias &>() *= std::declval<type_alias const &>())>));
- }
-
- auto multiplication_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type()
- -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto elhs = 42;
- auto erhs = 18;
- auto lhs = type_alias{elhs};
- auto rhs = type_alias{erhs};
- ASSERT_EQUAL(elhs *= erhs, (lhs *= rhs).decay());
- }
-
- auto division_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias &, decltype(std::declval<type_alias &>() /= std::declval<type_alias const &>())>));
- }
-
- auto division_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type()
- -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto elhs = 42;
- auto erhs = 18;
- auto lhs = type_alias{elhs};
- auto rhs = type_alias{erhs};
- ASSERT_EQUAL(elhs /= erhs, (lhs /= rhs).decay());
- }
-
-} // namespace compound_arithmetic
-
-auto arithmetic_suite() -> std::pair<cute::suite, std::string>
-{
- return {
- {
- // clang-format off
-
- /// Addition Tests
- KAWAII(a_new__type_not_deriving_arithmetic_is_not_addable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_addable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_addable_with_instances_of_itself_if_the_base_type_is_addable<int>),
- KAWAII(a_new__type_deriving_arithmetic_is_addable_with_instances_of_itself_if_the_base_type_is_addable<addable_type>),
- KAWAII(addition_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(addition_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
-
- /// Subtraction Tests
- KAWAII(a_new__type_not_deriving_arithmetic_is_not_subtractable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_subtractable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_subtractable_with_instances_of_itself_if_the_base_type_is_subtractable<int>),
- KAWAII(a_new__type_deriving_arithmetic_is_subtractable_with_instances_of_itself_if_the_base_type_is_subtractable<subtractable_type>),
- KAWAII(subtraction_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(subtraction_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
-
- /// Multiplication Tests
- KAWAII(a_new__type_not_deriving_arithmetic_is_not_multipliable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_multipliable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_multipliable_with_instances_of_itself_if_the_base_type_is_multipliable<int>),
- KAWAII(a_new__type_deriving_arithmetic_is_multipliable_with_instances_of_itself_if_the_base_type_is_multipliable<multipliable_type>),
- KAWAII(multiplication_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(multiplication_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
-
- /// Division Tests
- KAWAII(a_new__type_not_deriving_arithmetic_is_not_dividable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_dividable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_dividable_with_instances_of_itself_if_the_base_type_is_dividable<int>),
- KAWAII(a_new__type_deriving_arithmetic_is_dividable_with_instances_of_itself_if_the_base_type_is_dividable<dividable_type>),
- KAWAII(division_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(division_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
-
- /// Compound Arithmetic Tests
- KAWAII(addition_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(addition_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
- KAWAII(subtraction_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(subtraction_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
- KAWAII(multiplication_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(multiplication_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
- KAWAII(division_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(division_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
-
- // clang-format on
- },
- "Arithmetic Operators Tests"};
-} \ No newline at end of file
diff --git a/test/src/conversion_suite.cpp b/test/src/conversion_suite.cpp
deleted file mode 100644
index cbe2463..0000000
--- a/test/src/conversion_suite.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-#include "conversion_suite.hpp"
-
-#include "kawaii.hpp"
-#include "newtype/derivable.hpp"
-#include "newtype/deriving.hpp"
-#include "newtype/newtype.hpp"
-
-#include <cute/cute.h>
-
-#include <algorithm>
-#include <iterator>
-#include <limits>
-#include <random>
-#include <string>
-#include <type_traits>
-#include <vector>
-
-inline namespace traits_extensions
-{
-
- template<typename To, typename From, typename = void>
- struct is_implicitly_convertible : std::false_type
- {
- };
-
- template<typename To, typename From>
- struct is_implicitly_convertible<To, From, std::void_t<decltype(std::declval<To &>() = std::declval<From &>())>> : std::true_type
- {
- };
-
- template<typename To, typename From>
- auto constexpr is_implicitly_convertible_v = is_implicitly_convertible<To, From>::value;
-
-} // namespace traits_extensions
-
-inline namespace ddt_support
-{
-
- template<typename T>
- struct datum
- {
- T value;
- cute::test_failure failure;
- };
-
- template<typename ValueType>
- auto generate_test_set(std::size_t size) -> std::vector<datum<ValueType>>
- {
- auto device = std::random_device{};
- auto generator = std::mt19937{device()};
- auto distribution = [&] {
- auto min = std::numeric_limits<ValueType>::min();
- auto max = std::numeric_limits<ValueType>::max();
- if constexpr (std::is_floating_point_v<ValueType>)
- {
- return std::uniform_real_distribution<ValueType>(min, max);
- }
- else
- {
- return std::uniform_int_distribution<ValueType>(min, max);
- }
- }();
-
- auto data = std::vector<datum<ValueType>>{};
- generate_n(std::back_inserter(data), size, [&] {
- auto point = distribution(generator);
- return datum<ValueType>{point, DDT()};
- });
- return data;
- }
-
-} // namespace ddt_support
-
-inline namespace implicit_conversion_tests
-{
-
- template<typename T>
- auto a_new__type_without_deriving_implicit_conversion_is_not_implicitly_convertible_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<T, struct conversion_test_1_tag>;
- ASSERT(!(is_implicitly_convertible_v<T, type_alias>));
- }
-
- template<typename T>
- auto a_new__type_with_deriving_implicit_conversion_is_implicitly_convertible_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<T, struct conversion_test_2_tag, deriving(nt::ImplicitConversion)>;
- ASSERT((is_implicitly_convertible_v<T, type_alias>));
- }
-
-} // namespace implicit_conversion_tests
-
-inline namespace decay_tests
-{
-
- template<typename T>
- auto decay_on_a_new__type_has_a_return_type_equal_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<T, struct conversion_test_3_tag>;
- ASSERT((std::is_same_v<T, decltype(std::declval<type_alias &>().decay())>));
- }
-
- template<typename T>
- auto decay_on_a_new__type_returns_the_underlying_value() -> void
- {
- using type_alias = nt::new_type<T, struct conversion_test_4_tag>;
- auto data = generate_test_set<T>(2 << 16);
- for_each(begin(data), end(data), [](auto & test) { ASSERT_EQUAL_DDT(test.value, type_alias{test.value}.decay(), test.failure); });
- }
-
-} // namespace decay_tests
-
-inline namespace decay_noexcept_tests
-{
-
- auto decay_on_a_new__type_is_noexcept_if_the_base_type_can_be_copied_without_throwing() -> void
- {
- static_assert(std::is_nothrow_copy_constructible_v<int>, "Sanity check");
- using type_alias = nt::new_type<int, struct conversion_test_5_tag>;
- ASSERT(noexcept(type_alias{}.decay()));
- }
-
- auto decay_on_a_new__type_is_not_noexcept_if_the_base_type_can_be_not_copied_without_throwing() -> void
- {
- struct strange_type
- {
- strange_type() = default;
- strange_type(strange_type const &) noexcept(false)
- {
- }
- };
-
- static_assert(!std::is_nothrow_copy_constructible_v<strange_type>, "Sanity check");
- using type_alias = nt::new_type<strange_type, struct conversion_test_6_tag>;
- ASSERT(!noexcept(type_alias{}.decay()));
- }
-
-} // namespace decay_noexcept_tests
-
-inline namespace conversion_operator_noexcept_tests
-{
-
- auto new__type_conversion_operator_is_noexcept_if_the_base_type_can_be_copied_without_throwing() -> void
- {
- static_assert(std::is_nothrow_copy_constructible_v<int>, "Sanity check");
- using type_alias = nt::new_type<int, struct conversion_test_5_tag>;
- ASSERT(noexcept(static_cast<int>(type_alias{})));
- }
-
- auto new__type_conversion_operator_is_not_noexcept_if_the_base_type_can_not_be_copied_without_throwing() -> void
- {
- struct strange_type
- {
- strange_type() = default;
- strange_type(strange_type const &) noexcept(false)
- {
- }
- };
-
- static_assert(!std::is_nothrow_copy_constructible_v<strange_type>, "Sanity check");
- using type_alias = nt::new_type<strange_type, struct conversion_test_5_tag>;
- ASSERT(!noexcept(static_cast<strange_type>(type_alias{})));
- }
-
-} // namespace conversion_operator_noexcept_tests
-
-auto conversion_suite() -> std::pair<cute::suite, std::string>
-{
- return {{
- /// Implicit Conversion Tests
- KAWAII(a_new__type_without_deriving_implicit_conversion_is_not_implicitly_convertible_to_the_base_type<bool>),
- KAWAII(a_new__type_without_deriving_implicit_conversion_is_not_implicitly_convertible_to_the_base_type<char>),
- KAWAII(a_new__type_without_deriving_implicit_conversion_is_not_implicitly_convertible_to_the_base_type<int>),
- KAWAII(a_new__type_without_deriving_implicit_conversion_is_not_implicitly_convertible_to_the_base_type<double>),
- KAWAII(a_new__type_without_deriving_implicit_conversion_is_not_implicitly_convertible_to_the_base_type<std::string>),
- KAWAII(a_new__type_with_deriving_implicit_conversion_is_implicitly_convertible_to_the_base_type<bool>),
- KAWAII(a_new__type_with_deriving_implicit_conversion_is_implicitly_convertible_to_the_base_type<char>),
- KAWAII(a_new__type_with_deriving_implicit_conversion_is_implicitly_convertible_to_the_base_type<int>),
- KAWAII(a_new__type_with_deriving_implicit_conversion_is_implicitly_convertible_to_the_base_type<double>),
- KAWAII(a_new__type_with_deriving_implicit_conversion_is_im