5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INLINE_CONTAINER_TESTING_DEFAULT_CONSTRUCTIBLE_PROPERTIES_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INLINE_CONTAINER_TESTING_DEFAULT_CONSTRUCTIBLE_PROPERTIES_HPP_
8#include "arene/base/compiler_support/platform_queries.hpp"
9#include "arene/base/compiler_support/preprocessor.hpp"
10#include "arene/base/constraints/constraints.hpp"
11#include "arene/base/stdlib_choice/enable_if.hpp"
12#include "arene/base/stdlib_choice/is_copy_constructible.hpp"
13#include "arene/base/stdlib_choice/is_default_constructible.hpp"
14#include "arene/base/stdlib_choice/terminate.hpp"
15#include "arene/base/type_info/type_name_string.hpp"
16#include "testlibs/utilities/constexpr_traits.hpp"
18#if ARENE_IS_OFF(ARENE_STDLIB_LIBARENECXX)
31template <
class T, arene::base::constraints<std::enable_if_t<!std::is_default_constructible<T>::value>> =
nullptr>
32constexpr auto assert_default_constructed_instances_are_equal() ->
void {}
41 arene::base::constraints<
42 std::enable_if_t<std::is_default_constructible<T>::value>,
43 std::enable_if_t<!::testing::is_constexpr_default_constructible_v<T>>> =
nullptr>
44auto assert_default_constructed_instances_are_equal() ->
void {
46#if ARENE_IS_OFF(ARENE_STDLIB_LIBARENECXX)
47 std::cerr <<
"ERROR: test provided a default constructible value(" << arene::base::type_name_v<T>.c_str() <<
")"
48 <<
" but two default constructed instances do not compare equal\n";
60 arene::base::constraints<
61 std::enable_if_t<std::is_default_constructible<T>::value>,
62 std::enable_if_t<::testing::is_constexpr_default_constructible_v<T>>> =
nullptr>
63constexpr auto assert_default_constructed_instances_are_equal() ->
void {
66 constexpr bool are_equal = T{} == T{};
69 "test provided a default constructible value, but two default constructed instances do not compare equal"
79 arene::base::constraints<
80 std::enable_if_t<!std::is_default_constructible<T>::value || !std::is_copy_constructible<T>::value>> =
nullptr>
81constexpr auto assert_copied_value_equals_original() ->
void {}
90 arene::base::constraints<
91 std::enable_if_t<std::is_default_constructible<T>::value>,
92 std::enable_if_t<std::is_copy_constructible<T>::value>,
93 std::enable_if_t<!::testing::is_constexpr_default_and_copy_constructible_v<T>>> =
nullptr>
94auto assert_copied_value_equals_original() ->
void {
95 auto const original = T{};
96 auto const copy = original;
97 if (!(original == copy)) {
98#if ARENE_IS_OFF(ARENE_STDLIB_LIBARENECXX)
99 std::cerr <<
"ERROR: test provided a default constructible value(" << arene::base::type_name_v<T>.c_str() <<
")"
100 <<
" but a copy of the default constructed instance does not compare equal to the original\n";
113 arene::base::constraints<
114 std::enable_if_t<std::is_default_constructible<T>::value>,
115 std::enable_if_t<std::is_copy_constructible<T>::value>,
116 std::enable_if_t<::testing::is_constexpr_default_and_copy_constructible_v<T>>> =
nullptr>
117constexpr auto assert_copied_value_equals_original() ->
void {
118 constexpr auto original = T{};
119 constexpr auto copy = original;
123 constexpr auto are_equal = original == copy;
126 "test provided a default constructible value, but a copy of the default constructed instance does not compare "
127 "equal to the original"
140 detail::assert_default_constructed_instances_are_equal<T>();
141 detail::assert_copied_value_equals_original<T>();
Definition customization.hpp:36
constexpr auto assert_default_constructible_properties() -> void
Assert default constructible types have the expected properties.
Definition default_constructible_properties.hpp:139
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10