5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INLINE_CONTAINER_TESTING_VECTOR_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INLINE_CONTAINER_TESTING_VECTOR_HPP_
8#include <gmock/gmock.h>
10#include "arene/base/algorithm/all_of.hpp"
11#include "arene/base/algorithm/equal.hpp"
12#include "arene/base/array/array.hpp"
13#include "arene/base/compiler_support/diagnostics.hpp"
14#include "arene/base/compiler_support/platform_queries.hpp"
15#include "arene/base/compiler_support/preprocessor.hpp"
16#include "arene/base/constraints/substitution_succeeds.hpp"
17#include "arene/base/inline_container/testing/customization.hpp"
18#include "arene/base/inline_container/testing/default_constructible_properties.hpp"
19#include "arene/base/inline_container/testing/unique_test_value.hpp"
20#include "arene/base/inline_container/vector.hpp"
21#include "arene/base/iterator/reverse_iterator.hpp"
22#include "arene/base/optional/optional_resetter.hpp"
23#include "arene/base/stdlib_choice/addressof.hpp"
24#include "arene/base/stdlib_choice/cstddef.hpp"
25#include "arene/base/stdlib_choice/declval.hpp"
26#include "arene/base/stdlib_choice/forward.hpp"
27#include "arene/base/stdlib_choice/initializer_list.hpp"
28#include "arene/base/stdlib_choice/integer_sequence.hpp"
29#include "arene/base/stdlib_choice/is_assignable.hpp"
30#include "arene/base/stdlib_choice/is_constructible.hpp"
31#include "arene/base/stdlib_choice/is_copy_assignable.hpp"
32#include "arene/base/stdlib_choice/is_copy_constructible.hpp"
33#include "arene/base/stdlib_choice/is_default_constructible.hpp"
34#include "arene/base/stdlib_choice/is_move_assignable.hpp"
35#include "arene/base/stdlib_choice/is_move_constructible.hpp"
36#include "arene/base/stdlib_choice/is_rvalue_reference.hpp"
37#include "arene/base/stdlib_choice/is_same.hpp"
38#include "arene/base/stdlib_choice/iterator_tags.hpp"
39#include "arene/base/stdlib_choice/iterator_traits.hpp"
40#include "arene/base/stdlib_choice/move.hpp"
41#include "arene/base/stdlib_choice/move_iterator.hpp"
42#include "arene/base/stdlib_choice/numeric_limits.hpp"
43#include "arene/base/stdlib_choice/pair.hpp"
44#include "arene/base/stdlib_choice/reference_wrapper.hpp"
45#include "arene/base/stdlib_choice/stdexcept.hpp"
46#include "arene/base/testing/gtest.hpp"
47#include "arene/base/type_manipulation/consume_values.hpp"
48#include "arene/base/type_traits/comparison_traits.hpp"
49#include "arene/base/type_traits/is_swappable.hpp"
50#include "arene/base/utility/swap.hpp"
51#include "testlibs/utilities/iterator_types.hpp"
58ARENE_IGNORE_ALL(
"-Wfloat-equal",
"These tests don't perform arithmetic, so equality is OK even for floating point");
64 constexpr auto operator()(T
const& arg) ->
bool {
return arg ==
value; }
77template <
class Range,
class T>
79 return arene::base::all_of(range.begin(), range.end(), equal_to_value<T>{value});
90template <
class Range1,
class Range2>
92 return arene::base::equal(range.begin(), range.end(), values.begin());
101template <
typename T, std::size_t Capacity>
104 ::arene::base::inline_vector<T, Capacity> vec;
105 for (std::size_t ii = begin; ii < end; ++ii) {
106 vec.push_back(test_value<T>(ii));
116template <
class Vector,
class... Values>
118 arene::base::consume_values({0, (vec.push_back(std::forward<Values>(values)), 0)...});
129template <
typename Container>
130constexpr auto sort_helper(Container container)
noexcept -> Container {
137 for (std::size_t ii = 0UL; ii + 1UL < container.size(); ++ii) {
138 if (container[ii + 1] < container[ii]) {
139 arene::base::swap(container[ii], container[ii + 1]);
158template <
typename Vector>
161 using T =
typename Vector::value_type;
168 "Constexpr-compatible types must have constexpr specializations of test_value_array or test_value"
173 static_assert(capacity > 0UL,
"Parameterized capacity can not be 0 (0-capacity vectors are always tested)");
176 static void SetUpTestSuite() { ::arene::base::testing::assert_default_constructible_properties<Vector>(); }
190 template <
typename Vec,
typename...
Args>
198 operator T()
const noexcept(
false) {
return ::arene::base::testing::test_value<T>(0); }
208 using reference = T&&;
210 using value_type = T;
212 using pointer =
void;
234 template <
typename U,
bool OperatorsNoexcept>
241 using reference = U&;
243 using value_type = U;
245 using pointer =
void;
262 template <
typename U>
266 template <
typename U>
272 template <
typename... U>
274 return Vector(std::forward<U>(params)...);
282 return ::arene::base::testing::test_value<T>(idx);
289 template <std::size_t N>
292 return ::arene::base::testing::unique_test_value<T, N>();
299 static constexpr auto test_vector(std::size_t begin, std::size_t end)
noexcept(
309 return test_vector(0, size);
315 return test_vector(capacity);
321 template <std::size_t... Indices>
323 return ::arene::base::testing::test_initializer_list<T, Indices...>();
329 template <std::size_t Size>
331 return test_initializer_list(std::make_index_sequence<Size>{});
337 return test_initializer_list<capacity>();
355 COND_STATIC_ASSERT_EQ(TestFixture::construct().capacity(), TypeParam::capacity);
360 STATIC_ASSERT_TRUE(
noexcept(TestFixture::construct().capacity()));
368 COND_STATIC_ASSERT_EQ(TestFixture::full_test_vector().size(), TypeParam::capacity);
377 vec.push_back(TestFixture::test_value(0));
378 EXPECT_EQ(vec.size(), 1);
385 vec.push_back(TestFixture::test_value(0));
386 EXPECT_EQ(vec.back(), TestFixture::test_value(0));
392 vec.push_back(TestFixture::test_value(0));
393 ASSERT_FALSE(vec.empty());
400 vec.push_back(TestFixture::test_value(0));
401 vec.push_back(TestFixture::test_value(1));
402 EXPECT_EQ(vec.size(), 2);
403 EXPECT_EQ(vec.back(), TestFixture::test_value(1));
409 constexpr bool move_noexcept = std::is_nothrow_move_constructible<
typename TypeParam::value_type>{};
411 noexcept(TestFixture::construct().push_back(std::declval<
typename TypeParam::value_type&&>())),
421 std::is_copy_constructible<
typename TypeParam::value_type>::value
423 constexpr bool copy_noexcept = std::is_nothrow_copy_constructible<
typename TypeParam::value_type>{};
425 noexcept(TestFixture::construct().push_back(std::declval<
typename TypeParam::value_type
const&>())),
439#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
440 ASSERT_THROW(TestFixture::construct().at(0), std::out_of_range);
442 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
449#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
450 auto vec = TestFixture::construct();
451 vec.push_back(TestFixture::test_value(0));
452 EXPECT_EQ(vec[0], TestFixture::test_value(0));
454 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
461#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
462 ::testing::StaticAssertTypeEq<
decltype(std::declval<TypeParam&>().at(0)),
typename TypeParam::value_type&>();
464 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
471#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
473 StaticAssertTypeEq<
decltype(std::declval<TypeParam
const&>().at(0)),
typename TypeParam::value_type
const&>();
475 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
482#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
483 auto vec = TestFixture::construct();
484 vec.push_back(TestFixture::test_value(0));
485 vec.push_back(TestFixture::test_value(1));
487 EXPECT_EQ(vec.at(0), TestFixture::test_value(0));
488 EXPECT_EQ(vec.at(1), TestFixture::test_value(1));
490 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
497#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
498 auto vec = TestFixture::construct();
499 vec.push_back(TestFixture::test_value(0));
501 ASSERT_THROW(vec.at(vec.size()), std::out_of_range);
502 ASSERT_THROW(vec.at(vec.size() * 2), std::out_of_range);
503 ASSERT_THROW(vec.at(std::numeric_limits<std::size_t>::max()), std::out_of_range);
505 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
512#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
513 auto vec = TestFixture::construct();
514 vec.push_back(TestFixture::test_value(0));
515 vec.push_back(TestFixture::test_value(1));
517 auto const& const_vec = vec;
518 EXPECT_EQ(const_vec.at(0), TestFixture::test_value(0));
519 EXPECT_EQ(const_vec.at(1), TestFixture::test_value(1));
521 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
528#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
529 auto vec = TestFixture::construct();
530 vec.push_back(TestFixture::test_value(0));
532 auto const& const_vec = vec;
534 ASSERT_THROW(const_vec.at(vec.size()), std::out_of_range);
535 ASSERT_THROW(const_vec.at(vec.size() * 2), std::out_of_range);
536 ASSERT_THROW(const_vec.at(std::numeric_limits<std::size_t>::max()), std::out_of_range);
538 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
544 COND_STATIC_ASSERT_EQ(TestFixture::construct().max_size(), TypeParam::capacity);
545 COND_STATIC_ASSERT_TRUE(
noexcept(TestFixture::construct().max_size()));
550 auto vec = TestFixture::construct();
551 for (std::size_t i = 0; i < vec.max_size(); ++i) {
552 vec.push_back(TestFixture::test_value(0));
554 ASSERT_DEATH(vec.push_back(TestFixture::test_value(0)),
"Precondition violation");
560 inline_vector<
typename TypeParam::value_type, 0>
const zvec;
561 inline_vector<
typename TypeParam::value_type
const, 0>
const czvec;
562 ASSERT_EQ(zvec.begin(), zvec.end());
563 ASSERT_EQ(czvec.begin(), czvec.end());
564 ASSERT_EQ(zvec.size(), 0);
565 ASSERT_EQ(czvec.size(), 0);
570 inline_vector<
typename TypeParam::value_type, 0> vec{};
571 ASSERT_DEATH(vec.push_back(TestFixture::test_value(0)),
"Precondition violation");
578 auto vec = TestFixture::construct();
580 vec.push_back(TestFixture::test_value(0));
581 typename TypeParam::value_type& val1 = vec.back();
582 EXPECT_EQ(std::addressof(val1), std::addressof(vec[0]));
584 if (TypeParam::capacity >= 2UL) {
585 vec.push_back(TestFixture::test_value(1));
586 typename TypeParam::value_type& val2 = vec.back();
587 EXPECT_EQ(std::addressof(val2), std::addressof(vec[1]));
596 auto vec = TestFixture::construct();
597 auto const& const_vec = vec;
599 vec.push_back(TestFixture::test_value(0));
600 auto& val1 = const_vec.back();
601 ::testing::StaticAssertTypeEq<
decltype(val1),
typename TypeParam::value_type
const&>();
602 EXPECT_EQ(std::addressof(val1), &const_vec[0]);
604 if (TypeParam::capacity >= 2UL) {
605 vec.push_back(TestFixture::test_value(1));
606 auto& val2 = const_vec.back();
607 ::testing::StaticAssertTypeEq<
decltype(val2),
typename TypeParam::value_type
const&>();
608 EXPECT_EQ(std::addressof(val2), &const_vec[1]);
614 STATIC_ASSERT_TRUE(
noexcept(std::declval<TypeParam&>().back()));
615 STATIC_ASSERT_TRUE(
noexcept(std::declval<TypeParam
const&>().back()));
621 constexpr auto vec = TestFixture::test_vector(1);
622 STATIC_ASSERT_EQ(vec.size(), 1);
623 STATIC_ASSERT_EQ(vec[0], TestFixture::test_value(0));
631 std::is_copy_constructible<
typename TypeParam::value_type>::value
633 auto const values = TestFixture::full_test_initializer_list();
635 TypeParam
const vec{values};
636 STATIC_ASSERT_EQ(
noexcept(TypeParam{values}), std::is_nothrow_copy_constructible<
typename TypeParam::value_type>{});
638 EXPECT_THAT(vec, ::testing::ElementsAreArray(values));
646 InlineVectorTest<TypeParam>::constexpr_compatible&&
649 constexpr auto values = TestFixture::full_test_initializer_list();
651 constexpr TypeParam vec{values};
653 EXPECT_THAT(vec, ::testing::ElementsAreArray(values));
656template <
typename Vec>
658 static_assert(std::is_rvalue_reference<Vec&&>::value,
"Only expected to be called with an r-value reference.");
659 return std::forward<Vec>(vec).back();
665 constexpr auto vec = TestFixture::full_test_vector();
666 STATIC_ASSERT_EQ(vec.back(), TestFixture::test_value(TypeParam::capacity - 1UL));
668 constexpr_non_const_back(TestFixture::full_test_vector()),
669 TestFixture::test_value(TypeParam::capacity - 1UL)
676 auto vec = TestFixture::full_test_vector();
677 EXPECT_EQ(std::addressof(vec.front()), std::addressof(vec[0]));
678 ::testing::StaticAssertTypeEq<
decltype(vec.front()),
typename TypeParam::value_type&>();
679 STATIC_ASSERT_TRUE(
noexcept(vec.front()));
680 auto const& const_vec = vec;
681 EXPECT_EQ(&const_vec.front(), &const_vec[0]);
682 ::testing::StaticAssertTypeEq<
decltype(const_vec.front()),
typename TypeParam::value_type
const&>();
683 STATIC_ASSERT_TRUE(
noexcept(const_vec.front()));
686template <
typename Vec>
688 static_assert(std::is_rvalue_reference<Vec&&>::value,
"Only expected to be called with an r-value reference.");
689 return std::forward<Vec>(vec).front();
696 constexpr auto vec = TestFixture::full_test_vector();
697 STATIC_ASSERT_EQ(vec.front(), TestFixture::test_value(0));
698 STATIC_ASSERT_EQ(constexpr_non_const_front(TestFixture::full_test_vector()), TestFixture::test_value(0));
704 auto vec = TestFixture::construct();
705 ::testing::StaticAssertTypeEq<
decltype(vec.begin()),
typename TypeParam::iterator>();
706 ::testing::StaticAssertTypeEq<
decltype(vec.end()),
typename TypeParam::iterator>();
707 STATIC_ASSERT_TRUE(
noexcept(vec.begin()));
708 STATIC_ASSERT_TRUE(
noexcept(vec.end()));
709 EXPECT_EQ(vec.begin(), vec.end());
716 auto const values = TestFixture::full_test_initializer_list();
717 auto const vec = TestFixture::full_test_vector();
718 ASSERT_TRUE(arene::base::equal(values.begin(), values.end(), vec.begin(), vec.end()));
725 auto const values = TestFixture::full_test_initializer_list();
726 auto const vec = TestFixture::full_test_vector();
727 ASSERT_TRUE(arene::base::equal(values.begin(), values.end(), vec.begin(), vec.end()));
732 using value_type =
typename TypeParam::value_type;
733 ::testing::StaticAssertTypeEq<
typename TypeParam::iterator::value_type, value_type>();
734 ::testing::StaticAssertTypeEq<
typename TypeParam::iterator::reference, value_type&>();
735 ::testing::StaticAssertTypeEq<
typename TypeParam::iterator::pointer, value_type*>();
736 ::testing::StaticAssertTypeEq<
typename TypeParam::iterator::difference_type, std::ptrdiff_t>();
737 ::testing::StaticAssertTypeEq<
typename TypeParam::iterator::iterator_category, std::random_access_iterator_tag>();
739 ::testing::StaticAssertTypeEq<
typename TypeParam::const_iterator::value_type, value_type>();
740 ::testing::StaticAssertTypeEq<
typename TypeParam::const_iterator::reference, value_type
const&>();
741 ::testing::StaticAssertTypeEq<
typename TypeParam::const_iterator::pointer, value_type
const*>();
742 ::testing::StaticAssertTypeEq<
typename TypeParam::const_iterator::difference_type, std::ptrdiff_t>();
743 ::testing::StaticAssertTypeEq<
typename TypeParam::const_iterator::iterator_category, std::random_access_iterator_tag>(
749 using value_type =
typename TypeParam::value_type;
750 ::testing::StaticAssertTypeEq<
typename TypeParam::value_type, value_type>();
751 ::testing::StaticAssertTypeEq<
typename TypeParam::pointer, value_type*>();
752 ::testing::StaticAssertTypeEq<
typename TypeParam::const_pointer, value_type
const*>();
753 ::testing::StaticAssertTypeEq<
typename TypeParam::reference, value_type&>();
754 ::testing::StaticAssertTypeEq<
typename TypeParam::const_reference, value_type
const&>();
755 ::testing::StaticAssertTypeEq<
typename TypeParam::size_type, std::size_t>();
756 ::testing::StaticAssertTypeEq<
typename TypeParam::difference_type, std::ptrdiff_t>();
757 ::testing::StaticAssertTypeEq<
758 typename TypeParam::reverse_iterator,
759 ::arene::base::reverse_iterator<
typename TypeParam::iterator>>();
760 ::testing::StaticAssertTypeEq<
761 typename TypeParam::const_reverse_iterator,
762 ::arene::base::reverse_iterator<
typename TypeParam::const_iterator>>();
770template <
typename Vec>
791 constexpr_iterate<TypeParam>(TestFixture::full_test_initializer_list(), TestFixture::full_test_vector())
799 constexpr_iterate<TypeParam
const>(TestFixture::full_test_initializer_list(), TestFixture::full_test_vector())
807 auto vec = TestFixture::full_test_vector();
809 STATIC_ASSERT_TRUE(std::is_same<
810 decltype(vec.erase(std::declval<
typename TypeParam::const_iterator>())),
811 typename TypeParam::iterator>::value);
812 auto const pos = vec.erase(vec.begin());
813 EXPECT_EQ(pos, vec.begin());
814 EXPECT_EQ(vec.size(), TypeParam::capacity - 1UL);
815 if (TypeParam::capacity >= 2) {
816 EXPECT_EQ(vec[0], TestFixture::test_value(1));
818 if (TypeParam::capacity >= 3) {
819 EXPECT_EQ(vec[1], TestFixture::test_value(2));
821 if (TypeParam::capacity >= 4) {
822 EXPECT_EQ(vec[2], TestFixture::test_value(3));
830 auto vec = TestFixture::full_test_vector();
832 STATIC_ASSERT_TRUE(std::is_same<
833 decltype(vec.erase(std::declval<
typename TypeParam::const_iterator>())),
834 typename TypeParam::iterator>::value);
835 auto pos = vec.erase(vec.begin() + 1);
836 EXPECT_EQ(pos, vec.begin() + 1);
837 EXPECT_EQ(vec.size(), TypeParam::capacity - 1UL);
838 EXPECT_EQ(vec[0], TestFixture::test_value(0));
839 if (TypeParam::capacity >= 3) {
840 EXPECT_EQ(vec[1], TestFixture::test_value(2));
842 if (TypeParam::capacity >= 4) {
843 EXPECT_EQ(vec[2], TestFixture::test_value(3));
847template <
typename Vec,
typename... Args>
850 vector_push_back(vec, std::forward<Args>(args)...);
851 vec.erase(vec.begin() +
static_cast<std::ptrdiff_t>(index));
863 constexpr auto vec = constexpr_erase<TypeParam>(
865 TestFixture::test_value(0),
866 TestFixture::test_value(1),
867 TestFixture::test_value(2),
868 TestFixture::test_value(3)
870 STATIC_ASSERT_EQ(vec.size(), 3);
871 STATIC_ASSERT_EQ(vec[0], TestFixture::test_value(0));
872 STATIC_ASSERT_EQ(vec[1], TestFixture::test_value(1));
873 STATIC_ASSERT_EQ(vec[2], TestFixture::test_value(3));
880 auto vec = TestFixture::construct();
881 constexpr std::size_t erase_start = 2;
882 constexpr std::size_t erase_end = 5;
883 arene::base::array<arene::base::optional<
typename TypeParam::value_type>, TypeParam::capacity> expected;
884 std::size_t expected_pos{0};
885 for (std::size_t idx = 0; idx < TypeParam::capacity; ++idx) {
886 vec.push_back(TestFixture::test_value(idx));
887 if (idx < erase_start || idx >= erase_end) {
888 expected[expected_pos].emplace(TestFixture::test_value(idx));
893 ::testing::StaticAssertTypeEq<
895 std::declval<
typename TypeParam::const_iterator>(),
896 std::declval<
typename TypeParam::const_iterator>()
898 typename TypeParam::iterator>();
899 auto const pos = vec.erase(vec.begin() + erase_start, vec.begin() + erase_end);
900 EXPECT_EQ(pos, vec.begin() + erase_start);
901 ASSERT_EQ(vec.size(), expected_pos);
902 EXPECT_TRUE(elements_are_array(vec, expected));
911 auto value_vec = TestFixture::construct(TypeParam::capacity);
913 STATIC_ASSERT_EQ(
noexcept(TypeParam(0)), std::is_nothrow_default_constructible<
typename TypeParam::value_type>{});
914 EXPECT_EQ(value_vec.size(), TypeParam::capacity);
915 EXPECT_TRUE(all_elements_are(value_vec,
typename TypeParam::value_type{}));
923 std::is_copy_constructible<
typename TypeParam::value_type>::value
925 auto const value = TestFixture::test_value(0);
926 auto const value_vec = TestFixture::construct(TypeParam::capacity, value);
929 noexcept(TypeParam(TypeParam::capacity, value)),
930 std::is_nothrow_copy_constructible<
typename TypeParam::value_type>{}
932 EXPECT_EQ(value_vec.size(), TypeParam::capacity);
933 EXPECT_THAT(value_vec, ::testing::Each(::testing::Eq(value)));
940 std::is_copy_constructible<
typename TypeParam::value_type>::value
942 auto const vec = TestFixture::full_test_vector();
944 auto const copy(vec);
946 EXPECT_THAT(copy, ::testing::ElementsAreArray(vec));
951 auto const values = TestFixture::full_test_initializer_list();
952 auto vec = TestFixture::full_test_vector();
955 TypeParam
const moved(std::move(vec));
956 EXPECT_TRUE(elements_are_array(moved, values));
963 constexpr std::size_t count = TypeParam::capacity;
964 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
966 auto vec = TestFixture::test_vector(count);
967 auto copy = TestFixture::test_vector(smaller_count);
970 ASSERT_EQ(vec.size(), count);
971 ASSERT_EQ(copy.size(), count);
972 for (std::size_t i = 0; i < count; ++i) {
973 EXPECT_EQ(vec[i], copy[i]);
974 EXPECT_EQ(TestFixture::test_value(i), copy[i]);
981 constexpr std::size_t count = TypeParam::capacity - 1UL;
982 constexpr std::size_t larger_count = TypeParam::capacity;
984 auto vec = TestFixture::test_vector(count);
985 auto copy = TestFixture::test_vector(larger_count);
988 ASSERT_EQ(vec.size(), count);
989 ASSERT_EQ(copy.size(), count);
990 for (std::size_t i = 0; i < count; ++i) {
991 EXPECT_EQ(vec[i], copy[i]);
992 EXPECT_EQ(TestFixture::test_value(i), copy[i]);
999 using short_vec =
typename TestFixture::
template vector_with_capacity<TypeParam::capacity>;
1000 using vec =
typename TestFixture::
template vector_with_capacity<TypeParam::capacity + 1UL>;
1002 constexpr bool should_be_copyable = std::is_copy_constructible<
typename TypeParam::value_type>{} &&
1003 std::is_copy_assignable<
typename TypeParam::value_type>{};
1005 std::is_copy_constructible<vec>::value,
1006 std::is_copy_constructible<
typename TypeParam::value_type>::value
1008 STATIC_ASSERT_EQ(std::is_copy_assignable<vec>{}, should_be_copyable);
1009 STATIC_ASSERT_EQ((std::is_assignable<short_vec&, vec
const&>{}), should_be_copyable);
1010 STATIC_ASSERT_EQ((std::is_assignable<vec&, short_vec
const&>{}), should_be_copyable);
1012 constexpr bool assign_noexcept = std::is_nothrow_copy_constructible<
typename TypeParam::value_type>{} &&
1013 std::is_nothrow_copy_assignable<
typename TypeParam::value_type>{};
1015 std::is_nothrow_copy_constructible<vec>::value,
1016 std::is_nothrow_copy_constructible<
typename TypeParam::value_type>::value
1018 STATIC_ASSERT_EQ(std::is_nothrow_copy_assignable<vec>{}, assign_noexcept);
1019 STATIC_ASSERT_EQ((std::is_nothrow_assignable<short_vec&, vec
const&>{}), assign_noexcept);
1020 STATIC_ASSERT_EQ((std::is_nothrow_assignable<vec&, short_vec
const&>{}), assign_noexcept);
1027 constexpr std::size_t count = TypeParam::capacity;
1028 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
1030 auto first = TestFixture::construct();
1031 arene::base::array<arene::base::optional<
typename TypeParam::value_type>, TypeParam::capacity> expected;
1032 std::size_t expected_pos{0};
1033 for (std::size_t idx = 0; idx < count; ++idx) {
1034 first.push_back(TestFixture::test_value(idx));
1035 expected[expected_pos].emplace(TestFixture::test_value(idx));
1039 auto second = TestFixture::test_vector(smaller_count);
1041 second = std::move(first);
1043 EXPECT_EQ(second.size(), count);
1044 EXPECT_TRUE(elements_are_array(second, expected));
1050 constexpr std::size_t count = TypeParam::capacity - 1UL;
1051 constexpr std::size_t larger_count = TypeParam::capacity;
1053 auto first = TestFixture::test_vector(count);
1054 auto second = TestFixture::test_vector(larger_count);
1055 second = std::move(first);
1057 ASSERT_EQ(second.size(), count);
1058 for (std::size_t i = 0; i < count; ++i) {
1059 EXPECT_EQ(TestFixture::test_value(i), second[i]);
1066 using short_vec =
typename TestFixture::
template vector_with_capacity<TypeParam::capacity>;
1067 using vec =
typename TestFixture::
template vector_with_capacity<TypeParam::capacity + 1UL>;
1069 constexpr bool should_be_movable = std::is_move_assignable<
typename TypeParam::value_type>{} &&
1070 std::is_move_constructible<
typename TypeParam::value_type>{};
1071 STATIC_ASSERT_EQ(std::is_move_constructible<vec>{}, should_be_movable);
1072 STATIC_ASSERT_EQ(std::is_move_assignable<vec>{}, should_be_movable);
1073 STATIC_ASSERT_EQ((std::is_assignable<short_vec&, vec>{}), should_be_movable);
1074 STATIC_ASSERT_EQ((std::is_assignable<vec&, short_vec>{}), should_be_movable);
1076 constexpr bool assign_should_be_noexcept = std::is_nothrow_move_assignable<
typename TypeParam::value_type>{} &&
1077 std::is_nothrow_move_constructible<
typename TypeParam::value_type>{};
1079 std::is_nothrow_move_constructible<vec>::value,
1080 std::is_nothrow_move_constructible<
typename TypeParam::value_type>::value
1082 STATIC_ASSERT_EQ(std::is_nothrow_move_assignable<vec>{}, assign_should_be_noexcept);
1083 STATIC_ASSERT_EQ((std::is_nothrow_assignable<short_vec&, vec>{}), assign_should_be_noexcept);
1084 STATIC_ASSERT_EQ((std::is_nothrow_assignable<vec&, short_vec>{}), assign_should_be_noexcept);
1101 auto vec = TestFixture::test_vector(TypeParam::capacity - 1UL);
1103 vec.push_back(TestFixture::test_value(TypeParam::capacity - 1UL));
1106 EXPECT_EQ(vec.size(), TypeParam::capacity - 1UL);
1107 EXPECT_THAT(vec, elements_match_function(TestFixture::test_value));
1112 STATIC_ASSERT_TRUE(
noexcept(std::declval<TypeParam>().pop_back()));
1115template <
typename Vec>
1117 static_assert(std::is_rvalue_reference<Vec&&>::value,
"Only expected to be called with an r-value reference.");
1118 std::forward<Vec>(vec).pop_back();
1119 return std::forward<Vec>(vec);
1124 constexpr auto vec = constexpr_pop_back<TypeParam>(TestFixture::full_test_vector());
1125 STATIC_ASSERT_EQ(vec.size(), TypeParam::capacity - 1UL);
1127 if (TypeParam::capacity >= 2) {
1128 EXPECT_EQ(vec[0], TestFixture::test_value(0));
1130 if (TypeParam::capacity >= 3) {
1131 EXPECT_EQ(vec[1], TestFixture::test_value(1));
1133 if (TypeParam::capacity >= 4) {
1134 EXPECT_EQ(vec[2], TestFixture::test_value(2));
1140 auto vec = TestFixture::construct();
1143 noexcept(vec.erase(vec.begin(), vec.end())),
1144 std::is_nothrow_move_assignable<
typename TypeParam::value_type>{}
1146 STATIC_ASSERT_EQ(
noexcept(vec.erase(vec.begin())), std::is_nothrow_move_assignable<
typename TypeParam::value_type>{});
1152 auto vec1 = TestFixture::construct();
1153 auto const& const_vec1 = vec1;
1154 auto const itr = vec1.insert(const_vec1.begin(), TestFixture::test_value(0));
1155 EXPECT_EQ(itr, vec1.begin());
1156 EXPECT_EQ(vec1.size(), 1);
1157 EXPECT_EQ(vec1[0], TestFixture::test_value(0));
1163 auto vec1 = TestFixture::test_vector(1);
1164 auto const& const_vec1 = vec1;
1165 auto const pos = vec1.insert(const_vec1.end(), TestFixture::test_value(1));
1166 EXPECT_EQ(pos, vec1.begin() + 1);
1167 EXPECT_EQ(vec1.size(), 2);
1168 EXPECT_EQ(vec1[0], TestFixture::test_value(0));
1169 EXPECT_EQ(vec1[1], TestFixture::test_value(1));
1176 auto vec1 = TestFixture::test_vector(2);
1177 auto const& const_vec1 = vec1;
1178 auto const pos = vec1.insert(const_vec1.begin() + 1, TestFixture::test_value(2));
1179 EXPECT_EQ(pos, vec1.begin() + 1);
1180 EXPECT_EQ(vec1.size(), 3);
1181 EXPECT_EQ(vec1[0], TestFixture::test_value(0));
1182 EXPECT_EQ(vec1[1], TestFixture::test_value(2));
1183 EXPECT_EQ(vec1[2], TestFixture::test_value(1));
1189 InlineVectorDeathTest,
1191 std::is_default_constructible<
typename TypeParam::value_type>::value
1193 auto vec1 = TestFixture::construct(TypeParam::capacity);
1194 EXPECT_EQ(vec1.size(), TypeParam::capacity);
1195 ASSERT_DEATH(vec1.insert(vec1.end(), TestFixture::test_value(0)),
"Precondition violation");
1196 ASSERT_DEATH(vec1.insert(vec1.begin(), TestFixture::test_value(0)),
"Precondition violation");
1197 EXPECT_EQ(vec1.size(), TypeParam::capacity);
1198 EXPECT_TRUE(all_elements_are(vec1,
typename TypeParam::value_type{}));
1204 InlineVectorDeathTest,
1208 ASSERT_DEATH(TestFixture::construct(TypeParam::capacity + 1),
"Precondition violation");
1214 InlineVectorDeathTest,
1216 std::is_copy_constructible<
typename TypeParam::value_type>::value
1218 auto const source = TestFixture::test_value(0);
1219 ASSERT_DEATH(TestFixture::construct(TypeParam::capacity + 1, source),
"Precondition violation");
1225 InlineVectorDeathTest,
1227 std::is_copy_constructible<
typename TypeParam::value_type>::value
1230 TestFixture::construct(TestFixture::
template test_initializer_list<TypeParam::capacity + 1UL>()),
1231 "Precondition violation"
1235template <
typename Vec>
1248 constexpr typename TestFixture::
template vector_with_capacity<0> vec{};
1249 constexpr typename TestFixture::
template vector_with_capacity<0> vec2 = constexpr_resize(vec, 0);
1251 STATIC_ASSERT_EQ(vec2.size(), 0);
1261 constexpr auto vec = TestFixture::construct(TypeParam::capacity);
1262 constexpr auto vec2 = constexpr_resize(vec, 0);
1264 STATIC_ASSERT_EQ(vec2.size(), 0);
1274 constexpr std::size_t count1 = TypeParam::capacity - 1UL;
1275 constexpr std::size_t count2 = TypeParam::capacity;
1276 constexpr auto vec = TestFixture::construct(count1);
1277 STATIC_ASSERT_EQ(vec.size(), count1);
1278 constexpr auto vec2 = constexpr_resize(vec, count2);
1279 STATIC_ASSERT_EQ(vec2.size(), count2);
1289 noexcept(TestFixture::construct().resize(0)),
1290 std::is_nothrow_default_constructible<
typename TypeParam::value_type>{}
1299 std::is_copy_constructible<
typename TypeParam::value_type>::value
1302 noexcept(std::declval<TypeParam&>().resize(0, std::declval<
typename TypeParam::value_type>())),
1303 std::is_nothrow_copy_constructible<
typename TypeParam::value_type>{}
1312 std::is_copy_constructible<
typename TypeParam::value_type>::value
1314 constexpr std::size_t initial_count = TypeParam::capacity;
1315 auto const initial_value = TestFixture::test_value(0);
1316 TypeParam vec(initial_count, initial_value);
1317 constexpr std::size_t count = TypeParam::capacity - 1UL;
1318 auto const value = TestFixture::test_value(1);
1319 vec.resize(count, value);
1320 ASSERT_EQ(vec.size(), count);
1322 for (std::size_t idx = 0; idx < count; ++idx) {
1323 EXPECT_EQ(vec[idx], initial_value);
1334 std::is_copy_constructible<
typename TypeParam::value_type>::value
1336 constexpr std::size_t initial_count = TypeParam::capacity - 1UL;
1337 auto const initial_value = TestFixture::test_value(0);
1338 TypeParam vec(initial_count, initial_value);
1339 constexpr std::size_t count = TypeParam::capacity;
1340 auto const value = TestFixture::test_value(1);
1341 vec.resize(count, value);
1342 ASSERT_EQ(vec.size(), count);
1344 for (std::size_t idx = 0; idx < initial_count; ++idx) {
1345 EXPECT_EQ(vec[idx], initial_value);
1347 for (std::size_t idx = initial_count; idx < count; ++idx) {
1348 EXPECT_EQ(vec[idx], value);
1357 InlineVectorTest<TypeParam>::constexpr_compatible&&
1360 constexpr auto source = TestFixture::test_value(0);
1361 constexpr auto vec = TestFixture::construct(TypeParam::capacity, source);
1363 STATIC_ASSERT_EQ(vec.size(), TypeParam::capacity);
1364 STATIC_ASSERT_TRUE(all_elements_are(vec, source));
1367template <
typename Vec,
typename T>
1369 static_assert(std::is_rvalue_reference<Vec&&>::value,
"Only expected to be called with an r-value reference.");
1370 std::forward<Vec>(vec).insert(std::forward<Vec>(vec).begin() + offset, std::forward<T>(value));
1371 return std::forward<Vec>(vec);
1382 constexpr auto vec = constexpr_insert<TypeParam>(TestFixture::test_vector(2), 1, TestFixture::test_value(2));
1384 STATIC_ASSERT_EQ(vec.size(), 3);
1385 STATIC_ASSERT_EQ(vec[0], TestFixture::test_value(0));
1386 STATIC_ASSERT_EQ(vec[1], TestFixture::test_value(2));
1387 STATIC_ASSERT_EQ(vec[2], TestFixture::test_value(1));
1393 auto const expected = TestFixture::full_test_vector();
1394 auto source = TestFixture::full_test_vector();
1396 TypeParam vec(std::make_move_iterator(source.begin()), std::make_move_iterator(source.end()));
1398 EXPECT_EQ(vec.size(), expected.size());
1399 EXPECT_TRUE(elements_are_array(vec, expected));
1406 std::move_iterator<
typename arene::base::array<
typename TypeParam::value_type, TypeParam::capacity>::iterator>;
1407 using source_val =
typename source_it::reference;
1409 constexpr bool it_operations_noexcept =
noexcept(++std::declval<source_it>())&&
noexcept(*std::declval<source_it>());
1410 constexpr bool element_construction_noexcept =
1411 std::is_nothrow_constructible<
typename TypeParam::value_type, source_val>{};
1413 STATIC_ASSERT_TRUE((std::is_constructible<TypeParam, source_it, source_it>{}));
1415 (std::is_nothrow_constructible<TypeParam, source_it, source_it>{}),
1416 it_operations_noexcept && element_construction_noexcept
1419 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
1420 using convertible_array = ::arene::base::array<throws_when_converted, TypeParam::capacity>;
1421 using throwing_bidirectional_iterator =
typename TestFixture::throwing_bidirectional_move_iterator_of_t;
1423 STATIC_ASSERT_TRUE(std::is_constructible<
1425 typename convertible_array::const_iterator,
1426 typename convertible_array::const_iterator>::value);
1427 STATIC_ASSERT_FALSE(std::is_nothrow_constructible<
1429 typename convertible_array::const_iterator,
1430 typename convertible_array::const_iterator>::value);
1432 std::is_constructible<TypeParam, throwing_bidirectional_iterator, throwing_bidirectional_iterator>::value
1434 STATIC_ASSERT_FALSE(
1435 std::is_nothrow_constructible<TypeParam, throwing_bidirectional_iterator, throwing_bidirectional_iterator>::value
1442 using input_it = ::testing::demoted_iterator<
typename TypeParam::value_type*, std::input_iterator_tag>;
1443 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
1444 using throwing_it_throwing_type =
typename TestFixture::
template throwing_input_iterator<throws_when_converted>;
1445 using throwing_it_raw_type =
typename TestFixture::
template throwing_input_iterator<
typename TypeParam::value_type>;
1446 using nothrow_it_throwing_type =
typename TestFixture::
template non_throwing_input_iterator<throws_when_converted>;
1447 using nothrow_it_raw_type =
1448 typename TestFixture::
template non_throwing_input_iterator<
typename TypeParam::value_type>;
1450 constexpr bool it_operations_noexcept =
noexcept(++std::declval<input_it>())&&
noexcept(*std::declval<input_it>());
1451 constexpr bool element_construction_noexcept =
1452 std::is_nothrow_constructible<
typename TypeParam::value_type,
typename input_it::reference>{};
1454 STATIC_ASSERT_TRUE((std::is_constructible<TypeParam, input_it, input_it>{}));
1456 (std::is_nothrow_constructible<TypeParam, input_it, input_it>{}),
1457 it_operations_noexcept && element_construction_noexcept
1460 STATIC_ASSERT_TRUE(std::is_constructible<TypeParam, throwing_it_throwing_type, throwing_it_throwing_type>::value);
1461 STATIC_ASSERT_FALSE(
1462 std::is_nothrow_constructible<TypeParam, throwing_it_throwing_type, throwing_it_throwing_type>::value
1464 STATIC_ASSERT_TRUE(std::is_constructible<TypeParam, throwing_it_raw_type, throwing_it_raw_type>::value);
1465 STATIC_ASSERT_FALSE(std::is_nothrow_constructible<TypeParam, throwing_it_raw_type, throwing_it_raw_type>::value);
1466 STATIC_ASSERT_TRUE(std::is_constructible<TypeParam, nothrow_it_raw_type, nothrow_it_raw_type>::value);
1468 (std::is_nothrow_constructible<TypeParam, nothrow_it_raw_type, nothrow_it_raw_type>::value),
1469 std::is_nothrow_copy_constructible<
typename TypeParam::value_type>::value
1471 STATIC_ASSERT_TRUE(std::is_constructible<TypeParam, nothrow_it_throwing_type, nothrow_it_throwing_type>::value);
1472 STATIC_ASSERT_FALSE(
1473 std::is_nothrow_constructible<TypeParam, nothrow_it_throwing_type, nothrow_it_throwing_type>::value
1484 InlineVectorTest<TypeParam>::constexpr_compatible&&
1487 constexpr auto source = TestFixture::full_test_initializer_list();
1488 constexpr TypeParam vec(source.begin(), source.end());
1490 STATIC_ASSERT_EQ(vec.size(), source.size());
1491 STATIC_ASSERT_TRUE(equal(vec.begin(), vec.end(), source.begin(), source.end()));
1498 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
1500 auto const value = TestFixture::full_test_initializer_list();
1502 auto copy = TestFixture::test_vector(smaller_count);
1505 EXPECT_THAT(copy, ::testing::ElementsAreArray(value));
1512 constexpr std::size_t larger_count = TypeParam::capacity;
1514 auto const value = TestFixture::
template test_initializer_list<TypeParam::capacity - 1UL>();
1516 auto copy = TestFixture::test_vector(larger_count);
1519 EXPECT_THAT(copy, ::testing::ElementsAreArray(value));
1525 auto source = TestFixture::full_test_vector();
1527 auto vec = TestFixture::test_vector(0);
1528 vec.assign(std::make_move_iterator(source.begin()), std::make_move_iterator(source.end()));
1530 EXPECT_TRUE(elements_are_array(vec, TestFixture::full_test_initializer_list()));
1537 using array_it = std::move_iterator<
typename array<
typename TypeParam::value_type, TypeParam::capacity>::iterator>;
1538 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
1539 using convertible_array_it = std::move_iterator<
typename array<throws_when_converted, TypeParam::capacity>::iterator>;
1540 using throwing_bidirectional_iterator =
typename TestFixture::throwing_bidirectional_move_iterator_of_t;
1542 constexpr bool it_operations_noexcept =
noexcept(++std::declval<array_it>())&&
noexcept(*std::declval<array_it>());
1543 constexpr bool element_construction_noexcept =
1544 std::is_nothrow_constructible<
typename TypeParam::value_type,
typename array_it::reference>{} &&
1545 std::is_nothrow_assignable<
typename TypeParam::value_type&,
typename array_it::reference>{};
1548 noexcept(TypeParam{}.assign(std::declval<array_it>(), std::declval<array_it>())),
1549 it_operations_noexcept && element_construction_noexcept
1551 STATIC_ASSERT_FALSE(
1552 noexcept(TypeParam{}.assign(std::declval<convertible_array_it>(), std::declval<convertible_array_it>()))
1554 STATIC_ASSERT_FALSE(
noexcept(TypeParam{}.assign(
1555 std::declval<throwing_bidirectional_iterator>(),
1556 std::declval<throwing_bidirectional_iterator>()
1564 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
1566 auto const value = TestFixture::full_test_initializer_list();
1568 auto copy = TestFixture::test_vector(smaller_count);
1571 EXPECT_THAT(copy, ::testing::ElementsAreArray(value));
1577 constexpr bool is_nothrow_copyable = std::is_nothrow_copy_constructible<
typename TypeParam::value_type>{} &&
1578 std::is_nothrow_copy_assignable<
typename TypeParam::value_type>{};
1580 STATIC_ASSERT_TRUE(std::is_assignable<TypeParam, std::initializer_list<
typename TypeParam::value_type>>::value);
1582 (std::is_nothrow_assignable<TypeParam, std::initializer_list<
typename TypeParam::value_type>>::value),
1586 auto const values = TestFixture::full_test_initializer_list();
1587 STATIC_ASSERT_EQ(
noexcept(TypeParam{}.assign(values)), is_nothrow_copyable);
1594 auto source = TestFixture::full_test_vector();
1596 auto vec = TestFixture::test_vector(0);
1597 using move_it = std::move_iterator<
typename decltype(source)::iterator>;
1598 using input_it = ::testing::demoted_iterator<move_it, std::input_iterator_tag>;
1600 auto begin = input_it{std::make_move_iterator(source.begin())};
1601 auto end = input_it{std::make_move_iterator(source.end())};
1602 vec.assign(begin, end);
1604 EXPECT_TRUE(elements_are_array(vec, TestFixture::full_test_initializer_list()));
1610 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
1611 using throwing_it_throwing_type =
typename TestFixture::
template throwing_input_iterator<throws_when_converted>;
1612 using throwing_it_raw_type =
typename TestFixture::
template throwing_input_iterator<
typename TypeParam::value_type>;
1613 using nothrow_it_throwing_type =
typename TestFixture::
template non_throwing_input_iterator<throws_when_converted>;
1614 using nothrow_it_raw_type =
1615 typename TestFixture::
template non_throwing_input_iterator<
typename TypeParam::value_type>;
1617 STATIC_ASSERT_FALSE(
noexcept(TypeParam{}.assign(
1618 std::declval<::testing::demoted_iterator<throwing_it_throwing_type, std::input_iterator_tag>>(),
1619 std::declval<::testing::demoted_iterator<throwing_it_throwing_type, std::input_iterator_tag>>()
1621 STATIC_ASSERT_FALSE(
1622 noexcept(TypeParam{}.assign(std::declval<throwing_it_throwing_type>(), std::declval<throwing_it_throwing_type>()))
1624 STATIC_ASSERT_FALSE(
1625 noexcept(TypeParam{}.assign(std::declval<throwing_it_raw_type>(), std::declval<throwing_it_raw_type>()))
1628 noexcept(TypeParam{}.assign(std::declval<nothrow_it_raw_type>(), std::declval<nothrow_it_raw_type>())),
1629 std::is_nothrow_copy_assignable<
typename TypeParam::value_type>::value &&
1630 std::is_nothrow_copy_constructible<
typename TypeParam::value_type>::value
1632 STATIC_ASSERT_FALSE(
1633 noexcept(TypeParam{}.assign(std::declval<nothrow_it_throwing_type>(), std::declval<nothrow_it_throwing_type>()))
1640 constexpr std::size_t count = TypeParam::capacity;
1641 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
1643 auto copy = TestFixture::test_vector(smaller_count);
1644 auto const value = TestFixture::test_value(0);
1645 copy.assign(count, value);
1647 EXPECT_EQ(copy.size(), count);
1648 for (std::size_t i = 0; i < count; ++i) {
1649 EXPECT_EQ(copy[i], value);
1656 constexpr bool is_nothrow_copyable = std::is_nothrow_copy_constructible<
typename TypeParam::value_type>{} &&
1657 std::is_nothrow_copy_assignable<
typename TypeParam::value_type>{};
1658 STATIC_ASSERT_EQ(
noexcept(TypeParam{}.assign(0, TestFixture::test_value(0))), is_nothrow_copyable);
1664 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
1666 auto const initial_value = TestFixture::test_value(0);
1667 TypeParam copy(smaller_count, initial_value);
1668 auto const value = TestFixture::test_value(1);
1669 ASSERT_DEATH(copy.assign(TypeParam::capacity + 1, value),
"Precondition violation");
1671 EXPECT_EQ(copy.size(), smaller_count);
1672 for (std::size_t i = 0; i < smaller_count; ++i) {
1673 EXPECT_EQ(copy[i], initial_value);
1679 ::testing::StaticAssertTypeEq<
decltype(std::declval<TypeParam&>()[0]),
typename TypeParam::value_type&>();
1684 ::testing::StaticAssertTypeEq<
decltype(std::declval<TypeParam
const&>()[0]),
typename TypeParam::value_type
const&>();
1690 auto vec = TestFixture::test_vector(2);
1691 auto const& const_vec = vec;
1693 EXPECT_EQ(vec[0], TestFixture::test_value(0));
1694 EXPECT_EQ(vec[1], TestFixture::test_value(1));
1696 EXPECT_EQ(&const_vec[0], std::addressof(vec[0]));
1697 EXPECT_EQ(&const_vec[1], std::addressof(vec[1]));
1706 ASSERT_DEATH(TestFixture::construct()[0],
"index < this->size()");
1711 STATIC_ASSERT_TRUE(
noexcept(std::declval<TypeParam
const&>()[0]));
1720 constexpr auto vec = TestFixture::test_vector(2);
1721 STATIC_ASSERT_EQ(vec[0], TestFixture::test_value(0));
1722 STATIC_ASSERT_EQ(vec[1], TestFixture::test_value(1));
1727 auto vec = TestFixture::full_test_vector();
1728 auto const& const_vec = vec;
1731 EXPECT_EQ(vec.data(), std::addressof(vec[0]));
1733 EXPECT_EQ(const_vec.data(), std::addressof(vec[0]));
1735 STATIC_ASSERT_TRUE(
noexcept(vec.data()));
1736 STATIC_ASSERT_TRUE(
noexcept(const_vec.data()));
1739 COND_STATIC_ASSERT_NE(TestFixture::full_test_vector().data(),
nullptr);
1744 auto vec = TestFixture::full_test_vector();
1746 EXPECT_EQ(vec.size(), TypeParam::capacity);
1747 EXPECT_FALSE(vec.empty());
1749 EXPECT_EQ(vec.size(), 0);
1750 EXPECT_TRUE(vec.empty());
1752 STATIC_ASSERT_TRUE(
noexcept(vec.clear()));
1755template <
typename Vec>
1764 constexpr auto vec = TestFixture::full_test_vector();
1766 constexpr auto value2 = constexpr_clear(vec);
1767 STATIC_ASSERT_TRUE(value2.empty());
1778 constexpr TypeParam vec{
1779 TestFixture::
template unique_test_value<0>(),
1780 TestFixture::
template unique_test_value<1>(),
1781 TestFixture::
template unique_test_value<2>()
1783 constexpr TypeParam different_contents{
1784 TestFixture::
template unique_test_value<3>(),
1785 TestFixture::
template unique_test_value<4>(),
1786 TestFixture::
template unique_test_value<5>()
1788 constexpr auto longer = TestFixture::test_vector(4);
1789 constexpr TypeParam copy{vec};
1791 STATIC_ASSERT_TRUE(vec != different_contents);
1792 STATIC_ASSERT_TRUE(vec != longer);
1793 STATIC_ASSERT_FALSE(vec != copy);
1794 STATIC_ASSERT_FALSE(vec == different_contents);
1795 STATIC_ASSERT_FALSE(vec == longer);
1796 STATIC_ASSERT_TRUE(vec == copy);
1801 static_assert(std::is_rvalue_reference<Vec&&>::value,
"Only expected to be called with an r-value reference.");
1802 using difference_type =
typename std::iterator_traits<
typename Vec::iterator>::difference_type;
1803 std::forward<Vec>(vec).erase(
1804 std::forward<Vec>(vec).begin(),
1805 std::forward<Vec>(vec).begin() +
static_cast<difference_type>(count)
1807 return std::forward<Vec>(vec);
1812template <
typename T>
1827 constexpr auto sorted_test_values = sort_helper(TypeParam{
1828 TestFixture::
template unique_test_value<0>(),
1829 TestFixture::
template unique_test_value<1>(),
1830 TestFixture::
template unique_test_value<2>(),
1831 TestFixture::
template unique_test_value<3>()
1834 constexpr auto low_value = TypeParam(sorted_test_values.begin(), sorted_test_values.begin() + 2UL);
1835 constexpr auto high_value = TypeParam(sorted_test_values.begin() + 2UL, sorted_test_values.begin() + 4UL);
1836 constexpr auto long_value = TypeParam(sorted_test_values.begin(), sorted_test_values.begin() + 3UL);
1837 constexpr auto low_value_copy = low_value;
1839 STATIC_ASSERT_TRUE(low_value < high_value);
1840 STATIC_ASSERT_TRUE(low_value < long_value);
1841 STATIC_ASSERT_FALSE(low_value < low_value_copy);
1842 STATIC_ASSERT_FALSE(high_value < low_value);
1843 STATIC_ASSERT_TRUE(high_value > low_value);
1844 STATIC_ASSERT_TRUE(long_value > low_value);
1845 STATIC_ASSERT_FALSE(low_value_copy > low_value);
1846 STATIC_ASSERT_FALSE(low_value > high_value);
1848 STATIC_ASSERT_TRUE(low_value <= high_value);
1849 STATIC_ASSERT_TRUE(low_value <= long_value);
1850 STATIC_ASSERT_TRUE(low_value <= low_value_copy);
1851 STATIC_ASSERT_FALSE(high_value <= low_value);
1852 STATIC_ASSERT_TRUE(high_value >= low_value);
1853 STATIC_ASSERT_TRUE(long_value >= low_value);
1854 STATIC_ASSERT_TRUE(low_value_copy >= low_value);
1855 STATIC_ASSERT_FALSE(low_value >= high_value);
1858template <
typename ValueType>
1860 using value_type = ValueType;
1872 auto get() -> value_type& {
return value_; }
1878 using value_type =
typename TypeParam::value_type;
1880 struct with_constructor_args {
1881 std::reference_wrapper<value_type
const> value;
1883 value_type& reference;
1884 move_only_wrapper<value_type> wrapper;
1886 with_constructor_args(value_type
const& val, value_type& ref, move_only_wrapper<value_type> wrap_arg)
1889 wrapper(std::move(wrap_arg)) {}
1892 typename TestFixture::
template standard_capacity_vector<with_constructor_args> vec;
1894 value_type
const value1 = TestFixture::test_value(0);
1895 value_type value2 = TestFixture::test_value(1);
1896 auto& result = vec.emplace_back(value1, value2, move_only_wrapper<value_type>(TestFixture::test_value(2)));
1898 ::testing::StaticAssertTypeEq<
decltype(result), with_constructor_args&>();
1899 EXPECT_EQ(vec.size(), 1);
1900 ASSERT_FALSE(vec.empty());
1901 EXPECT_EQ(std::addressof(result), std::addressof(vec[0]));
1903 EXPECT_EQ(result.value.get(), value1);
1904 EXPECT_EQ(std::addressof(result.reference), std::addressof(value2));
1905 EXPECT_EQ(result.wrapper.get(), TestFixture::test_value(2));
1908template <
typename Container,
typename... Args>
1911 res.emplace_back(std::forward<Args>(args)...);
1918 using value_type =
typename TypeParam::value_type;
1919 struct with_constructor_args {
1924 with_constructor_args() =
default;
1927 constexpr with_constructor_args(value_type&& fst, value_type&& snd, value_type&& trd)
1928 : first(std::move(fst)),
1929 second(std::move(snd)),
1930 third(std::move(trd)) {}
1933 constexpr auto vec =
1934 constexpr_emplace_back<
typename TestFixture::
template standard_capacity_vector<with_constructor_args>>(
1935 TestFixture::test_value(0),
1936 TestFixture::test_value(1),
1937 TestFixture::test_value(2)
1940 STATIC_ASSERT_EQ(vec.size(), 1);
1941 STATIC_ASSERT_EQ(vec[0].first, TestFixture::test_value(0));
1942 STATIC_ASSERT_EQ(vec[0].second, TestFixture::test_value(1));
1943 STATIC_ASSERT_EQ(vec[0].third, TestFixture::test_value(2));
1946template <
typename T>
1956 noexcept(TestFixture::construct().emplace_back(std::declval<
typename TypeParam::value_type&&>())),
1957 std::is_nothrow_move_constructible<
typename TypeParam::value_type>{}
1966 std::is_copy_constructible<
typename TypeParam::value_type>::value
1968 using value_type =
typename TypeParam::value_type;
1970 noexcept(TestFixture::construct().emplace_back(std::declval<value_type
const&>())),
1971 std::is_nothrow_copy_constructible<value_type>{}
1974 STATIC_ASSERT_FALSE(
1975 noexcept(
typename TestFixture::
template standard_capacity_vector<throws_without_nullptr<value_type>>{}
1976 .emplace_back(std::declval<value_type
const&>()))
1979 noexcept(
typename TestFixture::
template standard_capacity_vector<throws_without_nullptr<value_type>>{}
1980 .emplace_back(std::declval<value_type
const&>(),
nullptr))
1987 using value_type =
typename TypeParam::value_type;
1988 using const_it =
typename TypeParam::const_iterator;
1990 constexpr bool is_nothrow_movable =
1991 std::is_nothrow_move_constructible<value_type>{} && std::is_nothrow_move_assignable<value_type>{};
1994 noexcept(TestFixture::construct().emplace(std::declval<const_it>(), std::declval<value_type&&>())),
1998 using overload_test_vector =
1999 typename TestFixture::
template standard_capacity_vector<throws_without_nullptr<value_type>>;
2000 using overload_it =
typename overload_test_vector::const_iterator;
2001 STATIC_ASSERT_FALSE(
noexcept(overload_test_vector{}.emplace(std::declval<overload_it>(), std::declval<value_type>()))
2004 noexcept(overload_test_vector{}.emplace(std::declval<overload_it>(), std::declval<value_type>(),
nullptr))
2011 using value_type =
typename TypeParam::value_type;
2012 struct with_constructor_args {
2013 std::reference_wrapper<value_type
const> value;
2014 value_type* raw_pointer;
2015 move_only_wrapper<value_type> wrapper;
2017 with_constructor_args(value_type
const& val, value_type* rptr, move_only_wrapper<value_type> wrap_arg)
2020 wrapper(std::move(wrap_arg)) {}
2023 typename TestFixture::
template standard_capacity_vector<with_constructor_args> vec;
2024 auto const& const_vec1 = vec;
2025 value_type
const value1 = TestFixture::test_value(0);
2026 value_type value2 = TestFixture::test_value(1);
2027 auto pos = vec.emplace(
2030 std::addressof(value2),
2031 move_only_wrapper<value_type>(TestFixture::test_value(2))
2033 EXPECT_EQ(pos, vec.begin());
2034 EXPECT_EQ(vec.size(), 1);
2035 EXPECT_EQ(&*pos, std::addressof(vec[0]));
2037 EXPECT_EQ(pos->value.get(), value1);
2038 ASSERT_NE(pos->raw_pointer,
nullptr);
2039 EXPECT_EQ(pos->raw_pointer, std::addressof(value2));
2040 EXPECT_EQ(pos->wrapper.get(), TestFixture::test_value(2));
2043template <
typename Vec,
typename Arg>
2045 static_assert(std::is_rvalue_reference<Vec&&>::value,
"Only expected to be called with an r-value reference.");
2046 std::forward<Vec>(vec).emplace(std::forward<Vec>(vec).begin() + pos, std::forward<Arg>(arg));
2047 return std::forward<Vec>(vec);
2056 constexpr auto vec1 = TestFixture::test_vector(2);
2058 struct convertible_to_typeparam {
2060 constexpr operator
typename TypeParam::value_type()
noexcept {
return TestFixture::test_value(2); }
2063 constexpr TypeParam vec2 = constexpr_emplace(TestFixture::test_vector(2), 1, convertible_to_typeparam{});
2065 STATIC_ASSERT_EQ(vec2.size(), vec1.size() + 1);
2066 STATIC_ASSERT_EQ(vec2[0], vec1[0]);
2067 STATIC_ASSERT_EQ(vec2[1],
static_cast<
typename TypeParam::value_type>(convertible_to_typeparam{}));
2068 STATIC_ASSERT_EQ(vec2[2], vec1[1]);
2076 std::is_copy_constructible<
typename TypeParam::value_type>::value
2078 using value_type =
typename TypeParam::value_type;
2079 using const_it =
typename TypeParam::const_iterator;
2081 constexpr bool is_nothrow_movable =
2082 std::is_nothrow_move_constructible<value_type>{} && std::is_nothrow_move_assignable<value_type>{};
2085 noexcept(TestFixture::construct().emplace(std::declval<const_it>(), std::declval<value_type
const&>())),
2086 is_nothrow_movable && std::is_nothrow_copy_constructible<value_type>{}
2098 using value_type =
typename TypeParam::value_type;
2099 using const_it =
typename TypeParam::const_iterator;
2101 constexpr bool is_nothrow_movable =
2102 std::is_nothrow_move_constructible<value_type>{} && std::is_nothrow_move_assignable<value_type>{};
2105 noexcept(TestFixture::construct().emplace_back()),
2106 std::is_nothrow_default_constructible<value_type>{}
2109 noexcept(TestFixture::construct().emplace(std::declval<const_it>())),
2110 is_nothrow_movable && std::is_nothrow_default_constructible<value_type>{}
2117 auto vec = TestFixture::test_vector(TypeParam::capacity);
2119 ASSERT_DEATH(vec.emplace_back(TestFixture::test_value(0)),
"Precondition violation");
2125 auto value1 = TestFixture::full_test_vector();
2126 auto value2 = TestFixture::test_vector(TypeParam::capacity, TypeParam::capacity + TypeParam::capacity / 2UL);
2128 swap(value1, value2);
2130 EXPECT_EQ(value1, TestFixture::test_vector(TypeParam::capacity, TypeParam::capacity + TypeParam::capacity / 2UL));
2131 EXPECT_EQ(value2, TestFixture::full_test_vector());
2134template <
typename Vec>
2142 constexpr auto value1 = TestFixture::full_test_vector();
2143 constexpr auto value2 =
2144 TestFixture::test_vector(TypeParam::capacity, TypeParam::capacity + TypeParam::capacity / 2UL);
2146 constexpr auto vec_swapped = constexpr_swap(value1, value2);
2147 STATIC_ASSERT_EQ(vec_swapped.first, value2);
2148 STATIC_ASSERT_EQ(vec_swapped.second, value1);
2154 constexpr bool element_nothrow = ::arene::base::is_nothrow_swappable_v<
typename TypeParam::value_type> &&
2155 std::is_nothrow_move_constructible<
typename TypeParam::value_type>::value;
2157 STATIC_ASSERT_EQ(::arene::base::is_nothrow_swappable_v<TypeParam>, element_nothrow);
2158 STATIC_ASSERT_EQ(
noexcept(std::declval<TypeParam>().swap(std::declval<TypeParam&>())), element_nothrow);
2164 using value_type =
typename TypeParam::value_type;
2165 using iterator =
typename TypeParam::const_iterator;
2167 constexpr bool is_nothrow_movable =
2168 std::is_nothrow_move_constructible<value_type>{} && std::is_nothrow_move_assignable<value_type>{};
2171 noexcept(TypeParam{}.insert(std::declval<iterator>(), std::declval<value_type&&>())),
2179 using value_type =
typename TypeParam::value_type;
2180 using iterator =
typename TypeParam::const_iterator;
2182 constexpr bool is_nothrow_movable =
2183 std::is_nothrow_move_constructible<value_type>{} && std::is_nothrow_move_assignable<value_type>{};
2186 noexcept(TypeParam{}.insert(std::declval<iterator>(), std::declval<value_type
const&>())),
2187 is_nothrow_movable && std::is_nothrow_copy_constructible<value_type>::value
2194 using value_type =
typename TypeParam::value_type;
2195 using iterator =
typename TypeParam::const_iterator;
2197 constexpr bool is_nothrow_movable =
2198 std::is_nothrow_move_constructible<value_type>{} && std::is_nothrow_move_assignable<value_type>{};
2201 noexcept(TypeParam{}.insert(std::declval<iterator>(), 0U, std::declval<value_type&&>())),
2202 is_nothrow_movable && std::is_nothrow_copy_constructible<value_type>{}
2205 noexcept(TypeParam{}.insert(std::declval<iterator>(), 0U, std::declval<value_type
const&>())),
2206 is_nothrow_movable && std::is_nothrow_copy_constructible<value_type>{}
2213 auto value = TestFixture::test_vector(TypeParam::capacity - 1UL);
2214 ASSERT_DEATH(value.insert(value.begin(), 2UL, TestFixture::test_value(5)),
"Precondition violation");
2224 auto const value1 = TestFixture::test_value(0);
2225 auto const value2 = TestFixture::test_value(1);
2226 auto const value3 = TestFixture::test_value(2);
2227 TypeParam vec{value1, value2};
2228 constexpr std::size_t insert_count = 5;
2230 vec.insert(vec.end(), insert_count, value3);
2231 EXPECT_EQ(vec.size(), insert_count + 2);
2232 EXPECT_EQ(vec[0], value1);
2233 EXPECT_EQ(vec[1], value2);
2234 for (std::size_t i = 0; i < insert_count; ++i) {
2235 EXPECT_EQ(vec[i + 2], value3);
2247 auto const value1 = TestFixture::test_value(0);
2248 auto const value2 = TestFixture::test_value(1);
2249 auto const value3 = TestFixture::test_value(2);
2250 auto const value4 = TestFixture::test_value(3);
2251 auto const value_inserted = TestFixture::test_value(4);
2252 TypeParam vec{value1, value2, value3, value4};
2253 constexpr std::size_t insert_count = 3;
2255 vec.insert(vec.begin() + 1, insert_count, value_inserted);
2256 EXPECT_EQ(vec.size(), insert_count + 4);
2257 EXPECT_EQ(vec[0], value1);
2258 for (std::size_t i = 0; i < insert_count; ++i) {
2259 EXPECT_EQ(vec[i + 1], value_inserted);
2261 EXPECT_EQ(vec[insert_count + 1], value2);
2262 EXPECT_EQ(vec[insert_count + 2], value3);
2263 EXPECT_EQ(vec[insert_count + 3], value4);
2270 auto vec1 = TestFixture::test_vector(4);
2271 auto vec2 = TestFixture::test_vector(4, 11);
2272 auto const vec2_expected = TestFixture::test_vector(4, 11);
2274 vec1.insert(vec1.begin() + 1, std::make_move_iterator(vec2.begin()), std::make_move_iterator(vec2.end()));
2275 EXPECT_EQ(vec1.size(), vec2.size() + 4);
2276 EXPECT_EQ(vec1[0], TestFixture::test_value(0));
2277 for (std::size_t idx = 0; idx < vec2.size(); ++idx) {
2278 EXPECT_EQ(vec1[idx + 1], vec2_expected[idx]);
2280 EXPECT_EQ(vec1[vec2_expected.size() + 1], TestFixture::test_value(1));
2281 EXPECT_EQ(vec1[vec2_expected.size() + 2], TestFixture::test_value(2));
2282 EXPECT_EQ(vec1[vec2_expected.size() + 3], TestFixture::test_value(3));
2288 using value_type =
typename TypeParam::value_type;
2289 using ivec_iter =
typename TypeParam::const_iterator;
2290 using source_array = ::arene::base::array<value_type, TypeParam::capacity>;
2291 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
2292 using throw_conv_array = ::arene::base::array<throws_when_converted, TypeParam::capacity>;
2293 using throwing_it_throwing_type =
typename TestFixture::
template throwing_input_iterator<throws_when_converted>;
2294 using throwing_it_raw_type =
typename TestFixture::
template throwing_input_iterator<value_type>;
2295 using nothrow_it_throwing_type =
typename TestFixture::
template non_throwing_input_iterator<throws_when_converted>;
2296 using nothrow_it_raw_type =
typename TestFixture::
template non_throwing_input_iterator<value_type>;
2298 constexpr bool is_nothrow_movable =
2299 std::is_nothrow_move_constructible<value_type>{} && std::is_nothrow_move_assignable<value_type>{};
2302 noexcept(
this->construct().insert(
2303 std::declval<ivec_iter>(),
2304 std::declval<
typename source_array::const_iterator>(),
2305 std::declval<
typename source_array::const_iterator>()
2307 is_nothrow_movable && std::is_nothrow_copy_constructible<value_type>{}
2310 STATIC_ASSERT_FALSE(
noexcept(
this->construct().insert(
2311 std::declval<ivec_iter>(),
2312 std::declval<
typename throw_conv_array::const_iterator>(),
2313 std::declval<
typename throw_conv_array::const_iterator>()
2317 noexcept(
this->construct().insert(
2318 std::declval<ivec_iter>(),
2319 std::declval<nothrow_it_raw_type>(),
2320 std::declval<nothrow_it_raw_type>()
2322 is_nothrow_movable && std::is_nothrow_copy_constructible<value_type>{}
2324 STATIC_ASSERT_FALSE(
noexcept(
this->construct().insert(
2325 std::declval<ivec_iter>(),
2326 std::declval<::testing::demoted_iterator<throwing_it_throwing_type, std::input_iterator_tag>>(),
2327 std::declval<::testing::demoted_iterator<throwing_it_throwing_type, std::input_iterator_tag>>()
2329 STATIC_ASSERT_FALSE(
noexcept(
this->construct().insert(
2330 std::declval<ivec_iter>(),
2331 std::declval<throwing_it_throwing_type>(),
2332 std::declval<throwing_it_throwing_type>()
2334 STATIC_ASSERT_FALSE(
noexcept(
this->construct().insert(
2335 std::declval<ivec_iter>(),
2336 std::declval<throwing_it_raw_type>(),
2337 std::declval<throwing_it_raw_type>()
2339 STATIC_ASSERT_FALSE(
noexcept(
this->construct().insert(
2340 std::declval<ivec_iter>(),
2341 std::declval<nothrow_it_throwing_type>(),
2342 std::declval<nothrow_it_throwing_type>()
2348 auto const value1 = TestFixture::full_test_vector();
2350 ASSERT_EQ(value1.cbegin(), value1.begin());
2351 ASSERT_EQ(value1.cend(), value1.end());
2353 ::testing::StaticAssertTypeEq<
decltype(value1.cbegin()),
typename TypeParam::const_iterator>();
2354 STATIC_ASSERT_TRUE(
noexcept(value1.cbegin()));
2355 STATIC_ASSERT_TRUE(
noexcept(value1.cend()));
2357 auto value2 = TestFixture::full_test_vector();
2358 ::testing::StaticAssertTypeEq<
decltype(value2.cbegin()),
typename TypeParam::const_iterator>();
2359 ::testing::StaticAssertTypeEq<
decltype(value2.cend()),
typename TypeParam::const_iterator>();
2361 EXPECT_EQ(value2.begin(), value2.cbegin());
2362 EXPECT_EQ(value2.end(), value2.cend());
2369 auto const value1 = TestFixture::full_test_vector();
2371 auto itr = value1.rbegin();
2372 auto citr = value1.crbegin();
2373 for (std::size_t steps = 0UL; steps < value1.size(); ++steps) {
2374 ASSERT_NE(itr, value1.rend());
2375 ASSERT_NE(citr, value1.crend());
2377 EXPECT_EQ(*itr, value1[value1.size() - steps - 1UL]);
2378 EXPECT_EQ(*citr, value1[value1.size() - steps - 1UL]);
2383 EXPECT_EQ(itr, value1.rend());
2384 EXPECT_EQ(citr, value1.crend());
2392 InlineVectorTest<TypeParam>::constexpr_compatible&&
2395 constexpr std::size_t larger_capacity = TypeParam::capacity + 2UL;
2396 constexpr typename TestFixture::
template vector_with_capacity<larger_capacity> large_vector{
2397 TestFixture::
template test_initializer_list<TypeParam::capacity - 1UL>()
2400 constexpr TypeParam small_vector(large_vector);
2402 STATIC_ASSERT_EQ(small_vector.size(), large_vector.size());
2403 STATIC_ASSERT_TRUE(equal(small_vector.begin(), small_vector.end(), large_vector.begin(), large_vector.end()));
2409 constexpr std::size_t larger_capacity = TypeParam::capacity + 2UL;
2410 typename TestFixture::
template vector_with_capacity<larger_capacity>
const large_vector{
2411 TestFixture::
template test_initializer_list<TypeParam::capacity - 1UL>()
2414 TypeParam small_vector;
2415 small_vector = large_vector;
2417 EXPECT_EQ(small_vector.size(), large_vector.size());
2418 for (std::size_t i = 0; i < small_vector.size(); ++i) {
2419 EXPECT_EQ(small_vector[i], large_vector[i]);
2425 STATIC_ASSERT_TRUE(std::is_same<
decltype(TypeParam::try_construct()), ::arene::base::optional<TypeParam>>::value);
2426 STATIC_ASSERT_TRUE(
noexcept(TypeParam::try_construct()));
2428 COND_STATIC_ASSERT_TRUE(TypeParam::try_construct().has_value());
2429 COND_STATIC_ASSERT_TRUE(TypeParam::try_construct()->empty());
2438 STATIC_ASSERT_TRUE(std::is_same<
decltype(TypeParam::try_construct(0)), ::arene::base::optional<TypeParam>>::value);
2440 noexcept(TypeParam::try_construct(0)),
2441 std::is_nothrow_default_constructible<
typename TypeParam::value_type>::value
2444 COND_STATIC_ASSERT_TRUE(TypeParam::try_construct(TypeParam::capacity).has_value());
2445 COND_STATIC_ASSERT_FALSE(TypeParam::try_construct(TypeParam::capacity)->empty());
2446 COND_STATIC_ASSERT_EQ(TypeParam::try_construct(TypeParam::capacity)->size(), TypeParam::capacity);
2456 constexpr std::size_t size1 = TypeParam::capacity + 1UL;
2457 STATIC_ASSERT_TRUE(std::is_same<
decltype(TypeParam::try_construct(size1)), ::arene::base::optional<TypeParam>>::value
2460 noexcept(TypeParam::try_construct(size1)),
2461 std::is_nothrow_default_constructible<
typename TypeParam::value_type>::value
2464 COND_STATIC_ASSERT_FALSE(TypeParam::try_construct(size1).has_value());
2470 constexpr bool can_construct_with_size_only =
2471 ::arene::base::substitution_succeeds<TestFixture::
template try_construct_result, TypeParam, std::size_t>;
2472 STATIC_ASSERT_EQ(can_construct_with_size_only, std::is_default_constructible<
typename TypeParam::value_type>{});
2479 (std::is_constructible<TypeParam, std::size_t>::value),
2480 std::is_default_constructible<
typename TypeParam::value_type>{}
2487 STATIC_ASSERT_TRUE(
noexcept(TypeParam::try_construct()));
2488 STATIC_ASSERT_TRUE(
noexcept(TypeParam{}));
2490 COND_STATIC_ASSERT_TRUE(TypeParam::try_construct().has_value());
2491 COND_STATIC_ASSERT_TRUE(TypeParam::try_construct()->empty());
2492 COND_STATIC_ASSERT_TRUE(TypeParam().empty());
2502 STATIC_ASSERT_TRUE(std::is_same<
decltype(TypeParam::try_construct(0)), ::arene::base::optional<TypeParam>>::value);
2504 noexcept(TypeParam::try_construct(0)),
2505 std::is_nothrow_default_constructible<
typename TypeParam::value_type>{}
2516 STATIC_ASSERT_EQ(
noexcept(TypeParam(0)), std::is_nothrow_default_constructible<
typename TypeParam::value_type>{});
2522 InlineVectorDeathTest,
2526 constexpr std::size_t size1 = TypeParam::capacity + 1UL;
2527 ASSERT_DEATH(
this->construct(size1),
"Precondition violation");
2533 using value_type =
typename TypeParam::value_type;
2534 constexpr bool copy_ok = std::is_copy_constructible<value_type>::value;
2535 STATIC_ASSERT_EQ((std::is_constructible<TypeParam, std::size_t, value_type>::value), copy_ok);
2538 substitution_succeeds<TestFixture::
template try_construct_result, TypeParam, std::size_t, value_type>),
2547 (std::is_constructible<TypeParam, std::initializer_list<
typename TypeParam::value_type>>::value),
2548 std::is_copy_constructible<
typename TypeParam::value_type>::value
2551 (arene::base::substitution_succeeds<
2552 TestFixture::
template try_construct_result,
2554 std::initializer_list<
typename TypeParam::value_type>>),
2555 std::is_copy_constructible<
typename TypeParam::value_type>::value
2564 std::is_copy_constructible<
typename TypeParam::value_type>::value
2566 auto const values = TestFixture::full_test_initializer_list();
2569 noexcept(TypeParam::try_construct(values)),
2570 std::is_nothrow_copy_constructible<
typename TypeParam::value_type>{}
2572 ASSERT_TRUE(TypeParam::try_construct(values).has_value());
2573 ASSERT_EQ(TypeParam::try_construct(values)->size(), values.size());
2575 auto res = TypeParam::try_construct(values);
2576 EXPECT_THAT(*res, ::testing::ElementsAreArray(values));
2584 std::is_copy_constructible<
typename TypeParam::value_type>::value
2586 auto const values = TestFixture::
template test_initializer_list<TypeParam::capacity + 1UL>();
2588 ASSERT_FALSE(TypeParam::try_construct(values).has_value());
2595 std::is_copy_constructible<
typename TypeParam::value_type>::value
2597 using value_type =
typename TypeParam::value_type;
2598 auto const values = TestFixture::full_test_vector();
2600 STATIC_ASSERT_TRUE(::arene::base::substitution_succeeds<
2601 TestFixture::
template try_construct_result,
2604 STATIC_ASSERT_EQ(
noexcept(TypeParam::try_construct(values)), std::is_nothrow_copy_constructible<value_type>::value);
2605 auto res = TypeParam::try_construct(values);
2606 ASSERT_TRUE(res.has_value());
2607 EXPECT_THAT(*res, ::testing::ElementsAreArray(values));
2614 std::is_copy_constructible<
typename TypeParam::value_type>::value
2616 auto const values = TestFixture::full_test_vector();
2618 STATIC_ASSERT_EQ(
noexcept(TypeParam(values)), std::is_nothrow_copy_constructible<
typename TypeParam::value_type>{});
2619 auto res =
this->construct(values);
2620 EXPECT_THAT(res, ::testing::ElementsAreArray(values));
2628 std::is_copy_constructible<
typename TypeParam::value_type>::value
2634 auto const values = ::arene::base::testing::test_vector<
typename TypeParam::value_type, TypeParam::capacity - 1>(
2636 TypeParam::capacity - 1
2639 STATIC_ASSERT_TRUE(::arene::base::substitution_succeeds<
2640 TestFixture::
template try_construct_result,
2644 noexcept(TypeParam::try_construct(values)),
2645 std::is_nothrow_copy_constructible<
typename TypeParam::value_type>::value
2649 "-Wmaybe-uninitialized",
2650 "GCC issues false positive here when compiling with -fno-exceptions and using GCC's stdlib"
2652 auto res = TypeParam::try_construct(values);
2654 ASSERT_TRUE(res.has_value());
2655 EXPECT_THAT(*res, ::testing::ElementsAreArray(values));
2663 std::is_copy_constructible<
typename TypeParam::value_type>::value
2665 static typename TestFixture::
template vector_with_capacity<TypeParam::capacity - 1>
const values{
2666 TestFixture::test_vector(TypeParam::capacity - 1)
2669 STATIC_ASSERT_EQ(
noexcept(TypeParam(values)), std::is_nothrow_copy_constructible<
typename TypeParam::value_type>{});
2670 auto res =
this->construct(values);
2671 EXPECT_THAT(res, ::testing::ElementsAreArray(values));
2680 std::is_copy_constructible<
typename TypeParam::value_type>::value
2682 auto const values = ::arene::base::testing::test_vector<
typename TypeParam::value_type, TypeParam::capacity + 1>(
2687 STATIC_ASSERT_TRUE(::arene::base::substitution_succeeds<
2688 TestFixture::
template try_construct_result,
2692 noexcept(TypeParam::try_construct(values)),
2693 std::is_nothrow_copy_constructible<
typename TypeParam::value_type>::value
2695 auto res = TypeParam::try_construct(values);
2696 ASSERT_TRUE(res.has_value());
2697 EXPECT_THAT(*res, ::testing::ElementsAreArray(values));
2705 std::is_copy_constructible<
typename TypeParam::value_type>::value
2707 auto const values = ::arene::base::testing::test_vector<
typename TypeParam::value_type, TypeParam::capacity + 1>(
2709 TypeParam::capacity + 1
2712 ASSERT_GT(values.size(), TypeParam::capacity);
2713 ASSERT_FALSE(TypeParam::try_construct(values).has_value());
2721 std::is_copy_constructible<
typename TypeParam::value_type>::value
2723 auto const values = ::arene::base::testing::test_vector<
typename TypeParam::value_type, TypeParam::capacity + 1>(
2727 constexpr bool copy_is_noexcept = std::is_nothrow_copy_constructible<
typename TypeParam::value_type>::value;
2729 STATIC_ASSERT_EQ(
noexcept(TypeParam(values)), copy_is_noexcept);
2730 auto res =
this->construct(values);
2731 EXPECT_THAT(res, ::testing::ElementsAreArray(values));
2736 using smaller_vec =
typename TestFixture::
template vector_with_capacity<TypeParam::capacity - 1>;
2737 using larger_vec =
typename TestFixture::
template vector_with_capacity<TypeParam::capacity + 1>;
2738 constexpr bool copy_ok = std::is_copy_constructible<
typename TypeParam::value_type>::value;
2740 STATIC_ASSERT_EQ((std::is_constructible<TypeParam, TypeParam
const&>::value), copy_ok);
2742 (::arene::base::substitution_succeeds<TestFixture::
template try_construct_result, TypeParam, TypeParam
const&>),
2745 STATIC_ASSERT_EQ((std::is_constructible<TypeParam, smaller_vec
const&>::value), copy_ok);
2747 (::arene::base::substitution_succeeds<TestFixture::
template try_construct_result, TypeParam, smaller_vec
const&>),
2750 STATIC_ASSERT_EQ((std::is_constructible<TypeParam, larger_vec
const&>::value), copy_ok);
2752 (::arene::base::substitution_succeeds<TestFixture::
template try_construct_result, TypeParam, larger_vec
const&>),
2760 auto const values = TestFixture::full_test_vector();
2761 auto values_copy = TestFixture::full_test_vector();
2763 STATIC_ASSERT_TRUE(::arene::base::
2764 substitution_succeeds<TestFixture::
template try_construct_result, TypeParam, TypeParam&&>);
2766 noexcept(TypeParam::try_construct(std::move(values_copy))),
2767 std::is_nothrow_move_constructible<
typename TypeParam::value_type>::value
2769 auto res = TypeParam::try_construct(std::move(values_copy));
2770 ASSERT_TRUE(res.has_value());
2771 EXPECT_TRUE(elements_are_array(*res, values));
2777 auto const values = TestFixture::full_test_vector();
2778 auto source = TestFixture::full_test_vector();
2782 noexcept(TypeParam(std::move(source))),
2783 std::is_nothrow_move_constructible<
typename TypeParam::value_type>::value
2786 auto res =
this->construct(std::move(source));
2787 EXPECT_TRUE(elements_are_array(res, values));
2793 auto values = ::arene::base::testing::test_vector<
typename TypeParam::value_type, TypeParam::capacity + 1>(
2795 TypeParam::capacity + 1
2798 ASSERT_GT(values.size(), TypeParam::capacity);
2800 ASSERT_FALSE(TypeParam::try_construct(std::move(values)).has_value());
2805 using ivec =
typename TestFixture::
template vector_with_capacity<TypeParam::capacity>;
2806 using smaller_vec =
typename TestFixture::
template vector_with_capacity<TypeParam::capacity - 1>;
2807 using larger_vec =
typename TestFixture::
template vector_with_capacity<TypeParam::capacity + 1>;
2808 constexpr bool move_ok = std::is_move_constructible<
typename TypeParam::value_type>::value;
2810 STATIC_ASSERT_EQ((std::is_constructible<ivec, ivec&&>::value), move_ok);
2812 (::arene::base::substitution_succeeds<TestFixture::
template try_construct_result, ivec, ivec&&>),
2815 STATIC_ASSERT_EQ((std::is_constructible<ivec, smaller_vec&&>::value), move_ok);
2817 (::arene::base::substitution_succeeds<TestFixture::
template try_construct_result, ivec, smaller_vec&&>),
2820 STATIC_ASSERT_EQ((std::is_constructible<ivec, larger_vec&&>::value), move_ok);
2822 (::arene::base::substitution_succeeds<TestFixture::
template try_construct_result, ivec, larger_vec&&>),
2830 auto const expected = TestFixture::full_test_vector();
2831 auto source = TestFixture::full_test_vector();
2834 TypeParam::try_construct(std::make_move_iterator(source.begin()), std::make_move_iterator(source.end()));
2835 ASSERT_TRUE(maybe_vec.has_value());
2837 ASSERT_EQ(maybe_vec->size(), source.size());
2838 ASSERT_TRUE(elements_are_array(*maybe_vec, expected));
2847 std::is_copy_constructible<
typename TypeParam::value_type>::value
2849 using array = ::arene::base::array<
typename TypeParam::value_type, TypeParam::capacity>;
2850 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
2851 using convertible_array = ::arene::base::array<throws_when_converted, TypeParam::capacity>;
2852 using throwing_bidirectional_iterator =
typename TestFixture::throwing_bidirectional_move_iterator_of_t;
2855 noexcept(TypeParam::try_construct(
2856 std::declval<
typename array::const_iterator>(),
2857 std::declval<
typename array::const_iterator>()
2859 std::is_nothrow_copy_constructible<
typename TypeParam::value_type>::value
2861 STATIC_ASSERT_FALSE(
noexcept(TypeParam::try_construct(
2862 std::declval<
typename convertible_array::const_iterator>(),
2863 std::declval<
typename convertible_array::const_iterator>()
2865 STATIC_ASSERT_FALSE(
noexcept(TypeParam::try_construct(
2866 std::declval<throwing_bidirectional_iterator>(),
2867 std::declval<throwing_bidirectional_iterator>()
2876 std::is_copy_constructible<
typename TypeParam::value_type>::value
2878 using value_type =
typename TypeParam::value_type;
2879 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
2880 using throwing_it_throwing_type =
typename TestFixture::
template throwing_input_iterator<throws_when_converted>;
2881 using throwing_it_raw_type =
typename TestFixture::
template throwing_input_iterator<value_type>;
2882 using nothrow_it_throwing_type =
typename TestFixture::
template non_throwing_input_iterator<throws_when_converted>;
2883 using nothrow_it_raw_type =
typename TestFixture::
template non_throwing_input_iterator<value_type>;
2886 noexcept(TypeParam::try_construct(
2887 std::declval<::testing::demoted_iterator<value_type*, std::input_iterator_tag>>(),
2888 std::declval<::testing::demoted_iterator<value_type*, std::input_iterator_tag>>()
2890 std::is_nothrow_copy_constructible<value_type>::value
2892 STATIC_ASSERT_FALSE(
noexcept(
2893 TypeParam::try_construct(std::declval<throwing_it_throwing_type>(), std::declval<throwing_it_throwing_type>())
2895 STATIC_ASSERT_FALSE(
2896 noexcept(TypeParam::try_construct(std::declval<throwing_it_raw_type>(), std::declval<throwing_it_raw_type>()))
2899 noexcept(TypeParam::try_construct(std::declval<nothrow_it_raw_type>(), std::declval<nothrow_it_raw_type>())),
2900 std::is_nothrow_copy_constructible<value_type>::value
2902 STATIC_ASSERT_FALSE(
noexcept(
2903 TypeParam::try_construct(std::declval<nothrow_it_throwing_type>(), std::declval<nothrow_it_throwing_type>())
2910 ASSERT_DEATH(*
typename TypeParam::iterator{},
"Precondition violation");
2911 ASSERT_DEATH(*
typename TypeParam::const_iterator{},
"Precondition violation");
2917 ASSERT_DEATH(
typename TypeParam::iterator{} + 1,
"Precondition violation");
2918 ASSERT_DEATH(
typename TypeParam::const_iterator{} + 1,
"Precondition violation");
3073 InlineVectorDeathTest,
The Death Tests use the same fixture as the "normal" tests. Inherits so that it will be a distinct ty...
Definition vector.hpp:344
Test fixture for all type-parameterized inline_vector tests.
Definition vector.hpp:159
static constexpr auto test_vector(std::size_t begin, std::size_t end) noexcept(noexcept(::arene::base::testing::test_vector< T, capacity >(begin, end))) -> Vector
Return a Vector containing the test values [begin,end) of T , parameterized by test suite users.
Definition vector.hpp:299
static constexpr bool constexpr_compatible
Whether or not the current type parameter is constexpr compatible for this test.
Definition vector.hpp:164
static constexpr std::size_t capacity
The base capacity to use for most inline_vector instantiations in the parameterized tests.
Definition vector.hpp:172
static constexpr auto full_test_initializer_list() noexcept -> std::initializer_list< T >
Return a std::initializer_list containing capacity user-parameterized test_value s.
Definition vector.hpp:336
static void SetUpTestSuite()
Definition vector.hpp:176
static constexpr auto test_initializer_list(std::index_sequence< Indices... >) noexcept -> std::initializer_list< T >
Return a std::initializer_list containing user-parameterized test_value s.
Definition vector.hpp:322
static constexpr auto unique_test_value() noexcept(noexcept(::arene::base::testing::unique_test_value< T, N >())) -> N >())
Return the N 'th test value of the current T , parameterized by test suite users.
Definition vector.hpp:290
static constexpr auto full_test_vector() noexcept(noexcept(test_vector(capacity))) -> Vector
Return a Vector containing the test values [0,capacity) of T , parameterized by test suite users.
Definition vector.hpp:314
static constexpr auto test_initializer_list() noexcept -> std::initializer_list< T >
Return a std::initializer_list containing user-parameterized test_value s.
Definition vector.hpp:330
static constexpr auto test_value(std::size_t idx) noexcept(noexcept(::arene::base::testing::test_value< T >(idx))) ->
Return the idx 'th test value of the current T , parameterized by test suite users.
Definition vector.hpp:280
static constexpr auto test_vector(std::size_t size) noexcept(noexcept(test_vector(0, size))) -> Vector
Return a Vector containing the test values [0,size) of T , parameterized by test suite users.
Definition vector.hpp:308
static constexpr auto construct(U &&... params) noexcept(noexcept(Vector(std::forward< U >(params)...))) -> Vector
Construct a Vector from the passed parameters; allows calling as this->construct, which can be shorte...
Definition vector.hpp:273
Definition vector.hpp:1859
auto operator=(move_only_wrapper &&) -> move_only_wrapper &=default
move_only_wrapper(value_type value)
Definition vector.hpp:1864
move_only_wrapper(move_only_wrapper &&)=default
~move_only_wrapper()=default
auto get() -> value_type &
Definition vector.hpp:1872
move_only_wrapper(move_only_wrapper const &)=delete
auto operator=(move_only_wrapper const &) -> move_only_wrapper &=delete
Definition customization.hpp:36
constexpr auto sort_helper(Container container) noexcept -> Container
sorts the container and then returns it
Definition vector.hpp:130
constexpr auto constexpr_resize(Vec vec, std::size_t size) -> Vec
Definition external_vector.hpp:1068
constexpr auto constexpr_emplace_back(Args &&... args) -> Container
Definition vector.hpp:1909
constexpr auto vector_push_back(Vector &vec, Values &&... values) -> void
Push back multiple values into a vector.
Definition vector.hpp:117
constexpr auto elements_are_array(Range1 const &range, Range2 const &values) -> bool
Check if all element of range are equal to the elements in values.
Definition vector.hpp:91
constexpr auto all_elements_are(Range const &range, T const &value) -> bool
Check if all element of range are equal to value.
Definition vector.hpp:78
constexpr auto constexpr_non_const_front(Vec &&vec) -> typename Vec::value_type
Definition vector.hpp:687
TYPED_TEST_SUITE_P(InlineVectorDeathTest)
constexpr auto constexpr_pop_back(Vec &&vec) -> Vec
Definition vector.hpp:1116
REGISTER_TYPED_TEST_SUITE_P(InlineVectorTest, CanConstructAnEmptyVector, CapacityIsAsSpecified, CapacityIsNoexcept, InitialSizeIsZero, SizeIsConstexpr, SizeIsNoexcept, CanPushBackAValue, AfterPushBackCanGetLastElement, AfterPushBackVectorIsNotEmpty, SecondPushBackChangesLastValue, PushBackIsConditionallyNoexceptRvalue, PushBackIsConditionallyNoexceptLvalue, EmptyIsConstexpr, EmptyIsNoexcept, RetrievingAValueWithAtThrowsOnEmpty, RetrievingAValueWithAtReturnsValueAfterPushBack, AtReturnsReference, AtOnConstVectorReturnsConstReference, CanAccessMultipleValuesWithAt, AtIndexSizeOrLargerThrows, CanAccessMultipleValuesWithAtWithConstVec, AtIndexSizeOrLargerThrowsWithConstVec, MaxSizeEqualsCapacity, ZeroSizeVectorIsEmpty, BackReturnsReference, ConstBackReturnsConstReference, BackIsNoexcept, CanPushBack, CanConstructFromInitializerList, CanConstructFromInitializerListConstexpr, CanUseBack, CanGetFront, Front, CanGetIterator, CanIterateOverValues, CanIterateOverConstValues, IteratorTypedefs, Typedefs, Iteration, ConstIteration, CanEraseAtBeginning, CanEraseInMiddle, CanErase, CanEraseRange, CanConstructWithSize, CanConstructWithSizeAndValue, CopyingVectorCopiesElements, MovingVectorMovesElements, CopyAssignOverSmallerVectorCopiesElements, CopyAssignOverLargerVectorDestroysExcess, CopyingIsConditionallyDefined, MoveAssignOverSmallerVectorMovesElements, MoveAssignOverLargerVectorDestroysExcess, MovingIsConditionallyDefined, CanPopBack, PopBackIsNoexcept, PopBackIsUsable, EraseIsNoexceptIfTypeHasNoexceptMove, CanInsertInEmptyVector, CanInsertAtEndOfExistingVector, CanInsertInMiddleOfExistingVector, ResizeZeroCapacityVecToZeroIsOk, ResizeNonZeroCapacityVecToZeroIsOk, ResizeNonZeroCapacityVecToOtherIsOk, ResizeIsConditionallyNoexcept, ResizeWithValueIsConditionallyNoexcept, ResizingFromLargeToSmallLeavesElements, ResizingFromSmallToLargeConstructsElementsAsCopiesOfSpecified, CanInitializeWithSizeAndValue, CanInsert, CanConstructFromIteratorRange, IteratorRangeConstructionIsConditionallyNoexcept, InputIteratorRangeConstructionIsConditionallyNoexcept, CanConstructFromIteratorRangeConstexpr, CopyAssignOverSmallerVectorFromInitListCopiesElements, CopyAssignOverLargerVectorFromInitListDestroysExcess, CanAssignFromIteratorRange, IteratorRangeAssignmentIsConditionallyNoexcept, CanAssignFromInputIteratorRange, InputIteratorRangeAssignmentIsConditionallyNoexcept, CanAssignFromInitListUsingAssignFunction, AssignFromInitListUsingAssignFunctionIsConditionallyNoexcept, CanAssignFromSizeAndValue, AssignFromSizeAndValueIsConditionallyNoexcept, IndexOperatorReturnsReference, IndexOperatorOnConstVectorReturnsConstReference, CanAccessMultipleValuesWithIndexOperator, IndexOperatorIsNoexcept, IndexOperatorOnConstVectorIsNoexcept, IndexOperator, Data, AfterClearVectorIsEmpty, ClearWorks, CanCompareForEquality, CanCompareForOrdering, CanEmplaceBack, CanEmplaceBackConstexpr, EmplaceBackIsConditionallyNoexceptRvalue, EmplaceBackIsConditionallyNoexceptLvalue, EmplaceInsert, CanEmplace, EmplaceAtPositionIsConditionallyNoexceptRvalue, EmplaceAtPositionIsConditionallyNoexceptLvalue, DefaultEmplaceIsConditionallyNoexcept, ADLSwapSwapsContentsForBasicTypes, CanSwap, SwapNoexceptMatchesElementType, InsertRvalueIsConditionallyNoexcept, InsertLvalueIsConditionallyNoexcept, InsertWithCountIsConditionallyNoexcept, InsertNAtEndInsertsElements, InsertNInMiddleInsertsElements, InsertFromIteratorRangeInMiddle, InsertFromIteratorRangeIsConditionallyNoexcept, CanGetCBeginAndEnd, ReverseIteration, CanConstructFromBiggerCapacityVector, CanAssignFromBiggerCapacityVector, CanDefaultConstructViaTryConstruct, CanConstructWithSizeViaTryConstruct, ConstructWithExcessiveSizeViaTryConstructFails, CannotTryConstructWithSizeForANonDefaultConstructibleType, CannotConstructWithSizeForANonDefaultConstructibleType, DefaultTryConstructNoexceptEvenIfDefaultConstructorNotNoexcept, ConstructWithSizeViaTryConstructNotNoexceptIfDefaultConstructorNotNoexcept, ConstructWithSizeViaNormalConstructWithDefaultConstructorNotNoexceptIsNotNoexcept, NotConstructibleWithSizeAndSourceIfDataNotCopyable, NotConstructibleFromInitializerListIfDataTypeNotCopyConstructible, CanTryConstructFromInitializerList, TryConstructFromTooLargeInitializerListReturnsEmpty, CanCopyViaTryConstruct, CanCopyViaConstruct, CanCopyViaTryConstructFromSmaller, CanCopyViaConstructFromSmaller, CanCopyViaTryConstructFromLargerWithFewerElements, FailToCopyViaTryConstructFromLargerWithMoreElements, CanCopyViaConstructFromLargerWithFewerElements, NotCopyConstructibleIfDataTypeNotCopyConstructible, CanMoveViaTryConstruct, CanMoveViaConstruct, FailToMoveViaTryConstructFromLargerWithMoreElements, NotMoveConstructibleIfDataTypeNotMoveConstructible, CanTryConstructFromIteratorRange, IteratorRangeTryConstructionIsConditionallyNoexcept, InputIteratorRangeTryConstructionIsConditionallyNoexcept)
constexpr auto constexpr_insert(Vec &&vec, std::ptrdiff_t offset, T &&value) -> Vec
Definition vector.hpp:1368
constexpr auto constexpr_non_const_back(Vec &&vec) -> typename Vec::value_type
Definition vector.hpp:657
constexpr auto constexpr_erase(std::size_t index, Args &&... args) -> Vec
Definition vector.hpp:848
constexpr auto test_vector(std::size_t begin, std::size_t end) noexcept(std::is_nothrow_copy_constructible< T >::value) -> ::arene::base::inline_vector< T, Capacity >
Create a test vector containing a range of test values.
Definition vector.hpp:102
constexpr auto constexpr_emplace(Vec &&vec, std::ptrdiff_t pos, Arg &&arg) -> Vec
Definition vector.hpp:2044
constexpr auto erase_front(Vec &&vec, std::size_t count)
Definition vector.hpp:1800
ARENE_IGNORE_ALL("-Wfloat-equal", "These tests don't perform arithmetic, so equality is OK even for floating point")
MATCHER_P(elements_match_function, function, "")
Definition external_vector.hpp:936
constexpr auto is_copyable_v
True if a type is copy constructible and copy assignable, false otherwise.
Definition vector.hpp:150
constexpr auto constexpr_clear(Vec vec) -> Vec
Definition vector.hpp:1756
CONDITIONAL_TYPED_TEST_P(InlineVectorTest, CanConstructFromInitializerListConstexpr, InlineVectorTest< TypeParam >::constexpr_compatible &&std::is_copy_constructible< typename TypeParam::value_type >::value)
Definition vector.hpp:643
TYPED_TEST_SUITE_P(InlineVectorTest)
constexpr auto constexpr_iterate(std::initializer_list< typename Vec::value_type > const values, Vec vec) -> bool
Check that iteration works when taking a vector with the given type.
Definition vector.hpp:771
constexpr bool is_fully_comparable_v
Definition external_vector.hpp:1634
REGISTER_TYPED_TEST_SUITE_P(ExternalVectorDeathTest, AddingToInvalidIteratorIsPreconditionViolation, AssignIsPreconditionViolationIfSizeOverCapacity, ConstructWithExcessiveSizeViaNormalConstructIsAlwaysPreconditionViolation, ConstructingWithOutOfRangeSizeAndSourceIsPreconditionViolation, ConstructingWithOutOfRangeSizeIsPreconditionViolation, ConstructingWithTooManyInitializersIsPreconditionViolation, DereferencingInvalidIteratorIsPreconditionViolation, EmplaceBackIsPreconditionViolationIfFull, IndexOperatorOutOfRange, InsertNIsPreconditionViolationIfTooManyItems, InsertWhenAtCapacityIsPreconditionViolation, PushBackBeyondMaxSizeIsPreconditionViolation, PushBackOnZeroSizeVectorIsPreconditionViolation)
constexpr auto constexpr_swap(Vec lhs, Vec rhs) -> std::pair< Vec, Vec >
Definition vector.hpp:2135
Definition array_exceptions_disabled.cpp:11
CONDITIONAL_TYPED_TEST_P(InlineDequeTest, PushFrontOneElement, is_double_ended< TypeParam >)
Definition deque.hpp:218
TYPED_TEST_P(InlineDequeTest, CanConstruct)
Definition deque.hpp:196
CONDITIONAL_TYPED_TEST_P(InlineDequeTest, BasicFunctionFromBack, TypeParam::capacity >=2)
Definition deque.hpp:546
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10
A bidirectional iterator of T which declares that it could throw, used in some noexcept tests.
Definition vector.hpp:202
auto operator*() const -> reference
Dereference operator; never defined.
auto operator==(throwing_bidirectional_move_iterator_of_t const &) -> bool
Equality operator; never defined.
auto operator++() -> throwing_bidirectional_move_iterator_of_t &
Pre-increment operator; never defined.
auto operator!=(throwing_bidirectional_move_iterator_of_t const &) -> bool
Inequality operator; never defined.
auto operator++(int) -> throwing_bidirectional_move_iterator_of_t
Post-increment operator; never defined.
auto operator--(int) -> throwing_bidirectional_move_iterator_of_t
Post-decrement operator; never defined.
auto operator--() -> throwing_bidirectional_move_iterator_of_t &
Pre-decrement operator; never defined.
A type with a noexcept(false) conversion operator to T (doesn't actually throw, just declares it)
Definition vector.hpp:194
operator T() const noexcept(false)
Implicit conversion operator to T which declares that it might throw, though it doesn't actually.
Definition vector.hpp:198
constexpr auto operator()(T const &arg) -> bool
Definition vector.hpp:64
T const & value
Definition vector.hpp:66
constexpr equal_to_value(T const &input)
Definition vector.hpp:62
Definition external_vector.hpp:1707
throws_without_nullptr(T const &)
Definition vector.hpp:1948
throws_without_nullptr(T const &, std::nullptr_t) noexcept
Definition vector.hpp:1949