[llvm] [ADT] Add DenseSet::insert_range (PR #131567)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 17 09:28:14 PDT 2025


================
@@ -32,6 +32,17 @@ TEST(DenseSetTest, DoubleEntrySetTest) {
   EXPECT_EQ(0u, set.count(2));
 }
 
+TEST(DenseSetTest, InsertRange) {
+  llvm::DenseSet<unsigned> set1;
+  llvm::DenseSet<unsigned> set2;
+  set1.insert(1);
+  set1.insert(2);
+  set1.insert(3);
+  constexpr unsigned Args[] = {3, 1, 2};
+  set2.insert_range(Args);
+  EXPECT_EQ(set1, set2);
----------------
kuhar wrote:

You can also do `EXPECT_THAT(set, UnorderedElementsAre(1, 2, 3))`;

https://github.com/llvm/llvm-project/pull/131567


More information about the llvm-commits mailing list