5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INLINE_CONTAINER_TESTING_CUSTOMIZATION_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INLINE_CONTAINER_TESTING_CUSTOMIZATION_HPP_
8#include "arene/base/array/array.hpp"
9#include "arene/base/constraints/constraints.hpp"
10#include "arene/base/contracts/contract.hpp"
11#include "arene/base/inline_container/detail/iterator_interface.hpp"
12#include "arene/base/stdlib_choice/cstddef.hpp"
13#include "arene/base/stdlib_choice/enable_if.hpp"
14#include "arene/base/stdlib_choice/initializer_list.hpp"
15#include "arene/base/stdlib_choice/integer_sequence.hpp"
16#include "arene/base/stdlib_choice/integral_constant.hpp"
17#include "arene/base/stdlib_choice/is_array.hpp"
18#include "arene/base/stdlib_choice/is_constructible.hpp"
19#include "arene/base/stdlib_choice/is_copy_constructible.hpp"
20#include "arene/base/stdlib_choice/is_floating_point.hpp"
21#include "arene/base/stdlib_choice/is_integral.hpp"
22#include "arene/base/stdlib_choice/is_move_assignable.hpp"
23#include "arene/base/stdlib_choice/is_move_constructible.hpp"
24#include "arene/base/stdlib_choice/is_signed.hpp"
25#include "arene/base/stdlib_choice/is_unsigned.hpp"
26#include "arene/base/stdlib_choice/iterator_tags.hpp"
27#include "arene/base/stdlib_choice/make_signed.hpp"
28#include "arene/base/stdlib_choice/move.hpp"
29#include "arene/base/stdlib_choice/remove_cv.hpp"
30#include "arene/base/stdlib_choice/remove_reference.hpp"
31#include "arene/base/type_traits/remove_cvref.hpp"
32#include "testlibs/utilities/configurable_value.hpp"
42namespace customization_detail {
49template <
typename OutType,
typename InType, std::size_t... Indices>
50constexpr auto to_array_cast(
52 InType (&&arr)[
sizeof...(Indices)],
53 std::index_sequence<Indices...>
54)
noexcept(std::is_nothrow_constructible<OutType, InType&&>::value) -> array<base::remove_cvref_t<OutType>,
sizeof...(Indices)> {
55 return {{std::move(arr[Indices])...}};
91 to_array_cast<
T>({0U, 8U, 19U, 6612U, 777124U, 7U, 609124U, 1224545862U, 2561U, 976173U});
100 to_array_cast<
T>({1, -2, 6, -24, 120, -720, 5'040, -40'320, 362'880, -3'628'800});
109namespace customization_detail {
113struct test_value_generator {
116 static constexpr auto test_value(std::size_t idx)
noexcept(std::is_nothrow_copy_constructible<T>::value) -> T {
118 !test_value_array<T>.empty(),
119 "To use a type T for parameterized testing, you must specialize arene::base::testing::test_value_array<T> for "
120 "copyable types or arene::base::testing::test_value<T> for non-copyable types"
122 return test_value_array<T>[idx % test_value_array<T>.size()];
131template <
typename T, ::testing::throws_on ThrowsOn, ::testing::disable Disable, ::testing::is_constexpr IsConstexpr>
132struct test_value_generator<::testing::configurable_value<T, ThrowsOn, Disable, IsConstexpr>> {
135 static constexpr auto test_value(std::size_t idx
136 )
noexcept((ThrowsOn & ::testing::throws_on::value_construct) == ::testing::throws_on::nothing) -> T {
137 return {test_value_generator<T>::test_value(idx)};
151 return customization_detail::test_value_generator<T>::test_value(idx);
165namespace customization_detail {
171template <
typename T,
bool IsConstexpr, std::size_t... Indices>
172class init_list_holder {
174 static constexpr std::initializer_list<T> list{test_value<T>(Indices)...};
179 constexpr auto operator()()
const noexcept -> std::initializer_list<T> {
return list; }
183template <
typename T,
bool IsConstexpr, std::size_t... Indices>
184constexpr std::initializer_list<T> init_list_holder<T, IsConstexpr, Indices...>::list;
190template <
typename T, std::size_t... Indices>
191class init_list_holder<T,
false, Indices...> {
195 auto operator()()
const noexcept -> std::initializer_list<T> {
197 static std::initializer_list<T>
const list{test_value<T>(Indices)...};
217 static constexpr bool test_value_is_noexcept =
noexcept(test_value<T>(0));
224 using value_type = T;
228 using reference = T&&;
260 current_index_ = other.current_index_;
261 current_value_ = get_test_value(current_index_);
269 current_index_ = other.current_index_;
270 current_value_ = std::move(other.current_value_);
278 constexpr auto operator*()
noexcept -> reference {
return std::move(current_value_); }
285 current_index_ += diff;
286 current_value_ = get_test_value(current_index_);
296 return left.current_index_ - right.current_index_;
301 difference_type current_index_;
309 static constexpr auto get_test_value(difference_type index)
noexcept(test_value_is_noexcept) -> T {
310 ARENE_PRECONDITION(index >= 0);
311 return test_value<T>(
static_cast<std::size_t>(index));
An iterator whose i'th position yields an rvalue reference to test_value(i) of the given type.
Definition customization.hpp:215
constexpr auto operator+=(difference_type diff) noexcept(test_value_is_noexcept) -> rvalue_iterator &
Shift an rvalue_iterator by the given amount.
Definition customization.hpp:284
constexpr auto operator=(rvalue_iterator const &other) noexcept(test_value_is_noexcept) -> rvalue_iterator &
Copy assign an rvalue_iterator, retrieving a new test value so that the value type can be move-only.
Definition customization.hpp:259
friend constexpr auto operator-(rvalue_iterator const &left, rvalue_iterator const &right) noexcept -> difference_type
Get the difference between two rvalue_iterators.
Definition customization.hpp:294
~rvalue_iterator()=default
Destroy an rvalue_iterator.
constexpr auto operator*() noexcept -> reference
Dereference an rvalue_iterator; data may no longer be meaningful after the first use.
Definition customization.hpp:278
constexpr rvalue_iterator(rvalue_iterator &&other) noexcept(std::is_nothrow_move_constructible< T >::value)
Move construct an rvalue_iterator.
Definition customization.hpp:252
constexpr rvalue_iterator(rvalue_iterator const &other) noexcept(test_value_is_noexcept)
Copy construct an rvalue_iterator, retrieving a new test value so that the value type can be move-onl...
Definition customization.hpp:244
constexpr auto operator=(rvalue_iterator &&other) noexcept(std::is_nothrow_move_assignable< T >::value) -> rvalue_iterator &
Move assign an rvalue_iterator.
Definition customization.hpp:267
constexpr rvalue_iterator(difference_type index=0) noexcept(test_value_is_noexcept)
Construct an rvalue_iterator containing the test value with the given index (defaulting to 0)
Definition customization.hpp:237
Definition customization.hpp:36
constexpr bool has_constexpr_test_value
Check whether or not a given type's test_value function works in constexpr contexts.
Definition customization.hpp:157
constexpr customization_detail::init_list_holder< T, has_constexpr_test_value< T >, Indices... > test_initializer_list
A function object returning a std::initializer_list of one test_value per index in the given pack.
constexpr auto test_value(std::size_t idx) noexcept(noexcept(customization_detail::test_value_generator< T >::test_value(idx))) -> T
Get the idx 'th test value of type T.
Definition customization.hpp:149
constexpr ::arene::base::array< T, 0UL > test_value_array
An array used in the default implementation of test_value ; by default it's empty and unusable.
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10