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>
9#include <gtest/gtest.h>
24#include "arene/base/stdlib_choice/addressof.hpp"
25#include "arene/base/stdlib_choice/cstddef.hpp"
26#include "arene/base/stdlib_choice/declval.hpp"
27#include "arene/base/stdlib_choice/forward.hpp"
28#include "arene/base/stdlib_choice/initializer_list.hpp"
29#include "arene/base/stdlib_choice/integer_sequence.hpp"
30#include "arene/base/stdlib_choice/is_assignable.hpp"
31#include "arene/base/stdlib_choice/is_constructible.hpp"
32#include "arene/base/stdlib_choice/is_copy_assignable.hpp"
33#include "arene/base/stdlib_choice/is_copy_constructible.hpp"
34#include "arene/base/stdlib_choice/is_default_constructible.hpp"
35#include "arene/base/stdlib_choice/is_move_assignable.hpp"
36#include "arene/base/stdlib_choice/is_move_constructible.hpp"
37#include "arene/base/stdlib_choice/is_rvalue_reference.hpp"
38#include "arene/base/stdlib_choice/is_same.hpp"
39#include "arene/base/stdlib_choice/iterator_tags.hpp"
40#include "arene/base/stdlib_choice/iterator_traits.hpp"
41#include "arene/base/stdlib_choice/move.hpp"
42#include "arene/base/stdlib_choice/move_iterator.hpp"
43#include "arene/base/stdlib_choice/numeric_limits.hpp"
44#include "arene/base/stdlib_choice/pair.hpp"
45#include "arene/base/stdlib_choice/reference_wrapper.hpp"
46#include "arene/base/stdlib_choice/stdexcept.hpp"
52#include "testlibs/utilities/iterator_types.hpp"
59ARENE_IGNORE_ALL(
"-Wfloat-equal",
"These tests don't perform arithmetic, so equality is OK even for floating point");
78template <
class Range,
class T>
91template <
class Range1,
class Range2>
93 return arene::base::equal(range.begin(), range.end(), values.begin());
102template <
typename T, std::
size_t Capacity>
117template <
class Vector,
class... Values>
130template <
typename Container>
131constexpr auto sort_helper(Container container)
noexcept -> Container {
138 for (
std::size_t ii = 0UL; ii + 1UL < container.size(); ++ii) {
139 if (container[ii + 1] < container[ii]) {
159template <
typename Vector>
162 using T =
typename Vector::value_type;
169 "Constexpr-compatible types must have constexpr specializations of test_value_array or test_value"
174 static_assert(
capacity > 0UL,
"Parameterized capacity can not be 0 (0-capacity vectors are always tested)");
181 template <
typename ValueType>
185 template <std::
size_t OtherCapacity>
191 template <
typename Vec,
typename... Args>
199 operator T() const noexcept(false) { return ::arene::base::testing::test_value<T>(0); }
235 template <typename U,
bool OperatorsNoexcept>
263 template <typename U>
267 template <typename U>
273 template <typename... U>
274 static constexpr auto
construct(U&&... params) noexcept(noexcept(Vector(
std::forward<U>(params)...))) -> Vector {
283 return ::arene::base::testing::test_value<T>(idx);
290 template <std::
size_t N>
291#ifdef ARENE_DOC_GENERATION_RUNNING
297 return ::arene::base::testing::unique_test_value<T, N>();
308 return ::arene::base::testing::test_vector<T, capacity>(begin, end);
329 return ::arene::base::testing::test_initializer_list<
T, Indices...>();
335 template <std::
size_t Size>
366 STATIC_ASSERT_TRUE(
noexcept(TestFixture::construct().
capacity()));
383 vec.push_back(TestFixture::test_value(0));
384 EXPECT_EQ(vec.size(), 1);
391 vec.push_back(TestFixture::test_value(0));
392 EXPECT_EQ(vec.back(), TestFixture::test_value(0));
398 vec.push_back(TestFixture::test_value(0));
399 ASSERT_FALSE(vec.empty());
406 vec.push_back(TestFixture::test_value(0));
407 vec.push_back(TestFixture::test_value(1));
408 EXPECT_EQ(vec.size(), 2);
409 EXPECT_EQ(vec.back(), TestFixture::test_value(1));
426 PushBackIsConditionallyNoexceptLvalue,
445#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
446 ASSERT_THROW(TestFixture::construct().at(0), std::out_of_range);
448 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
455#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
456 auto vec = TestFixture::construct();
457 vec.push_back(TestFixture::test_value(0));
458 EXPECT_EQ(vec[0], TestFixture::test_value(0));
460 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
467#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
468 ::testing::StaticAssertTypeEq<decltype(std::declval<TypeParam&>().at(0)),
typename TypeParam::value_type&>();
470 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
477#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
479 StaticAssertTypeEq<decltype(std::declval<TypeParam const&>().at(0)),
typename TypeParam::value_type
const&>();
481 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
488#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
489 auto vec = TestFixture::construct();
490 vec.push_back(TestFixture::test_value(0));
491 vec.push_back(TestFixture::test_value(1));
493 EXPECT_EQ(vec.at(0), TestFixture::test_value(0));
494 EXPECT_EQ(vec.at(1), TestFixture::test_value(1));
496 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
503#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
504 auto vec = TestFixture::construct();
505 vec.push_back(TestFixture::test_value(0));
507 ASSERT_THROW(vec.at(vec.size()), std::out_of_range);
508 ASSERT_THROW(vec.at(vec.size() * 2), std::out_of_range);
511 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
518#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
519 auto vec = TestFixture::construct();
520 vec.push_back(TestFixture::test_value(0));
521 vec.push_back(TestFixture::test_value(1));
523 auto const& const_vec = vec;
524 EXPECT_EQ(const_vec.at(0), TestFixture::test_value(0));
525 EXPECT_EQ(const_vec.at(1), TestFixture::test_value(1));
527 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
534#if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED)
535 auto vec = TestFixture::construct();
536 vec.push_back(TestFixture::test_value(0));
538 auto const& const_vec = vec;
540 ASSERT_THROW(const_vec.at(vec.size()), std::out_of_range);
541 ASSERT_THROW(const_vec.at(vec.size() * 2), std::out_of_range);
544 GTEST_SKIP() <<
"`at` tests skipped because exceptions are disabled";
556 auto vec = TestFixture::construct();
558 vec.push_back(TestFixture::test_value(0));
560 ASSERT_DEATH(vec.push_back(TestFixture::test_value(0)),
"Precondition violation");
568 ASSERT_EQ(zvec.begin(), zvec.end());
569 ASSERT_EQ(czvec.begin(), czvec.end());
570 ASSERT_EQ(zvec.size(), 0);
571 ASSERT_EQ(czvec.size(), 0);
577 ASSERT_DEATH(vec.push_back(TestFixture::test_value(0)),
"Precondition violation");
584 auto vec = TestFixture::construct();
586 vec.push_back(TestFixture::test_value(0));
587 typename TypeParam::value_type& val1 = vec.back();
590 if (TypeParam::capacity >= 2UL) {
591 vec.push_back(TestFixture::test_value(1));
592 typename TypeParam::value_type& val2 = vec.back();
602 auto vec = TestFixture::construct();
603 auto const& const_vec = vec;
605 vec.push_back(TestFixture::test_value(0));
606 auto& val1 = const_vec.back();
607 ::testing::StaticAssertTypeEq<decltype(val1), typename TypeParam::value_type const&>();
610 if (TypeParam::capacity >= 2UL) {
611 vec.push_back(TestFixture::test_value(1));
612 auto& val2 = const_vec.back();
613 ::testing::StaticAssertTypeEq<decltype(val2), typename TypeParam::value_type const&>();
627 constexpr auto vec = TestFixture::test_vector(1);
628 STATIC_ASSERT_EQ(vec.size(), 1);
629 STATIC_ASSERT_EQ(vec[0], TestFixture::test_value(0));
636 CanConstructFromInitializerList,
639 auto const values = TestFixture::full_test_initializer_list();
641 TypeParam
const vec{values};
644 EXPECT_THAT(vec, ::testing::ElementsAreArray(values));
651 CanConstructFromInitializerListConstexpr,
655 constexpr auto values = TestFixture::full_test_initializer_list();
657 constexpr TypeParam vec{values};
659 EXPECT_THAT(vec, ::testing::ElementsAreArray(values));
662template <
typename Vec>
671 constexpr auto vec = TestFixture::full_test_vector();
672 STATIC_ASSERT_EQ(vec.back(), TestFixture::test_value(TypeParam::capacity - 1UL));
675 TestFixture::test_value(TypeParam::capacity - 1UL)
682 auto vec = TestFixture::full_test_vector();
684 ::testing::StaticAssertTypeEq<
decltype(vec.front()),
typename TypeParam::value_type&>();
685 STATIC_ASSERT_TRUE(
noexcept(vec.front()));
686 auto const& const_vec = vec;
687 EXPECT_EQ(&const_vec.front(), &const_vec[0]);
688 ::testing::StaticAssertTypeEq<
decltype(const_vec.front()),
typename TypeParam::value_type
const&>();
689 STATIC_ASSERT_TRUE(
noexcept(const_vec.front()));
692template <
typename Vec>
702 constexpr auto vec = TestFixture::full_test_vector();
703 STATIC_ASSERT_EQ(vec.front(), TestFixture::test_value(0));
710 auto vec = TestFixture::construct();
711 ::testing::StaticAssertTypeEq<
decltype(vec.begin()),
typename TypeParam::iterator>();
712 ::testing::StaticAssertTypeEq<
decltype(vec.end()),
typename TypeParam::iterator>();
713 STATIC_ASSERT_TRUE(
noexcept(vec.begin()));
714 STATIC_ASSERT_TRUE(
noexcept(vec.end()));
715 EXPECT_EQ(vec.begin(), vec.end());
722 auto const values = TestFixture::full_test_initializer_list();
723 auto const vec = TestFixture::full_test_vector();
724 ASSERT_TRUE(arene::base::equal(values.begin(), values.end(), vec.begin(), vec.end()));
731 auto const values = TestFixture::full_test_initializer_list();
732 auto const vec = TestFixture::full_test_vector();
733 ASSERT_TRUE(arene::base::equal(values.begin(), values.end(), vec.begin(), vec.end()));
738 using value_type =
typename TypeParam::value_type;
739 ::testing::StaticAssertTypeEq<typename TypeParam::iterator::value_type, value_type>();
740 ::testing::StaticAssertTypeEq<typename TypeParam::iterator::reference, value_type&>();
741 ::testing::StaticAssertTypeEq<typename TypeParam::iterator::pointer, value_type*>();
742 ::testing::StaticAssertTypeEq<typename TypeParam::iterator::difference_type, std::ptrdiff_t>();
743 ::testing::StaticAssertTypeEq<typename TypeParam::iterator::iterator_category, std::random_access_iterator_tag>();
745 ::testing::StaticAssertTypeEq<typename TypeParam::const_iterator::value_type, value_type>();
746 ::testing::StaticAssertTypeEq<typename TypeParam::const_iterator::reference, value_type const&>();
747 ::testing::StaticAssertTypeEq<typename TypeParam::const_iterator::pointer, value_type const*>();
748 ::testing::StaticAssertTypeEq<typename TypeParam::const_iterator::difference_type, std::ptrdiff_t>();
749 ::testing::StaticAssertTypeEq<typename TypeParam::const_iterator::iterator_category, std::random_access_iterator_tag>(
755 using value_type =
typename TypeParam::value_type;
756 ::testing::StaticAssertTypeEq<typename TypeParam::value_type, value_type>();
757 ::testing::StaticAssertTypeEq<typename TypeParam::pointer, value_type*>();
758 ::testing::StaticAssertTypeEq<typename TypeParam::const_pointer, value_type const*>();
759 ::testing::StaticAssertTypeEq<typename TypeParam::reference, value_type&>();
760 ::testing::StaticAssertTypeEq<typename TypeParam::const_reference, value_type const&>();
761 ::testing::StaticAssertTypeEq<typename TypeParam::size_type, std::size_t>();
762 ::testing::StaticAssertTypeEq<typename TypeParam::difference_type, std::ptrdiff_t>();
763 ::testing::StaticAssertTypeEq<
764 typename TypeParam::reverse_iterator,
766 ::testing::StaticAssertTypeEq<
767 typename TypeParam::const_reverse_iterator,
776template <
typename Vec>
779 auto val_it = values.begin();
780 for (
auto const& vec_val : vec) {
781 if (val_it == values.end()) {
784 if (vec_val != *val_it) {
790 return val_it == values.end();
813 auto vec = TestFixture::full_test_vector();
817 typename TypeParam::iterator>::value);
818 auto const pos = vec.erase(vec.begin());
819 EXPECT_EQ(pos, vec.begin());
820 EXPECT_EQ(vec.size(), TypeParam::capacity - 1UL);
821 if (TypeParam::capacity >= 2) {
822 EXPECT_EQ(vec[0], TestFixture::test_value(1));
824 if (TypeParam::capacity >= 3) {
825 EXPECT_EQ(vec[1], TestFixture::test_value(2));
827 if (TypeParam::capacity >= 4) {
828 EXPECT_EQ(vec[2], TestFixture::test_value(3));
836 auto vec = TestFixture::full_test_vector();
840 typename TypeParam::iterator>::value);
841 auto pos = vec.erase(vec.begin() + 1);
842 EXPECT_EQ(pos, vec.begin() + 1);
843 EXPECT_EQ(vec.size(), TypeParam::capacity - 1UL);
844 EXPECT_EQ(vec[0], TestFixture::test_value(0));
845 if (TypeParam::capacity >= 3) {
846 EXPECT_EQ(vec[1], TestFixture::test_value(2));
848 if (TypeParam::capacity >= 4) {
849 EXPECT_EQ(vec[2], TestFixture::test_value(3));
853template <
typename Vec,
typename... Args>
871 TestFixture::test_value(0),
872 TestFixture::test_value(1),
873 TestFixture::test_value(2),
874 TestFixture::test_value(3)
876 STATIC_ASSERT_EQ(vec.size(), 3);
877 STATIC_ASSERT_EQ(vec[0], TestFixture::test_value(0));
878 STATIC_ASSERT_EQ(vec[1], TestFixture::test_value(1));
879 STATIC_ASSERT_EQ(vec[2], TestFixture::test_value(3));
886 auto vec = TestFixture::construct();
891 for (
std::size_t idx = 0; idx < TypeParam::capacity; ++idx) {
892 vec.push_back(TestFixture::test_value(idx));
893 if (idx < erase_start || idx >= erase_end) {
894 expected[expected_pos].emplace(TestFixture::test_value(idx));
899 ::testing::StaticAssertTypeEq<
904 typename TypeParam::iterator>();
905 auto const pos = vec.erase(vec.begin() + erase_start, vec.begin() + erase_end);
906 EXPECT_EQ(pos, vec.begin() + erase_start);
907 ASSERT_EQ(vec.size(), expected_pos);
914 CanConstructWithSize,
917 auto value_vec = TestFixture::construct(TypeParam::capacity);
920 EXPECT_EQ(value_vec.size(), TypeParam::capacity);
928 CanConstructWithSizeAndValue,
931 auto const value = TestFixture::test_value(0);
932 auto const value_vec = TestFixture::construct(TypeParam::capacity, value);
935 noexcept(TypeParam(TypeParam::capacity, value)),
938 EXPECT_EQ(value_vec.size(), TypeParam::capacity);
939 EXPECT_THAT(value_vec, ::testing::Each(::testing::Eq(value)));
945 CopyingVectorCopiesElements,
948 auto const vec = TestFixture::full_test_vector();
950 auto const copy(vec);
952 EXPECT_THAT(
copy, ::testing::ElementsAreArray(vec));
957 auto const values = TestFixture::full_test_initializer_list();
958 auto vec = TestFixture::full_test_vector();
970 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
972 auto vec = TestFixture::test_vector(count);
973 auto copy = TestFixture::test_vector(smaller_count);
976 ASSERT_EQ(vec.size(), count);
977 ASSERT_EQ(
copy.size(), count);
979 EXPECT_EQ(vec[i],
copy[i]);
980 EXPECT_EQ(TestFixture::test_value(i),
copy[i]);
987 constexpr std::size_t count = TypeParam::capacity - 1UL;
988 constexpr std::size_t larger_count = TypeParam::capacity;
990 auto vec = TestFixture::test_vector(count);
991 auto copy = TestFixture::test_vector(larger_count);
994 ASSERT_EQ(vec.size(), count);
995 ASSERT_EQ(
copy.size(), count);
997 EXPECT_EQ(vec[i],
copy[i]);
998 EXPECT_EQ(TestFixture::test_value(i),
copy[i]);
1033 constexpr std::size_t count = TypeParam::capacity;
1034 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
1036 auto first = TestFixture::construct();
1040 first.push_back(TestFixture::test_value(idx));
1041 expected[expected_pos].emplace(TestFixture::test_value(idx));
1045 auto second = TestFixture::test_vector(smaller_count);
1049 EXPECT_EQ(second.size(), count);
1056 constexpr std::size_t count = TypeParam::capacity - 1UL;
1057 constexpr std::size_t larger_count = TypeParam::capacity;
1059 auto first = TestFixture::test_vector(count);
1060 auto second = TestFixture::test_vector(larger_count);
1063 ASSERT_EQ(second.size(), count);
1065 EXPECT_EQ(TestFixture::test_value(i), second[i]);
1095MATCHER_P(elements_match_function, function,
"") {
1097 if (arg[ii] != function(ii)) {
1107 auto vec = TestFixture::test_vector(TypeParam::capacity - 1UL);
1109 vec.push_back(TestFixture::test_value(TypeParam::capacity - 1UL));
1112 EXPECT_EQ(vec.size(), TypeParam::capacity - 1UL);
1113 EXPECT_THAT(vec, elements_match_function(TestFixture::test_value));
1121template <
typename Vec>
1131 STATIC_ASSERT_EQ(vec.size(), TypeParam::capacity - 1UL);
1133 if (TypeParam::capacity >= 2) {
1134 EXPECT_EQ(vec[0], TestFixture::test_value(0));
1136 if (TypeParam::capacity >= 3) {
1137 EXPECT_EQ(vec[1], TestFixture::test_value(1));
1139 if (TypeParam::capacity >= 4) {
1140 EXPECT_EQ(vec[2], TestFixture::test_value(2));
1146 auto vec = TestFixture::construct();
1149 noexcept(vec.erase(vec.begin(), vec.end())),
1158 auto vec1 = TestFixture::construct();
1159 auto const& const_vec1 = vec1;
1160 auto const itr = vec1.insert(const_vec1.begin(), TestFixture::test_value(0));
1161 EXPECT_EQ(itr, vec1.begin());
1162 EXPECT_EQ(vec1.size(), 1);
1163 EXPECT_EQ(vec1[0], TestFixture::test_value(0));
1169 auto vec1 = TestFixture::test_vector(1);
1170 auto const& const_vec1 = vec1;
1171 auto const pos = vec1.insert(const_vec1.end(), TestFixture::test_value(1));
1172 EXPECT_EQ(pos, vec1.begin() + 1);
1173 EXPECT_EQ(vec1.size(), 2);
1174 EXPECT_EQ(vec1[0], TestFixture::test_value(0));
1175 EXPECT_EQ(vec1[1], TestFixture::test_value(1));
1182 auto vec1 = TestFixture::test_vector(2);
1183 auto const& const_vec1 = vec1;
1184 auto const pos = vec1.insert(const_vec1.begin() + 1, TestFixture::test_value(2));
1185 EXPECT_EQ(pos, vec1.begin() + 1);
1186 EXPECT_EQ(vec1.size(), 3);
1187 EXPECT_EQ(vec1[0], TestFixture::test_value(0));
1188 EXPECT_EQ(vec1[1], TestFixture::test_value(2));
1189 EXPECT_EQ(vec1[2], TestFixture::test_value(1));
1196 InsertWhenAtCapacityIsPreconditionViolation,
1199 auto vec1 = TestFixture::construct(TypeParam::capacity);
1200 EXPECT_EQ(vec1.size(), TypeParam::capacity);
1201 ASSERT_DEATH(vec1.insert(vec1.end(), TestFixture::test_value(0)),
"Precondition violation");
1202 ASSERT_DEATH(vec1.insert(vec1.begin(), TestFixture::test_value(0)),
"Precondition violation");
1203 EXPECT_EQ(vec1.size(), TypeParam::capacity);
1211 ConstructingWithOutOfRangeSizeIsPreconditionViolation,
1214 ASSERT_DEATH(TestFixture::construct(TypeParam::capacity + 1),
"Precondition violation");
1221 ConstructingWithOutOfRangeSizeAndSourceIsPreconditionViolation,
1224 auto const source = TestFixture::test_value(0);
1225 ASSERT_DEATH(TestFixture::construct(TypeParam::capacity + 1, source),
"Precondition violation");
1232 ConstructingWithTooManyInitializersIsPreconditionViolation,
1237 "Precondition violation"
1241template <
typename Vec>
1251 ResizeZeroCapacityVecToZeroIsOk,
1257 STATIC_ASSERT_EQ(vec2.size(), 0);
1264 ResizeNonZeroCapacityVecToZeroIsOk,
1267 constexpr auto vec = TestFixture::construct(TypeParam::capacity);
1270 STATIC_ASSERT_EQ(vec2.size(), 0);
1277 ResizeNonZeroCapacityVecToOtherIsOk,
1280 constexpr std::size_t count1 = TypeParam::capacity - 1UL;
1281 constexpr std::size_t count2 = TypeParam::capacity;
1282 constexpr auto vec = TestFixture::construct(count1);
1283 STATIC_ASSERT_EQ(vec.size(), count1);
1285 STATIC_ASSERT_EQ(vec2.size(), count2);
1291 ResizeIsConditionallyNoexcept,
1295 noexcept(TestFixture::construct().resize(0)),
1304 ResizeWithValueIsConditionallyNoexcept,
1317 ResizingFromLargeToSmallLeavesElements,
1320 constexpr std::size_t initial_count = TypeParam::capacity;
1321 auto const initial_value = TestFixture::test_value(0);
1322 TypeParam vec(initial_count, initial_value);
1323 constexpr std::size_t count = TypeParam::capacity - 1UL;
1324 auto const value = TestFixture::test_value(1);
1325 vec.resize(count, value);
1326 ASSERT_EQ(vec.size(), count);
1329 EXPECT_EQ(vec[idx], initial_value);
1339 ResizingFromSmallToLargeConstructsElementsAsCopiesOfSpecified,
1342 constexpr std::size_t initial_count = TypeParam::capacity - 1UL;
1343 auto const initial_value = TestFixture::test_value(0);
1344 TypeParam vec(initial_count, initial_value);
1345 constexpr std::size_t count = TypeParam::capacity;
1346 auto const value = TestFixture::test_value(1);
1347 vec.resize(count, value);
1348 ASSERT_EQ(vec.size(), count);
1350 for (
std::size_t idx = 0; idx < initial_count; ++idx) {
1351 EXPECT_EQ(vec[idx], initial_value);
1353 for (
std::size_t idx = initial_count; idx < count; ++idx) {
1354 EXPECT_EQ(vec[idx], value);
1362 CanInitializeWithSizeAndValue,
1366 constexpr auto source = TestFixture::test_value(0);
1367 constexpr auto vec = TestFixture::construct(TypeParam::capacity, source);
1369 STATIC_ASSERT_EQ(vec.size(), TypeParam::capacity);
1373template <
typename Vec,
typename T>
1390 STATIC_ASSERT_EQ(vec.size(), 3);
1391 STATIC_ASSERT_EQ(vec[0], TestFixture::test_value(0));
1392 STATIC_ASSERT_EQ(vec[1], TestFixture::test_value(2));
1393 STATIC_ASSERT_EQ(vec[2], TestFixture::test_value(1));
1399 auto const expected = TestFixture::full_test_vector();
1400 auto source = TestFixture::full_test_vector();
1404 EXPECT_EQ(vec.size(), expected.size());
1413 using source_val =
typename source_it::reference;
1416 constexpr bool element_construction_noexcept =
1422 it_operations_noexcept && element_construction_noexcept
1425 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
1427 using throwing_bidirectional_iterator =
typename TestFixture::throwing_bidirectional_move_iterator_of_t;
1431 typename convertible_array::const_iterator,
1432 typename convertible_array::const_iterator>::value);
1435 typename convertible_array::const_iterator,
1436 typename convertible_array::const_iterator>::value);
1440 STATIC_ASSERT_FALSE(
1448 using input_it = ::testing::demoted_iterator<typename TypeParam::value_type*, std::input_iterator_tag>;
1449 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
1453 using nothrow_it_raw_type =
1457 constexpr bool element_construction_noexcept =
1463 it_operations_noexcept && element_construction_noexcept
1467 STATIC_ASSERT_FALSE(
1478 STATIC_ASSERT_FALSE(
1489 CanConstructFromIteratorRangeConstexpr,
1493 constexpr auto source = TestFixture::full_test_initializer_list();
1494 constexpr TypeParam vec(source.begin(), source.end());
1496 STATIC_ASSERT_EQ(vec.size(), source.size());
1497 STATIC_ASSERT_TRUE(equal(vec.begin(), vec.end(), source.begin(), source.end()));
1504 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
1506 auto const value = TestFixture::full_test_initializer_list();
1508 auto copy = TestFixture::test_vector(smaller_count);
1511 EXPECT_THAT(
copy, ::testing::ElementsAreArray(value));
1518 constexpr std::size_t larger_count = TypeParam::capacity;
1522 auto copy = TestFixture::test_vector(larger_count);
1525 EXPECT_THAT(
copy, ::testing::ElementsAreArray(value));
1531 auto source = TestFixture::full_test_vector();
1533 auto vec = TestFixture::test_vector(0);
1544 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
1546 using throwing_bidirectional_iterator =
typename TestFixture::throwing_bidirectional_move_iterator_of_t;
1549 constexpr bool element_construction_noexcept =
1555 it_operations_noexcept && element_construction_noexcept
1557 STATIC_ASSERT_FALSE(
1560 STATIC_ASSERT_FALSE(
noexcept(TypeParam{}.assign(
1570 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
1572 auto const value = TestFixture::full_test_initializer_list();
1574 auto copy = TestFixture::test_vector(smaller_count);
1577 EXPECT_THAT(
copy, ::testing::ElementsAreArray(value));
1592 auto const values = TestFixture::full_test_initializer_list();
1593 STATIC_ASSERT_EQ(
noexcept(TypeParam{}.assign(values)), is_nothrow_copyable);
1600 auto source = TestFixture::full_test_vector();
1602 auto vec = TestFixture::test_vector(0);
1604 using input_it = ::testing::demoted_iterator<move_it, std::input_iterator_tag>;
1608 vec.assign(begin, end);
1616 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
1620 using nothrow_it_raw_type =
1623 STATIC_ASSERT_FALSE(
noexcept(TypeParam{}.assign(
1624 std::declval<::testing::demoted_iterator<throwing_it_throwing_type, std::input_iterator_tag>>(),
1625 std::declval<::testing::demoted_iterator<throwing_it_throwing_type, std::input_iterator_tag>>()
1627 STATIC_ASSERT_FALSE(
1630 STATIC_ASSERT_FALSE(
1638 STATIC_ASSERT_FALSE(
1646 constexpr std::size_t count = TypeParam::capacity;
1647 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
1649 auto copy = TestFixture::test_vector(smaller_count);
1650 auto const value = TestFixture::test_value(0);
1651 copy.assign(count, value);
1653 EXPECT_EQ(
copy.size(), count);
1655 EXPECT_EQ(
copy[i], value);
1664 STATIC_ASSERT_EQ(
noexcept(TypeParam{}.assign(0, TestFixture::test_value(0))), is_nothrow_copyable);
1670 constexpr std::size_t smaller_count = TypeParam::capacity - 1UL;
1672 auto const initial_value = TestFixture::test_value(0);
1673 TypeParam
copy(smaller_count, initial_value);
1674 auto const value = TestFixture::test_value(1);
1675 ASSERT_DEATH(
copy.assign(TypeParam::capacity + 1, value),
"Precondition violation");
1677 EXPECT_EQ(
copy.size(), smaller_count);
1679 EXPECT_EQ(
copy[i], initial_value);
1685 ::testing::StaticAssertTypeEq<decltype(std::declval<TypeParam&>()[0]),
typename TypeParam::value_type&>();
1690 ::testing::StaticAssertTypeEq<decltype(std::declval<TypeParam const&>()[0]),
typename TypeParam::value_type
const&>();
1696 auto vec = TestFixture::test_vector(2);
1697 auto const& const_vec = vec;
1699 EXPECT_EQ(vec[0], TestFixture::test_value(0));
1700 EXPECT_EQ(vec[1], TestFixture::test_value(1));
1712 ASSERT_DEATH(TestFixture::construct()[0],
"index < this->size()");
1726 constexpr auto vec = TestFixture::test_vector(2);
1727 STATIC_ASSERT_EQ(vec[0], TestFixture::test_value(0));
1728 STATIC_ASSERT_EQ(vec[1], TestFixture::test_value(1));
1733 auto vec = TestFixture::full_test_vector();
1734 auto const& const_vec = vec;
1741 STATIC_ASSERT_TRUE(
noexcept(vec.data()));
1742 STATIC_ASSERT_TRUE(
noexcept(const_vec.data()));
1750 auto vec = TestFixture::full_test_vector();
1752 EXPECT_EQ(vec.size(), TypeParam::capacity);
1753 EXPECT_FALSE(vec.empty());
1755 EXPECT_EQ(vec.size(), 0);
1756 EXPECT_TRUE(vec.empty());
1758 STATIC_ASSERT_TRUE(
noexcept(vec.clear()));
1761template <
typename Vec>
1770 constexpr auto vec = TestFixture::full_test_vector();
1773 STATIC_ASSERT_TRUE(value2.empty());
1781 CanCompareForEquality,
1784 constexpr TypeParam vec{
1789 constexpr TypeParam different_contents{
1794 constexpr auto longer = TestFixture::test_vector(4);
1795 constexpr TypeParam
copy{vec};
1797 STATIC_ASSERT_TRUE(vec != different_contents);
1798 STATIC_ASSERT_TRUE(vec != longer);
1799 STATIC_ASSERT_FALSE(vec !=
copy);
1800 STATIC_ASSERT_FALSE(vec == different_contents);
1801 STATIC_ASSERT_FALSE(vec == longer);
1802 STATIC_ASSERT_TRUE(vec ==
copy);
1818template <
typename T>
1829 CanCompareForOrdering,
1831 TypeParam::capacity >= 4
1833 constexpr auto sorted_test_values =
sort_helper(TypeParam{
1840 constexpr auto low_value = TypeParam(sorted_test_values.begin(), sorted_test_values.begin() + 2UL);
1841 constexpr auto high_value = TypeParam(sorted_test_values.begin() + 2UL, sorted_test_values.begin() + 4UL);
1842 constexpr auto long_value = TypeParam(sorted_test_values.begin(), sorted_test_values.begin() + 3UL);
1843 constexpr auto low_value_copy = low_value;
1845 STATIC_ASSERT_TRUE(low_value < high_value);
1846 STATIC_ASSERT_TRUE(low_value < long_value);
1847 STATIC_ASSERT_FALSE(low_value < low_value_copy);
1848 STATIC_ASSERT_FALSE(high_value < low_value);
1849 STATIC_ASSERT_TRUE(high_value > low_value);
1850 STATIC_ASSERT_TRUE(long_value > low_value);
1851 STATIC_ASSERT_FALSE(low_value_copy > low_value);
1852 STATIC_ASSERT_FALSE(low_value > high_value);
1854 STATIC_ASSERT_TRUE(low_value <= high_value);
1855 STATIC_ASSERT_TRUE(low_value <= long_value);
1856 STATIC_ASSERT_TRUE(low_value <= low_value_copy);
1857 STATIC_ASSERT_FALSE(high_value <= low_value);
1858 STATIC_ASSERT_TRUE(high_value >= low_value);
1859 STATIC_ASSERT_TRUE(long_value >= low_value);
1860 STATIC_ASSERT_TRUE(low_value_copy >= low_value);
1861 STATIC_ASSERT_FALSE(low_value >= high_value);
1864template <
typename ValueType>
1866 using value_type = ValueType;
1878 auto get() -> value_type& {
return value_; }
1884 using value_type =
typename TypeParam::value_type;
1886 struct with_constructor_args {
1889 value_type& reference;
1900 value_type const value1 = TestFixture::test_value(0);
1901 value_type value2 = TestFixture::test_value(1);
1904 ::testing::StaticAssertTypeEq<decltype(result), with_constructor_args&>();
1905 EXPECT_EQ(vec.size(), 1);
1906 ASSERT_FALSE(vec.empty());
1911 EXPECT_EQ(
result.wrapper.get(), TestFixture::test_value(2));
1914template <
typename Container,
typename... Args>
1924 using value_type =
typename TypeParam::value_type;
1925 struct with_constructor_args {
1930 with_constructor_args() =
default;
1933 constexpr with_constructor_args(value_type&& fst, value_type&& snd, value_type&& trd)
1939 constexpr auto vec =
1941 TestFixture::test_value(0),
1942 TestFixture::test_value(1),
1943 TestFixture::test_value(2)
1946 STATIC_ASSERT_EQ(vec.size(), 1);
1947 STATIC_ASSERT_EQ(vec[0].first, TestFixture::test_value(0));
1948 STATIC_ASSERT_EQ(vec[0].second, TestFixture::test_value(1));
1949 STATIC_ASSERT_EQ(vec[0].third, TestFixture::test_value(2));
1952template <
typename T>
1953struct throws_without_nullptr {
1971 EmplaceBackIsConditionallyNoexceptLvalue,
1974 using value_type =
typename TypeParam::value_type;
1980 STATIC_ASSERT_FALSE(
1993 using value_type =
typename TypeParam::value_type;
1994 using const_it =
typename TypeParam::const_iterator;
1996 constexpr bool is_nothrow_movable =
2004 using overload_test_vector =
2006 using overload_it =
typename overload_test_vector::const_iterator;
2017 using value_type =
typename TypeParam::value_type;
2018 struct with_constructor_args {
2020 value_type* raw_pointer;
2030 auto const& const_vec1 = vec;
2031 value_type const value1 = TestFixture::test_value(0);
2032 value_type value2 = TestFixture::test_value(1);
2033 auto pos = vec.emplace(
2039 EXPECT_EQ(pos, vec.begin());
2040 EXPECT_EQ(vec.size(), 1);
2043 EXPECT_EQ(pos->value.get(), value1);
2044 ASSERT_NE(pos->raw_pointer,
nullptr);
2046 EXPECT_EQ(pos->wrapper.get(), TestFixture::test_value(2));
2049template <
typename Vec,
typename Arg>
2062 constexpr auto vec1 = TestFixture::test_vector(2);
2064 struct convertible_to_typeparam {
2066 constexpr operator typename TypeParam::value_type()
noexcept {
return TestFixture::test_value(2); }
2069 constexpr TypeParam vec2 =
constexpr_emplace(TestFixture::test_vector(2), 1, convertible_to_typeparam{});
2071 STATIC_ASSERT_EQ(vec2.size(), vec1.size() + 1);
2072 STATIC_ASSERT_EQ(vec2[0], vec1[0]);
2073 STATIC_ASSERT_EQ(vec2[1],
static_cast<typename TypeParam::value_type
>(convertible_to_typeparam{}));
2074 STATIC_ASSERT_EQ(vec2[2], vec1[1]);
2081 EmplaceAtPositionIsConditionallyNoexceptLvalue,
2084 using value_type =
typename TypeParam::value_type;
2085 using const_it =
typename TypeParam::const_iterator;
2087 constexpr bool is_nothrow_movable =
2101 DefaultEmplaceIsConditionallyNoexcept,
2104 using value_type =
typename TypeParam::value_type;
2105 using const_it =
typename TypeParam::const_iterator;
2107 constexpr bool is_nothrow_movable =
2111 noexcept(TestFixture::construct().emplace_back()),
2116 is_nothrow_movable && std::is_nothrow_default_constructible<value_type>{}
2123 auto vec = TestFixture::test_vector(TypeParam::capacity);
2125 ASSERT_DEATH(vec.emplace_back(TestFixture::test_value(0)),
"Precondition violation");
2131 auto value1 = TestFixture::full_test_vector();
2132 auto value2 = TestFixture::test_vector(TypeParam::capacity, TypeParam::capacity + TypeParam::capacity / 2UL);
2134 swap(value1, value2);
2136 EXPECT_EQ(value1, TestFixture::test_vector(TypeParam::capacity, TypeParam::capacity + TypeParam::capacity / 2UL));
2137 EXPECT_EQ(value2, TestFixture::full_test_vector());
2140template <
typename Vec>
2148 constexpr auto value1 = TestFixture::full_test_vector();
2149 constexpr auto value2 =
2150 TestFixture::test_vector(TypeParam::capacity, TypeParam::capacity + TypeParam::capacity / 2UL);
2153 STATIC_ASSERT_EQ(vec_swapped.first, value2);
2154 STATIC_ASSERT_EQ(vec_swapped.second, value1);
2170 using value_type =
typename TypeParam::value_type;
2171 using iterator =
typename TypeParam::const_iterator;
2173 constexpr bool is_nothrow_movable =
2185 using value_type =
typename TypeParam::value_type;
2186 using iterator =
typename TypeParam::const_iterator;
2188 constexpr bool is_nothrow_movable =
2200 using value_type =
typename TypeParam::value_type;
2201 using iterator =
typename TypeParam::const_iterator;
2203 constexpr bool is_nothrow_movable =
2219 auto value = TestFixture::test_vector(TypeParam::capacity - 1UL);
2220 ASSERT_DEATH(value.insert(value.begin(), 2UL, TestFixture::test_value(5)),
"Precondition violation");
2227 InsertNAtEndInsertsElements,
2230 auto const value1 = TestFixture::test_value(0);
2231 auto const value2 = TestFixture::test_value(1);
2232 auto const value3 = TestFixture::test_value(2);
2233 TypeParam vec{value1, value2};
2236 vec.insert(vec.end(), insert_count, value3);
2237 EXPECT_EQ(vec.size(), insert_count + 2);
2238 EXPECT_EQ(vec[0], value1);
2239 EXPECT_EQ(vec[1], value2);
2241 EXPECT_EQ(vec[i + 2], value3);
2250 InsertNInMiddleInsertsElements,
2253 auto const value1 = TestFixture::test_value(0);
2254 auto const value2 = TestFixture::test_value(1);
2255 auto const value3 = TestFixture::test_value(2);
2256 auto const value4 = TestFixture::test_value(3);
2257 auto const value_inserted = TestFixture::test_value(4);
2258 TypeParam vec{value1, value2, value3, value4};
2261 vec.insert(vec.begin() + 1, insert_count, value_inserted);
2262 EXPECT_EQ(vec.size(), insert_count + 4);
2263 EXPECT_EQ(vec[0], value1);
2265 EXPECT_EQ(vec[i + 1], value_inserted);
2267 EXPECT_EQ(vec[insert_count + 1], value2);
2268 EXPECT_EQ(vec[insert_count + 2], value3);
2269 EXPECT_EQ(vec[insert_count + 3], value4);
2276 auto vec1 = TestFixture::test_vector(4);
2277 auto vec2 = TestFixture::test_vector(4, 11);
2278 auto const vec2_expected = TestFixture::test_vector(4, 11);
2281 EXPECT_EQ(vec1.size(), vec2.size() + 4);
2282 EXPECT_EQ(vec1[0], TestFixture::test_value(0));
2283 for (
std::size_t idx = 0; idx < vec2.size(); ++idx) {
2284 EXPECT_EQ(vec1[idx + 1], vec2_expected[idx]);
2286 EXPECT_EQ(vec1[vec2_expected.size() + 1], TestFixture::test_value(1));
2287 EXPECT_EQ(vec1[vec2_expected.size() + 2], TestFixture::test_value(2));
2288 EXPECT_EQ(vec1[vec2_expected.size() + 3], TestFixture::test_value(3));
2294 using value_type =
typename TypeParam::value_type;
2295 using ivec_iter =
typename TypeParam::const_iterator;
2297 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
2304 constexpr bool is_nothrow_movable =
2316 STATIC_ASSERT_FALSE(
noexcept(this->
construct().insert(
2330 STATIC_ASSERT_FALSE(
noexcept(this->
construct().insert(
2332 std::declval<::testing::demoted_iterator<throwing_it_throwing_type, std::input_iterator_tag>>(),
2333 std::declval<::testing::demoted_iterator<throwing_it_throwing_type, std::input_iterator_tag>>()
2335 STATIC_ASSERT_FALSE(
noexcept(this->
construct().insert(
2340 STATIC_ASSERT_FALSE(
noexcept(this->
construct().insert(
2345 STATIC_ASSERT_FALSE(
noexcept(this->
construct().insert(
2354 auto const value1 = TestFixture::full_test_vector();
2356 ASSERT_EQ(value1.cbegin(), value1.begin());
2357 ASSERT_EQ(value1.cend(), value1.end());
2359 ::testing::StaticAssertTypeEq<
decltype(value1.cbegin()),
typename TypeParam::const_iterator>();
2360 STATIC_ASSERT_TRUE(
noexcept(value1.cbegin()));
2361 STATIC_ASSERT_TRUE(
noexcept(value1.cend()));
2363 auto value2 = TestFixture::full_test_vector();
2364 ::testing::StaticAssertTypeEq<
decltype(value2.cbegin()),
typename TypeParam::const_iterator>();
2365 ::testing::StaticAssertTypeEq<
decltype(value2.cend()),
typename TypeParam::const_iterator>();
2367 EXPECT_EQ(value2.begin(), value2.cbegin());
2368 EXPECT_EQ(value2.end(), value2.cend());
2375 auto const value1 = TestFixture::full_test_vector();
2377 auto itr = value1.rbegin();
2378 auto citr = value1.crbegin();
2379 for (
std::size_t steps = 0UL; steps < value1.size(); ++steps) {
2380 ASSERT_NE(itr, value1.rend());
2381 ASSERT_NE(citr, value1.crend());
2383 EXPECT_EQ(*itr, value1[value1.size() - steps - 1UL]);
2384 EXPECT_EQ(*citr, value1[value1.size() - steps - 1UL]);
2389 EXPECT_EQ(itr, value1.rend());
2390 EXPECT_EQ(citr, value1.crend());
2397 CanConstructFromBiggerCapacityVector,
2401 constexpr std::size_t larger_capacity = TypeParam::capacity + 2UL;
2406 constexpr TypeParam small_vector(large_vector);
2408 STATIC_ASSERT_EQ(small_vector.size(), large_vector.size());
2409 STATIC_ASSERT_TRUE(equal(small_vector.begin(), small_vector.end(), large_vector.begin(), large_vector.end()));
2415 constexpr std::size_t larger_capacity = TypeParam::capacity + 2UL;
2420 TypeParam small_vector;
2421 small_vector = large_vector;
2423 EXPECT_EQ(small_vector.size(), large_vector.size());
2424 for (
std::size_t i = 0; i < small_vector.size(); ++i) {
2425 EXPECT_EQ(small_vector[i], large_vector[i]);
2432 STATIC_ASSERT_TRUE(
noexcept(TypeParam::try_construct()));
2441 CanConstructWithSizeViaTryConstruct,
2446 noexcept(TypeParam::try_construct(0)),
2459 ConstructWithExcessiveSizeViaTryConstructFails,
2462 constexpr std::size_t size1 = TypeParam::capacity + 1UL;
2466 noexcept(TypeParam::try_construct(size1)),
2476 constexpr bool can_construct_with_size_only =
2493 STATIC_ASSERT_TRUE(
noexcept(TypeParam::try_construct()));
2494 STATIC_ASSERT_TRUE(
noexcept(TypeParam{}));
2505 ConstructWithSizeViaTryConstructNotNoexceptIfDefaultConstructorNotNoexcept,
2510 noexcept(TypeParam::try_construct(0)),
2519 ConstructWithSizeViaNormalConstructWithDefaultConstructorNotNoexceptIsNotNoexcept,
2529 ConstructWithExcessiveSizeViaNormalConstructIsAlwaysPreconditionViolation,
2532 constexpr std::size_t size1 = TypeParam::capacity + 1UL;
2533 ASSERT_DEATH(this->
construct(size1),
"Precondition violation");
2539 using value_type =
typename TypeParam::value_type;
2569 CanTryConstructFromInitializerList,
2572 auto const values = TestFixture::full_test_initializer_list();
2575 noexcept(TypeParam::try_construct(values)),
2578 ASSERT_TRUE(TypeParam::try_construct(values).has_value());
2579 ASSERT_EQ(TypeParam::try_construct(values)->
size(), values.size());
2581 auto res = TypeParam::try_construct(values);
2582 EXPECT_THAT(*res, ::testing::ElementsAreArray(values));
2589 TryConstructFromTooLargeInitializerListReturnsEmpty,
2594 ASSERT_FALSE(TypeParam::try_construct(values).has_value());
2600 CanCopyViaTryConstruct,
2603 using value_type =
typename TypeParam::value_type;
2604 auto const values = TestFixture::full_test_vector();
2611 auto res = TypeParam::try_construct(values);
2612 ASSERT_TRUE(res.has_value());
2613 EXPECT_THAT(*res, ::testing::ElementsAreArray(values));
2619 CanCopyViaConstruct,
2622 auto const values = TestFixture::full_test_vector();
2626 EXPECT_THAT(res, ::testing::ElementsAreArray(values));
2633 CanCopyViaTryConstructFromSmaller,
2642 TypeParam::capacity - 1
2650 noexcept(TypeParam::try_construct(values)),
2655 "-Wmaybe-uninitialized",
2656 "GCC issues false positive here when compiling with -fno-exceptions and using GCC's stdlib"
2658 auto res = TypeParam::try_construct(values);
2660 ASSERT_TRUE(res.has_value());
2661 EXPECT_THAT(*res, ::testing::ElementsAreArray(values));
2668 CanCopyViaConstructFromSmaller,
2671 static typename TestFixture::template
vector_with_capacity<TypeParam::capacity - 1>
const values{
2672 TestFixture::test_vector(TypeParam::capacity - 1)
2677 EXPECT_THAT(res, ::testing::ElementsAreArray(values));
2685 CanCopyViaTryConstructFromLargerWithFewerElements,
2698 noexcept(TypeParam::try_construct(values)),
2701 auto res = TypeParam::try_construct(values);
2702 ASSERT_TRUE(res.has_value());
2703 EXPECT_THAT(*res, ::testing::ElementsAreArray(values));
2710 FailToCopyViaTryConstructFromLargerWithMoreElements,
2715 TypeParam::capacity + 1
2718 ASSERT_GT(values.size(), TypeParam::capacity);
2719 ASSERT_FALSE(TypeParam::try_construct(values).has_value());
2726 CanCopyViaConstructFromLargerWithFewerElements,
2735 STATIC_ASSERT_EQ(
noexcept(TypeParam(values)), copy_is_noexcept);
2737 EXPECT_THAT(res, ::testing::ElementsAreArray(values));
2742 using smaller_vec =
typename TestFixture::template
vector_with_capacity<TypeParam::capacity - 1>;
2766 auto const values = TestFixture::full_test_vector();
2767 auto values_copy = TestFixture::full_test_vector();
2772 noexcept(TypeParam::try_construct(
std::move(values_copy))),
2775 auto res = TypeParam::try_construct(
std::move(values_copy));
2776 ASSERT_TRUE(res.has_value());
2783 auto const values = TestFixture::full_test_vector();
2784 auto source = TestFixture::full_test_vector();
2801 TypeParam::capacity + 1
2804 ASSERT_GT(values.size(), TypeParam::capacity);
2806 ASSERT_FALSE(TypeParam::try_construct(
std::move(values)).has_value());
2812 using smaller_vec =
typename TestFixture::template
vector_with_capacity<TypeParam::capacity - 1>;
2836 auto const expected = TestFixture::full_test_vector();
2837 auto source = TestFixture::full_test_vector();
2841 ASSERT_TRUE(maybe_vec.has_value());
2843 ASSERT_EQ(maybe_vec->size(), source.size());
2852 IteratorRangeTryConstructionIsConditionallyNoexcept,
2856 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
2858 using throwing_bidirectional_iterator =
typename TestFixture::throwing_bidirectional_move_iterator_of_t;
2861 noexcept(TypeParam::try_construct(
2867 STATIC_ASSERT_FALSE(
noexcept(TypeParam::try_construct(
2871 STATIC_ASSERT_FALSE(
noexcept(TypeParam::try_construct(
2881 InputIteratorRangeTryConstructionIsConditionallyNoexcept,
2884 using value_type =
typename TypeParam::value_type;
2885 using throws_when_converted =
typename TestFixture::throws_when_converted_to_t;
2892 noexcept(TypeParam::try_construct(
2893 std::declval<::testing::demoted_iterator<value_type*, std::input_iterator_tag>>(),
2894 std::declval<::testing::demoted_iterator<value_type*, std::input_iterator_tag>>()
2898 STATIC_ASSERT_FALSE(
noexcept(
2901 STATIC_ASSERT_FALSE(
2908 STATIC_ASSERT_FALSE(
noexcept(
2916 ASSERT_DEATH(*
typename TypeParam::iterator{},
"Precondition violation");
2917 ASSERT_DEATH(*
typename TypeParam::const_iterator{},
"Precondition violation");
2923 ASSERT_DEATH(
typename TypeParam::iterator{} + 1,
"Precondition violation");
2924 ASSERT_DEATH(
typename TypeParam::const_iterator{} + 1,
"Precondition violation");
2931 CanConstructAnEmptyVector,
2932 CapacityIsAsSpecified,
2938 AfterPushBackCanGetLastElement,
2939 AfterPushBackVectorIsNotEmpty,
2940 SecondPushBackChangesLastValue,
2941 PushBackIsConditionallyNoexceptRvalue,
2942 PushBackIsConditionallyNoexceptLvalue,
2945 RetrievingAValueWithAtThrowsOnEmpty,
2946 RetrievingAValueWithAtReturnsValueAfterPushBack,
2948 AtOnConstVectorReturnsConstReference,
2949 CanAccessMultipleValuesWithAt,
2950 AtIndexSizeOrLargerThrows,
2951 CanAccessMultipleValuesWithAtWithConstVec,
2952 AtIndexSizeOrLargerThrowsWithConstVec,
2953 MaxSizeEqualsCapacity,
2954 ZeroSizeVectorIsEmpty,
2955 BackReturnsReference,
2956 ConstBackReturnsConstReference,
2959 CanConstructFromInitializerList,
2960 CanConstructFromInitializerListConstexpr,
2965 CanIterateOverValues,
2966 CanIterateOverConstValues,
2971 CanEraseAtBeginning,
2975 CanConstructWithSize,
2976 CanConstructWithSizeAndValue,
2977 CopyingVectorCopiesElements,
2978 MovingVectorMovesElements,
2979 CopyAssignOverSmallerVectorCopiesElements,
2980 CopyAssignOverLargerVectorDestroysExcess,
2981 CopyingIsConditionallyDefined,
2982 MoveAssignOverSmallerVectorMovesElements,
2983 MoveAssignOverLargerVectorDestroysExcess,
2984 MovingIsConditionallyDefined,
2988 EraseIsNoexceptIfTypeHasNoexceptMove,
2989 CanInsertInEmptyVector,
2990 CanInsertAtEndOfExistingVector,
2991 CanInsertInMiddleOfExistingVector,
2992 ResizeZeroCapacityVecToZeroIsOk,
2993 ResizeNonZeroCapacityVecToZeroIsOk,
2994 ResizeNonZeroCapacityVecToOtherIsOk,
2995 ResizeIsConditionallyNoexcept,
2996 ResizeWithValueIsConditionallyNoexcept,
2997 ResizingFromLargeToSmallLeavesElements,
2998 ResizingFromSmallToLargeConstructsElementsAsCopiesOfSpecified,
2999 CanInitializeWithSizeAndValue,
3001 CanConstructFromIteratorRange,
3002 IteratorRangeConstructionIsConditionallyNoexcept,
3003 InputIteratorRangeConstructionIsConditionallyNoexcept,
3004 CanConstructFromIteratorRangeConstexpr,
3005 CopyAssignOverSmallerVectorFromInitListCopiesElements,
3006 CopyAssignOverLargerVectorFromInitListDestroysExcess,
3007 CanAssignFromIteratorRange,
3008 IteratorRangeAssignmentIsConditionallyNoexcept,
3009 CanAssignFromInputIteratorRange,
3010 InputIteratorRangeAssignmentIsConditionallyNoexcept,
3011 CanAssignFromInitListUsingAssignFunction,
3012 AssignFromInitListUsingAssignFunctionIsConditionallyNoexcept,
3013 CanAssignFromSizeAndValue,
3014 AssignFromSizeAndValueIsConditionallyNoexcept,
3015 IndexOperatorReturnsReference,
3016 IndexOperatorOnConstVectorReturnsConstReference,
3017 CanAccessMultipleValuesWithIndexOperator,
3018 IndexOperatorIsNoexcept,
3019 IndexOperatorOnConstVectorIsNoexcept,
3022 AfterClearVectorIsEmpty,
3024 CanCompareForEquality,
3025 CanCompareForOrdering,
3027 CanEmplaceBackConstexpr,
3028 EmplaceBackIsConditionallyNoexceptRvalue,
3029 EmplaceBackIsConditionallyNoexceptLvalue,
3032 EmplaceAtPositionIsConditionallyNoexceptRvalue,
3033 EmplaceAtPositionIsConditionallyNoexceptLvalue,
3034 DefaultEmplaceIsConditionallyNoexcept,
3035 ADLSwapSwapsContentsForBasicTypes,
3037 SwapNoexceptMatchesElementType,
3038 InsertRvalueIsConditionallyNoexcept,
3039 InsertLvalueIsConditionallyNoexcept,
3040 InsertWithCountIsConditionallyNoexcept,
3041 InsertNAtEndInsertsElements,
3042 InsertNInMiddleInsertsElements,
3043 InsertFromIteratorRangeInMiddle,
3044 InsertFromIteratorRangeIsConditionallyNoexcept,
3047 CanConstructFromBiggerCapacityVector,
3048 CanAssignFromBiggerCapacityVector,
3049 CanDefaultConstructViaTryConstruct,
3050 CanConstructWithSizeViaTryConstruct,
3051 ConstructWithExcessiveSizeViaTryConstructFails,
3052 CannotTryConstructWithSizeForANonDefaultConstructibleType,
3053 CannotConstructWithSizeForANonDefaultConstructibleType,
3054 DefaultTryConstructNoexceptEvenIfDefaultConstructorNotNoexcept,
3055 ConstructWithSizeViaTryConstructNotNoexceptIfDefaultConstructorNotNoexcept,
3056 ConstructWithSizeViaNormalConstructWithDefaultConstructorNotNoexceptIsNotNoexcept,
3057 NotConstructibleWithSizeAndSourceIfDataNotCopyable,
3058 NotConstructibleFromInitializerListIfDataTypeNotCopyConstructible,
3059 CanTryConstructFromInitializerList,
3060 TryConstructFromTooLargeInitializerListReturnsEmpty,
3061 CanCopyViaTryConstruct,
3062 CanCopyViaConstruct,
3063 CanCopyViaTryConstructFromSmaller,
3064 CanCopyViaConstructFromSmaller,
3065 CanCopyViaTryConstructFromLargerWithFewerElements,
3066 FailToCopyViaTryConstructFromLargerWithMoreElements,
3067 CanCopyViaConstructFromLargerWithFewerElements,
3068 NotCopyConstructibleIfDataTypeNotCopyConstructible,
3069 CanMoveViaTryConstruct,
3070 CanMoveViaConstruct,
3071 FailToMoveViaTryConstructFromLargerWithMoreElements,
3072 NotMoveConstructibleIfDataTypeNotMoveConstructible,
3073 CanTryConstructFromIteratorRange,
3074 IteratorRangeTryConstructionIsConditionallyNoexcept,
3075 InputIteratorRangeTryConstructionIsConditionallyNoexcept
3080 PushBackBeyondMaxSizeIsPreconditionViolation,
3081 PushBackOnZeroSizeVectorIsPreconditionViolation,
3082 InsertWhenAtCapacityIsPreconditionViolation,
3083 ConstructingWithOutOfRangeSizeIsPreconditionViolation,
3084 ConstructingWithOutOfRangeSizeAndSourceIsPreconditionViolation,
3085 ConstructingWithTooManyInitializersIsPreconditionViolation,
3086 AssignIsPreconditionViolationIfSizeOverCapacity,
3087 IndexOperatorOutOfRange,
3088 EmplaceBackIsPreconditionViolationIfFull,
3089 InsertNIsPreconditionViolationIfTooManyItems,
3090 ConstructWithExcessiveSizeViaNormalConstructIsAlwaysPreconditionViolation,
3091 DereferencingInvalidIteratorIsPreconditionViolation,
3092 AddingToInvalidIteratorIsPreconditionViolation
A fixed-size array of T objects.
Definition array.hpp:77
A container similar to std::vector<T> that has a fixed capacity. The storage for the elements is held...
Definition vector.hpp:1430
Implementation of std::optional for pre-C++17 compilers, and which replaces defined undefined behavio...
Definition optional.hpp:122
A sum type which can hold either a value or an error. Similar to std::expected.
Definition result.hpp:104
ARENE_NODISCARD constexpr auto value() &noexcept -> value_type &
Accesses a reference to the content of the value channel.
Definition result.hpp:319
A backport of the constexpr std::reverse_iterator from C++17.
Definition reverse_iterator.hpp:188
The Death Tests use the same fixture as the "normal" tests. Inherits so that it will be a distinct ty...
Definition vector.hpp:350
Test fixture for all type-parameterized inline_vector tests.
Definition vector.hpp:160
typename Vector::value_type T
Definition vector.hpp:162
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:305
static constexpr bool constexpr_compatible
Whether or not the current type parameter is constexpr compatible for this test.
Definition vector.hpp:165
static constexpr std::size_t capacity
The base capacity to use for most inline_vector instantiations in the parameterized tests.
Definition vector.hpp:173
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:342
static void SetUpTestSuite()
Definition vector.hpp:177
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:328
inline_vector< ValueType, capacity > standard_capacity_vector
An inline_vector with capacity using any given type; useful in tests making vectors of wrapper types.
Definition vector.hpp:182
input_iterator_with_configurable_noexcept< U, true > non_throwing_input_iterator
An input iterator pointing to any type which declares that it can not throw, used in some noexcept te...
Definition vector.hpp:268
typedef try_construct_result
A helper template to get the type resulting from a try_construct call.
Definition vector.hpp:192
input_iterator_with_configurable_noexcept< U, false > throwing_input_iterator
An input iterator pointing to any type which declares that it could throw, used in some noexcept test...
Definition vector.hpp:264
static constexpr auto unique_test_value() noexcept
Return the N 'th test value of the current T , parameterized by test suite users.
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:320
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:336
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:281
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:314
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:274
inline_vector< T, OtherCapacity > vector_with_capacity
An inline_vector with value_type=T using any given capacity; useful in tests doing assignment.
Definition vector.hpp:186
Definition vector.hpp:1865
auto operator=(move_only_wrapper &&) -> move_only_wrapper &=default
move_only_wrapper(value_type value)
Definition vector.hpp:1870
move_only_wrapper(move_only_wrapper &&)=default
~move_only_wrapper()=default
auto get() -> value_type &
Definition vector.hpp:1878
move_only_wrapper(move_only_wrapper const &)=delete
auto operator=(move_only_wrapper const &) -> move_only_wrapper &=delete
An empty tag type corresponding to a bidirectional iterator.
Definition iterator_tags.hpp:25
Implementation of std::initializer_list for brace initialization.
Definition initializer_list.hpp:21
static constexpr value_type value
Definition integral_constant.hpp:34
Type trait to detect if an instance of To is assignable to from arguments of From.
Definition is_assignable.hpp:47
Type trait to detect if a type is constructible from arguments of the specified types.
Definition is_constructible.hpp:29
Type trait to detect if an instance of T is copy assignable.
Definition is_copy_assignable.hpp:59
Type trait to detect if an instance of T is copy constructible.
Definition is_copy_constructible.hpp:60
Type trait to detect if an instance of T is default constructible.
Definition is_default_constructible.hpp:26
Type trait to detect if an instance of T is move assignable.
Definition is_move_assignable.hpp:60
Type trait to detect if an instance of T is move constructible.
Definition is_move_constructible.hpp:59
Type trait to detect if an instance of To is assignable to from arguments of From without throwing.
Definition is_assignable.hpp:78
Type trait to detect if a type is constructible from arguments of the specified types and is noexcept...
Definition is_constructible.hpp:84
Type trait to detect if an instance of T is copy assignable without throwing.
Definition is_copy_assignable.hpp:69
Type trait to detect if an instance of T is copy constructible without throwing.
Definition is_copy_constructible.hpp:71
Type trait to detect if an instance of T is default constructible without throwing.
Definition is_default_constructible.hpp:36
Type trait to detect if an instance of T is move assignable without throwing.
Definition is_move_assignable.hpp:70
Type trait to detect if an instance of T is move constructible without throwing.
Definition is_move_constructible.hpp:70
Trait to detect if the two template parameters are the same or not. The value member is true if the t...
Definition is_same.hpp:35
provides a uniform interface to the properties of an iterator
Definition iterator_traits.hpp:90
An iterator adaptor that wraps another iterator such that dereferencing the wrapped iterator yields a...
Definition move_iterator.hpp:35
static constexpr auto max() noexcept -> T
The maximum finite value.
Definition numeric_limits.hpp:230
wraps a reference in a copyable and assignable object
Definition reference_wrapper.hpp:178
#define COND_STATIC_ASSERT_NE(left_arg, right_arg)
Call Google Test ASSERT_NE at runtime, and also statically if TypeParam is compatible.
Definition conditional_assertions.hpp:74
#define COND_STATIC_ASSERT_EQ(left_arg, right_arg)
Call Google Test ASSERT_EQ at runtime, and also statically if TypeParam is compatible.
Definition conditional_assertions.hpp:68
#define COND_STATIC_ASSERT_TRUE(...)
Call Google Test ASSERT_TRUE at runtime, and also statically if TypeParam is compatible.
Definition conditional_assertions.hpp:46
#define COND_STATIC_ASSERT_FALSE(...)
Call Google Test ASSERT_FALSE at runtime, and also statically if TypeParam is compatible.
Definition conditional_assertions.hpp:51
Provides macros used to disable and enable compiler specific diagnostics using the _Pragma operator.
#define ARENE_IGNORE_END()
Ends a region of a suppressed diagnostic.
Definition diagnostics.hpp:136
#define ARENE_IGNORE_START()
Begins a region of a suppressed diagnostic.
Definition diagnostics.hpp:131
#define ARENE_IGNORE_GCC(s, comment)
Pushes an ignore for a diagnostic into the compiler for gcc only (which includes qcc).
Definition diagnostics.hpp:113
#define ARENE_IGNORE_ALL(s, comment)
Pushes an ignore for a diagnostic into the compiler for any compiler.
Definition diagnostics.hpp:122
Provides implementation of a backport of C++20's version of std::equal.
static ARENE_MAYBE_UNUSED constexpr auto const & swap
A Customization Point Object implementation of the constexpr compatible std::swap from C++17.
Definition swap.hpp:130
Definition customization.hpp:31
constexpr auto sort_helper(Container container) noexcept -> Container
sorts the container and then returns it
Definition vector.hpp:131
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:1915
constexpr auto vector_push_back(Vector &vec, Values &&... values) -> void
Push back multiple values into a vector.
Definition vector.hpp:118
constexpr bool has_constexpr_test_value
Check whether or not a given type's test_value function works in constexpr contexts.
Definition customization.hpp:116
constexpr auto constexpr_iterate(Args &&... args) -> bool
Definition external_vector.hpp:663
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:92
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:79
constexpr auto assert_default_constructible_properties() -> void
Assert default constructible types have the expected properties.
Definition default_constructible_properties.hpp:139
constexpr auto constexpr_non_const_front(Vec &&vec) -> typename Vec::value_type
Definition vector.hpp:693
constexpr auto constexpr_pop_back(Vec &&vec) -> Vec
Definition vector.hpp:1122
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 constexpr_insert(Vec &&vec, std::ptrdiff_t offset, T &&value) -> Vec
Definition vector.hpp:1374
constexpr auto constexpr_non_const_back(Vec &&vec) -> typename Vec::value_type
Definition vector.hpp:663
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:108
constexpr auto constexpr_erase(std::size_t index, Args &&... args) -> Vec
Definition vector.hpp:854
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:103
TYPED_TEST_SUITE_P(ExternalVectorTest)
TYPED_TEST_P(ExternalVectorTest, CanConstructAnEmptyVector)
Definition external_vector.hpp:236
constexpr auto constexpr_emplace(Vec &&vec, std::ptrdiff_t pos, Arg &&arg) -> Vec
Definition vector.hpp:2050
constexpr auto erase_front(Vec &&vec, std::size_t count)
Definition vector.hpp:1806
REGISTER_TYPED_TEST_SUITE_P(ExternalVectorTest, ADLSwapSwapsContentsForBasicTypes, AfterClearVectorIsEmpty, AfterPushBackCanGetLastElement, AfterPushBackVectorIsNotEmpty, AssignFromInitListUsingAssignFunctionIsConditionallyNoexcept, AssignFromSizeAndValueIsConditionallyNoexcept, AtIndexSizeOrLargerThrows, AtIndexSizeOrLargerThrowsWithConstVec, AtOnConstVectorReturnsConstReference, AtReturnsReference, BackIsNoexcept, BackReturnsReference, CanAccessMultipleValuesWithAt, CanAccessMultipleValuesWithAtWithConstVec, CanAccessMultipleValuesWithIndexOperator, CanAssignFromBiggerCapacityVector, CanAssignFromInitListUsingAssignFunction, CanAssignFromInputIteratorRange, CanAssignFromIteratorRange, CanAssignFromSizeAndValue, CanCompareForOrdering, CanConstructAnEmptyVector, CanConstructFromInitializerList, CanConstructFromIteratorRange, CanConstructWithSize, CanConstructWithSizeAndValue, CanConstructWithSizeViaTryConstruct, CanCopyViaConstruct, CanCopyViaConstructFromLargerWithFewerElements, CanCopyViaConstructFromSmaller, CanCopyViaTryConstruct, CanCopyViaTryConstructFromLargerWithFewerElements, CanCopyViaTryConstructFromSmaller, CanDefaultConstructViaTryConstruct, CanEmplaceBack, CanEraseAtBeginning, CanEraseInMiddle, CanEraseRange, CanGetCBeginAndEnd, CanGetFront, CanGetIterator, CanInsertAtEndOfExistingVector, CanInsertInEmptyVector, CanInsertInMiddleOfExistingVector, CanIterateOverConstValues, CanIterateOverValues, CanMoveViaConstruct, CanMoveViaTryConstruct, CanPopBack, CanPushBackAValue, CanTryConstructFromInitializerList, CanTryConstructFromIteratorRange, CannotConstructWithSizeForANonDefaultConstructibleType, CannotTryConstructWithSizeForANonDefaultConstructibleType, CapacityIsAsSpecified, CapacityIsNoexcept, ConstBackReturnsConstReference, ConstructWithExcessiveSizeViaTryConstructFails, ConstructWithSizeViaNormalConstructWithDefaultConstructorNotNoexceptIsNotNoexcept, ConstructWithSizeViaTryConstructNotNoexceptIfDefaultConstructorNotNoexcept, CopyAssignOverLargerVectorDestroysExcess, CopyAssignOverLargerVectorFromInitListDestroysExcess, CopyAssignOverSmallerVectorCopiesElements, CopyAssignOverSmallerVectorFromInitListCopiesElements, CopyAssignmentIsConditionallyNoexcept, CopyingVectorCopiesElements, Data, DefaultEmplaceIsConditionallyNoexcept, DefaultTryConstructNoexceptEvenIfDefaultConstructorNotNoexcept, EmplaceAtPositionIsConditionallyNoexcept, EmplaceBackIsConditionallyNoexcept, EmplaceInsert, EmptyIfJustStorage, EmptyIsNoexcept, EmptybyDefault, EraseIsNoexceptIfTypeHasNoexceptMove, FailToCopyViaTryConstructFromLargerWithMoreElements, FailToMoveViaTryConstructFromLargerWithMoreElements, IndexOperatorIsNoexcept, IndexOperatorOnConstVectorIsNoexcept, IndexOperatorOnConstVectorReturnsConstReference, IndexOperatorReturnsReference, InitialSizeIsZero, InputIteratorRangeAssignmentIsConditionallyNoexcept, InputIteratorRangeConstructionIsConditionallyNoexcept, InputIteratorRangeTryConstructionIsConditionallyNoexcept, InsertFromIteratorRangeInMiddle, InsertFromIteratorRangeIsConditionallyNoexcept, InsertIsConditionallyNoexcept, InsertNAtEndInsertsElements, InsertNInMiddleInsertsElements, InsertWithCountIsConditionallyNoexcept, IteratorRangeAssignmentIsConditionallyNoexcept, IteratorRangeConstructionIsConditionallyNoexcept, IteratorRangeTryConstructionIsConditionallyNoexcept, IteratorTypedefs, MaxSizeEqualsCapacity, MoveAssignOverLargerVectorDestroysExcess, MoveAssignOverSmallerVectorMovesElements, MoveAssignmentIsConditionallyNoexcept, MovingVectorMovesElements, MovingVectorWithNewStorageMovesElements, NoStorageDataIsNull, NotConstructibleWithSizeAndSourceIfDataNotCopyable, NotCopyConstructible, NotCopyConstructibleIfDataTypeNotCopyConstructible, NotMoveConstructibleIfDataTypeNotMoveConstructible, PopBackIsNoexcept, PushBackIsConditionallyNoexcept, ResizeIsConditionallyNoexcept, ResizeWithValueIsConditionallyNoexcept, ResizingFromLargeToSmallLeavesElements, ResizingFromSmallToLargeConstructsElementsAsCopiesOfSpecified, RetrievingAValueWithAtReturnsValueAfterPushBack, RetrievingAValueWithAtThrowsOnEmpty, ReverseIteration, SecondPushBackChangesLastValue, SizeIsCorrect, SizeIsNoexcept, StorageOnlyTryConstructNoexceptEvenIfDefaultConstructorNotNoexcept, SwapNoexceptMatchesElementType, TryConstructFromTooLargeInitializerListReturnsEmpty, Typedefs, ZeroSizeVectorIsEmpty)
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:151
constexpr auto constexpr_clear(Vec vec) -> Vec
Definition vector.hpp:1762
constexpr bool is_fully_comparable_v
Definition external_vector.hpp:1634
constexpr auto constexpr_swap(Vec lhs, Vec rhs) -> std::pair< Vec, Vec >
Definition vector.hpp:2141
Definition accumulate.hpp:37
constexpr bool is_nothrow_swappable_v
Trait query indicating if a type can be noexcept-swapped.
constexpr std::integral_constant< std::size_t, N > array< T, N >::size
Definition array.hpp:534
constexpr std::integral_constant< bool, false > array< T, N >::empty
Definition array.hpp:540
constexpr std::integral_constant< std::size_t, N > array< T, N >::max_size
Definition array.hpp:537
constexpr auto move(InIterator first, InIterator last, OutIterator output) noexcept(noexcept(*first++) &&noexcept(output++) &&//CODEQLFP(EXP52-CPP) CODEQLFP(A5-2-6) noexcept(first !=last) &&//CODEQLFP(A5-2-6) std::is_nothrow_assignable<, typename std::iterator_traits< InIterator >::value_type >::value) -> OutIterator
Moves the elements in the range [first, last), to another range beginning at output,...
Definition move.hpp:46
constexpr bool is_greater_than_or_equal_comparable_v
constexpr void consume_values(std::initializer_list< consume_values_detail::anything > const &) noexcept
Consume a list of values and discard them. Must be called with an extra pair of braces around the exp...
Definition consume_values.hpp:73
constexpr bool substitution_succeeds
Determines if a template can be instantiated successfully, similar to C++20's requires clause.
constexpr auto copy(InputIterator first, InputIterator last, OutputIterator output) noexcept(noexcept(*(++output)) &&noexcept(*(++first)) &&noexcept(first !=last) &&std::is_nothrow_assignable<, typename std::iterator_traits< InputIterator >::reference >::value) -> OutputIterator
Copies the elements in the range, defined by [first, last), to another range beginning at output.
Definition copy.hpp:40
constexpr bool is_less_than_comparable_v
constexpr bool is_less_than_or_equal_comparable_v
constexpr bool is_greater_than_comparable_v
Definition accumulate.hpp:36
typedef nullptr_t
The type of nullptr.
Definition cstddef.hpp:33
::ptrdiff_t ptrdiff_t
A type suitable for holding the difference between two pointers.
Definition cstddef.hpp:31
constexpr auto move(T &&value) noexcept -> remove_reference_t< T > &&
Cast a value to an rvalue.
Definition move.hpp:30
make_integer_sequence< size_t, Size > make_index_sequence
A helper alias template for make_integer_sequence<size_t, Size>
Definition integer_sequence.hpp:224
integer_sequence< size_t, Ints... > index_sequence
A helper alias template for integer_sequence<size_t, Ints>
Definition integer_sequence.hpp:218
::size_t size_t
A type suitable for holding the size of an object.
Definition cstddef.hpp:29
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...
auto make_move_iterator(Iterator iter) -> std::move_iterator< Iterator >
Create a move_iterator with the specified underlying iterator.
Definition move_iterator.hpp:353
constexpr auto addressof(T &value) noexcept -> T *
Obtains the actual address of the object or function arg, even in presence of overloaded operator&.
Definition addressof.hpp:24
constexpr auto forward(remove_reference_t< T > &value) noexcept -> T &&
Cast a value to an rvalue if T is an rvalue or rvalue reference, otherwise forward an lvalue referenc...
Definition forward.hpp:24
Provides a backport of the constexpr implementation of std::reverse_iterator .
A bidirectional iterator of T which declares that it could throw, used in some noexcept tests.
Definition vector.hpp:203
T value_type
The value type pointed to by this iterator.
Definition vector.hpp:211
std::ptrdiff_t difference_type
The type used for differences in this iterator.
Definition vector.hpp:207
auto operator*() const -> reference
Dereference operator; never defined.
void pointer
This iterator as a pointer (disabled)
Definition vector.hpp:213
T && reference
The type returned by dereferencing this iterator.
Definition vector.hpp:209
std::bidirectional_iterator_tag iterator_category
The category of this iterator.
Definition vector.hpp:205
A type with a noexcept(false) conversion operator to T (doesn't actually throw, just declares it)
Definition vector.hpp:195
constexpr auto operator()(T const &arg) -> bool
Definition vector.hpp:65
T const & value
Definition vector.hpp:67
constexpr equal_to_value(T const &input)
Definition vector.hpp:63
Definition external_vector.hpp:1707
throws_without_nullptr(T const &)
Definition vector.hpp:1954
throws_without_nullptr(T const &, std::nullptr_t) noexcept
Definition vector.hpp:1955
#define CONDITIONAL_TYPED_TEST_P(SuiteName, TestName,...)
Adds a type-parameterized test to a Google Test suite which is conditionally run based on the third p...
Definition conditional_tests.hpp:33