1 //===- llvm/unittest/ADT/StringSetTest.cpp - StringSet unit tests ----------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/ADT/StringSet.h"
10 #include "gtest/gtest.h"
16 class StringSetTest
: public testing::Test
{};
18 TEST_F(StringSetTest
, IterSetKeys
) {
25 auto Keys
= to_vector
<4>(Set
.keys());
28 SmallVector
<StringRef
, 4> Expected
= {"A", "B", "C", "D"};
29 EXPECT_EQ(Expected
, Keys
);
32 TEST_F(StringSetTest
, InsertAndCountStringMapEntry
) {
33 // Test insert(StringMapEntry) and count(StringMapEntry)
34 // which are required for set_difference(StringSet, StringSet).
36 StringMapEntry
<StringRef
> *Element
= StringMapEntry
<StringRef
>::Create("A");
38 size_t Count
= Set
.count(*Element
);
40 EXPECT_EQ(Expected
, Count
);
44 } // end anonymous namespace