aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/StringMapTest.cpp
diff options
context:
space:
mode:
authorWei Yi Tee <wyt@google.com>2022-08-29 06:43:48 +0000
committerWei Yi Tee <wyt@google.com>2022-08-29 06:43:48 +0000
commitaf6a35597f6466c22fb9c7119fdd48f4b3e5cd00 (patch)
treef3936c440f56f75cea2c38866b47348a7962625e /llvm/unittests/ADT/StringMapTest.cpp
parentd23df9c9e81e186c3218bd924976fbd646f3bad1 (diff)
downloadllvm-af6a35597f6466c22fb9c7119fdd48f4b3e5cd00.zip
llvm-af6a35597f6466c22fb9c7119fdd48f4b3e5cd00.tar.gz
llvm-af6a35597f6466c22fb9c7119fdd48f4b3e5cd00.tar.bz2
Revert "[llvm][ADT] Fix formatting for files relevant to `StringMap`."
This reverts commit d23df9c9e81e186c3218bd924976fbd646f3bad1. Revert due to missing review link.
Diffstat (limited to 'llvm/unittests/ADT/StringMapTest.cpp')
-rw-r--r--llvm/unittests/ADT/StringMapTest.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/llvm/unittests/ADT/StringMapTest.cpp b/llvm/unittests/ADT/StringMapTest.cpp
index e5dae25..1eac07b 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,11 +91,13 @@ 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());
@@ -218,8 +220,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());
@@ -246,8 +248,10 @@ 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();
}
@@ -282,7 +286,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);
@@ -354,13 +358,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;
@@ -586,7 +590,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) {