aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/StringMapTest.cpp
diff options
context:
space:
mode:
authorWei Yi Tee <wyt@google.com>2022-08-26 18:21:29 +0000
committerWei Yi Tee <wyt@google.com>2022-08-29 06:40:07 +0000
commitd23df9c9e81e186c3218bd924976fbd646f3bad1 (patch)
treeeb38b3aea548eff09637926e8cd4bbd1494ce259 /llvm/unittests/ADT/StringMapTest.cpp
parent20f0f15a4055d66fae494fc79bd76f14dee3954f (diff)
downloadllvm-d23df9c9e81e186c3218bd924976fbd646f3bad1.zip
llvm-d23df9c9e81e186c3218bd924976fbd646f3bad1.tar.gz
llvm-d23df9c9e81e186c3218bd924976fbd646f3bad1.tar.bz2
[llvm][ADT] Fix formatting for files relevant to `StringMap`.
Diffstat (limited to 'llvm/unittests/ADT/StringMapTest.cpp')
-rw-r--r--llvm/unittests/ADT/StringMapTest.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/llvm/unittests/ADT/StringMapTest.cpp b/llvm/unittests/ADT/StringMapTest.cpp
index 1eac07b..e5dae25 100644
--- a/llvm/unittests/ADT/StringMapTest.cpp
+++ b/llvm/unittests/ADT/StringMapTest.cpp
@@ -28,7 +28,7 @@ protected:
static const char testKey[];
static const uint32_t testValue;
- static const char* testKeyFirst;
+ static const char *testKeyFirst;
static size_t testKeyLength;
static const std::string testKeyStr;
@@ -45,7 +45,7 @@ protected:
EXPECT_EQ(0u, testMap.count(StringRef(testKeyFirst, testKeyLength)));
EXPECT_EQ(0u, testMap.count(testKeyStr));
EXPECT_TRUE(testMap.find(testKey) == testMap.end());
- EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) ==
+ EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) ==
testMap.end());
EXPECT_TRUE(testMap.find(testKeyStr) == testMap.end());
}
@@ -68,7 +68,7 @@ protected:
EXPECT_EQ(1u, testMap.count(StringRef(testKeyFirst, testKeyLength)));
EXPECT_EQ(1u, testMap.count(testKeyStr));
EXPECT_TRUE(testMap.find(testKey) == testMap.begin());
- EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) ==
+ EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) ==
testMap.begin());
EXPECT_TRUE(testMap.find(testKeyStr) == testMap.begin());
}
@@ -76,7 +76,7 @@ protected:
const char StringMapTest::testKey[] = "key";
const uint32_t StringMapTest::testValue = 1u;
-const char* StringMapTest::testKeyFirst = testKey;
+const char *StringMapTest::testKeyFirst = testKey;
size_t StringMapTest::testKeyLength = sizeof(testKey) - 1;
const std::string StringMapTest::testKeyStr(testKey);
@@ -91,13 +91,11 @@ struct CountCopyAndMove {
};
// Empty map tests.
-TEST_F(StringMapTest, EmptyMapTest) {
- assertEmptyMap();
-}
+TEST_F(StringMapTest, EmptyMapTest) { assertEmptyMap(); }
// Constant map tests.
TEST_F(StringMapTest, ConstEmptyMapTest) {
- const StringMap<uint32_t>& constTestMap = testMap;
+ const StringMap<uint32_t> &constTestMap = testMap;
// Size tests
EXPECT_EQ(0u, constTestMap.size());
@@ -220,8 +218,8 @@ TEST_F(StringMapTest, IterationTest) {
}
// Iterate over all numbers and mark each one found.
- for (StringMap<uint32_t>::iterator it = testMap.begin();
- it != testMap.end(); ++it) {
+ for (StringMap<uint32_t>::iterator it = testMap.begin(); it != testMap.end();
+ ++it) {
std::stringstream ss;
ss << "key_" << it->second;
ASSERT_STREQ(ss.str().c_str(), it->first().data());
@@ -248,10 +246,8 @@ TEST_F(StringMapTest, StringMapEntryTest) {
// Test insert() method.
TEST_F(StringMapTest, InsertTest) {
SCOPED_TRACE("InsertTest");
- testMap.insert(
- StringMap<uint32_t>::value_type::Create(
- StringRef(testKeyFirst, testKeyLength),
- testMap.getAllocator(), 1u));
+ testMap.insert(StringMap<uint32_t>::value_type::Create(
+ StringRef(testKeyFirst, testKeyLength), testMap.getAllocator(), 1u));
assertSingleItemMap();
}
@@ -286,7 +282,7 @@ TEST_F(StringMapTest, InsertRehashingPairTest) {
EXPECT_EQ(0u, t.getNumBuckets());
StringMap<uint32_t>::iterator It =
- t.insert(std::make_pair("abcdef", 42)).first;
+ t.insert(std::make_pair("abcdef", 42)).first;
EXPECT_EQ(16u, t.getNumBuckets());
EXPECT_EQ("abcdef", It->first());
EXPECT_EQ(42u, It->second);
@@ -358,13 +354,13 @@ TEST_F(StringMapTest, NonDefaultConstructable) {
struct Immovable {
Immovable() {}
- Immovable(Immovable&&) = delete; // will disable the other special members
+ Immovable(Immovable &&) = delete; // will disable the other special members
};
struct MoveOnly {
int i;
MoveOnly(int i) : i(i) {}
- MoveOnly(const Immovable&) : i(0) {}
+ MoveOnly(const Immovable &) : i(0) {}
MoveOnly(MoveOnly &&RHS) : i(RHS.i) {}
MoveOnly &operator=(MoveOnly &&RHS) {
i = RHS.i;
@@ -590,7 +586,7 @@ struct NonMoveableNonCopyableType {
NonMoveableNonCopyableType(const NonMoveableNonCopyableType &) = delete;
NonMoveableNonCopyableType(NonMoveableNonCopyableType &&) = delete;
};
-}
+} // namespace
// Test that we can "emplace" an element in the map without involving map/move
TEST(StringMapCustomTest, EmplaceTest) {