test/util/TestIntrusiveTreeSet: add constant_time_size test
This commit is contained in:
parent
6dce8dcaa5
commit
eb1463fd7c
|
@ -26,12 +26,16 @@ struct IntItem final : IntrusiveTreeSetHook<IntrusiveHookMode::TRACK> {
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
TEST(IntrusiveTreeSet, Basic)
|
template<bool constant_time_size>
|
||||||
|
static void
|
||||||
|
TestBasic()
|
||||||
{
|
{
|
||||||
IntItem a{1}, b{2}, c{3}, d{4}, e{5}, f{1};
|
IntItem a{1}, b{2}, c{3}, d{4}, e{5}, f{1};
|
||||||
|
|
||||||
IntrusiveTreeSet<IntItem,
|
IntrusiveTreeSet<IntItem,
|
||||||
IntrusiveTreeSetOperators<IntItem, IntItem::GetKey>> set;
|
IntrusiveTreeSetOperators<IntItem, IntItem::GetKey>,
|
||||||
|
IntrusiveTreeSetBaseHookTraits<IntItem>,
|
||||||
|
IntrusiveTreeSetOptions{.constant_time_size=constant_time_size}> set;
|
||||||
|
|
||||||
EXPECT_EQ(set.size(), 0U);
|
EXPECT_EQ(set.size(), 0U);
|
||||||
EXPECT_TRUE(set.empty());
|
EXPECT_TRUE(set.empty());
|
||||||
|
@ -120,6 +124,12 @@ TEST(IntrusiveTreeSet, Basic)
|
||||||
EXPECT_EQ(f.value, 1);
|
EXPECT_EQ(f.value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(IntrusiveTreeSet, Basic)
|
||||||
|
{
|
||||||
|
TestBasic<false>();
|
||||||
|
TestBasic<true>();
|
||||||
|
}
|
||||||
|
|
||||||
template<int... values>
|
template<int... values>
|
||||||
static constexpr auto
|
static constexpr auto
|
||||||
MakeIntItems(std::integer_sequence<int, values...>) noexcept
|
MakeIntItems(std::integer_sequence<int, values...>) noexcept
|
||||||
|
|
Loading…
Reference in New Issue