7#include "testing/testing.h"
33 char *
ptr = &(*vec)[0];
36 const char magic = 42;
68 std::array<float, 5> values = {5.4f, 7.3f, -8.1f, 5.0f, 0.0f};
107 std::forward_list<int> list;
140 EXPECT_NE(vec1.
data(), vec2.
data());
154 EXPECT_NE(vec1.
data(), vec2.
data());
165 EXPECT_NE(vec1.
data(), vec2.
data());
299 std::forward_list<int> list = {8, 9};
300 vec.
extend(list.begin(), list.end());
302 EXPECT_EQ_ARRAY(vec.
data(),
Span({3, 4, 5, 8, 9}).
data(), 5);
309 for (
int value : vec) {
318 for (
int i = 0; i < 100; i++) {
322 for (
int i = 0; i < 100; i++) {
428 const int64_t removed = vec.
remove_if([](
const int x) {
return x % 2 == 0; });
432 EXPECT_EQ_ARRAY(vec.
data(), expected_vec.
data(),
size_t(vec.
size()));
442 vec.
remove_if([&](
const auto & ) {
return true; });
461 int array[] = {3, 4, 5, 6};
484 a.append_n_times(2, 2);
496 vec.
append(std::make_unique<int>());
497 vec.
append(std::make_unique<int>());
498 vec.
append(std::make_unique<int>());
499 vec.
append(std::make_unique<int>());
502 std::unique_ptr<int> &a = vec.
last();
528 if (
this == &other) {
538 if (
this == &other) {
550 EXPECT_TRUE(vec[0].default_constructed);
551 EXPECT_TRUE(vec[1].default_constructed);
552 EXPECT_TRUE(vec[2].default_constructed);
558 EXPECT_TRUE(vec[0].copy_constructed);
559 EXPECT_TRUE(vec[1].copy_constructed);
560 EXPECT_TRUE(vec[2].copy_constructed);
568 EXPECT_TRUE(vec[0].copy_constructed);
575 EXPECT_TRUE(vec[0].move_constructed);
582 EXPECT_TRUE(dst[0].copy_constructed);
583 EXPECT_TRUE(dst[1].copy_constructed);
590 EXPECT_TRUE(dst[0].copy_constructed);
591 EXPECT_TRUE(dst[1].copy_constructed);
598 EXPECT_TRUE(dst[0].move_constructed);
599 EXPECT_TRUE(dst[1].move_constructed);
607 EXPECT_TRUE(dst[0].default_constructed);
608 EXPECT_FALSE(dst[0].move_constructed);
609 EXPECT_FALSE(dst[0].copy_constructed);
614 std::string long_string =
"012345678901234567890123456789";
621 vec.
resize(5, long_string);
654 for (
int i = 0; i < 100; i++) {
686 EXPECT_EQ_ARRAY(vec.
data(),
Span({6, 7, 1, 2, 3}).
data(), 5);
694 EXPECT_EQ_ARRAY(vec.
data(),
Span({1, 2, 3, 6, 7}).
data(), 5);
702 EXPECT_EQ_ARRAY(vec.
data(),
Span({1, 6, 7, 2, 3}).
data(), 5);
717 vec.
append(std::make_unique<int>(1));
718 vec.
append(std::make_unique<int>(2));
719 vec.
insert(1, std::make_unique<int>(30));
731 EXPECT_EQ_ARRAY(vec.
data(),
Span({7, 8, 1, 2, 3}).
data(), 5);
736 std::string s =
"test";
749 for (
auto it = vec.
rbegin(); it != vec.
rend(); ++it) {
753 EXPECT_EQ_ARRAY(reversed_vec.
data(),
Span({7, 6, 5, 4}).
data(), 4);
765 std::array<ExceptionThrower, 5> values;
766 values[3].throw_during_copy =
true;
773 vec[2].throw_during_move =
true;
783 EXPECT_ANY_THROW({ vec.
append(value); });
792 std::array<ExceptionThrower, 10> values;
793 values[6].throw_during_copy =
true;
794 EXPECT_ANY_THROW({ vec.
extend(values); });
801 std::array<ExceptionThrower, 5> values;
802 values[3].throw_during_copy =
true;
803 EXPECT_ANY_THROW({ vec.
insert(7, values); });
810 vec[8].throw_during_move =
true;
811 std::array<ExceptionThrower, 5> values;
812 EXPECT_ANY_THROW({ vec.
insert(3, values); });
818 vec.
last().throw_during_move =
true;
819 EXPECT_ANY_THROW({ vec.
pop_last(); });
826 vec.
last().throw_during_move =
true;
834 vec[8].throw_during_move =
true;
835 EXPECT_ANY_THROW({ vec.
remove(2); });
866 vec[5].throw_during_move =
true;
867 EXPECT_ANY_THROW({ vec.
remove(2, 3); });
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
ATTR_WARN_UNUSED_RESULT const BMVert * v
constexpr const T * data() const
constexpr const T * begin() const
std::reverse_iterator< T * > rbegin()
void remove_and_reorder(const int64_t index)
int64_t remove_if(Predicate &&predicate)
int64_t append_and_get_index(const T &value)
void prepend(const T &value)
void append(const T &value)
void insert(const int64_t insert_index, const T &value)
const T & last(const int64_t n=0) const
void remove(const int64_t index)
void remove_first_occurrence_and_reorder(const T &value)
void resize(const int64_t new_size)
int64_t first_index_of(const T &value) const
void reserve(const int64_t min_capacity)
std::reverse_iterator< T * > rend()
void extend(Span< T > array)
void extend_non_duplicates(Span< T > array)
void append_non_duplicates(const T &value)
void fill(const T &value) const
void append_as(ForwardValue &&...value)
int64_t first_index_of_try(const T &value) const
void append_n_times(const T &value, const int64_t n)
TypeConstructMock(const TypeConstructMock &)
TypeConstructMock(TypeConstructMock &&) noexcept
TypeConstructMock & operator=(TypeConstructMock &&other) noexcept
TypeConstructMock & operator=(const TypeConstructMock &other)
local_group_size(16, 16) .push_constant(Type b
TEST(any, DefaultConstructor)
static Vector< int > return_by_value_helper()
_W64 unsigned int uintptr_t
Vector< RecursiveType, 0 > my_vector
static int magic(const Tex *tex, const float texvec[3], TexResult *texres)