6 #include "testing/testing.h"
10 TEST(vector_set, DefaultConstructor)
17 TEST(vector_set, InitializerListConstructor_WithoutDuplicates)
26 TEST(vector_set, InitializerListConstructor_WithDuplicates)
46 TEST(vector_set, CopyAssignment)
65 TEST(vector_set, MoveAssignment)
69 set2 = std::move(set1);
74 TEST(vector_set, AddNewIncreasesSize)
84 TEST(vector_set, AddExistingDoesNotIncreaseSize)
88 EXPECT_TRUE(set.
add(5));
90 EXPECT_FALSE(set.
add(5));
111 TEST(vector_set, RemoveContained)
131 TEST(vector_set, AddMultipleTimes)
134 for (
int i = 0; i < 100; i++) {
142 TEST(vector_set, UniquePtrValue)
145 set.
add_new(std::make_unique<int>());
146 set.
add(std::make_unique<int>());
148 std::unique_ptr<int> value = set.
pop();
155 EXPECT_TRUE(set.
add(5));
157 EXPECT_FALSE(set.
remove(6));
159 EXPECT_TRUE(set.
remove(5));
161 EXPECT_FALSE(set.
remove(5));
165 TEST(vector_set, SpanConstructorExceptions)
167 std::array<ExceptionThrower, 5>
array = {1, 2, 3, 4, 5};
168 array[3].throw_during_copy =
true;
174 TEST(vector_set, CopyConstructorExceptions)
177 set[3].throw_during_copy =
true;
182 TEST(vector_set, MoveConstructorExceptions)
185 set[3].throw_during_copy =
true;
186 set[3].throw_during_move =
true;
194 TEST(vector_set, AddNewExceptions)
199 EXPECT_ANY_THROW({ set.
add_new(value); });
201 EXPECT_ANY_THROW({ set.
add_new(value); });
205 TEST(vector_set, AddExceptions)
210 EXPECT_ANY_THROW({ set.
add(value); });
212 EXPECT_ANY_THROW({ set.
add(value); });
216 TEST(vector_set, ReserveExceptions)
220 set[2].throw_during_move =
true;
221 EXPECT_ANY_THROW({ set.
reserve(100); });
224 TEST(vector_set, PopExceptions)
227 set.
as_span().last().throw_during_move =
true;
229 EXPECT_ANY_THROW({ set.
pop(); });
274 TEST(vector_set, GrowWhenEmpty)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
Span< Key > as_span() const
int64_t index_of(const Key &key) const
void reserve(const int64_t n)
const Key & lookup_key(const Key &key) const
void add_new(const Key &key)
const Key * lookup_key_ptr(const Key &key) const
const Key & lookup_key_as(const ForwardKey &key) const
int64_t index_of_try(const Key &key) const
const Key * lookup_key_ptr_as(const ForwardKey &key) const
void remove_contained(const Key &key)
bool contains(const Key &key) const
int64_t index_of_or_add(const Key &key)
void add_multiple(Span< Key > keys)
bool remove(const Key &key)
TEST(any, DefaultConstructor)