From eb1463fd7c7b1e69b94c9a3d478b2fe06b2f0164 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 12 Nov 2024 08:12:41 +0100 Subject: [PATCH] test/util/TestIntrusiveTreeSet: add constant_time_size test --- test/util/TestIntrusiveTreeSet.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/util/TestIntrusiveTreeSet.cxx b/test/util/TestIntrusiveTreeSet.cxx index 06ffc537f..96d644da8 100644 --- a/test/util/TestIntrusiveTreeSet.cxx +++ b/test/util/TestIntrusiveTreeSet.cxx @@ -26,12 +26,16 @@ struct IntItem final : IntrusiveTreeSetHook { } // anonymous namespace -TEST(IntrusiveTreeSet, Basic) +template +static void +TestBasic() { IntItem a{1}, b{2}, c{3}, d{4}, e{5}, f{1}; IntrusiveTreeSet> set; + IntrusiveTreeSetOperators, + IntrusiveTreeSetBaseHookTraits, + IntrusiveTreeSetOptions{.constant_time_size=constant_time_size}> set; EXPECT_EQ(set.size(), 0U); EXPECT_TRUE(set.empty()); @@ -120,6 +124,12 @@ TEST(IntrusiveTreeSet, Basic) EXPECT_EQ(f.value, 1); } +TEST(IntrusiveTreeSet, Basic) +{ + TestBasic(); + TestBasic(); +} + template static constexpr auto MakeIntItems(std::integer_sequence) noexcept