diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 17:57:32 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 17:57:32 +0000 |
commit | cd749a9c07f1de2fb8affde90537efa4bc3e7c54 (patch) | |
tree | b21f6de4e08b89bb7931806bab798fc2a5e3a686 /unittests/ADT/StringMapTest.cpp | |
parent | 72621d11de5b873f1695f391eb95f0b336c3d2d4 (diff) | |
download | FreeBSD-src-cd749a9c07f1de2fb8affde90537efa4bc3e7c54.zip FreeBSD-src-cd749a9c07f1de2fb8affde90537efa4bc3e7c54.tar.gz |
Update llvm to r84119.
Diffstat (limited to 'unittests/ADT/StringMapTest.cpp')
-rw-r--r-- | unittests/ADT/StringMapTest.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/unittests/ADT/StringMapTest.cpp b/unittests/ADT/StringMapTest.cpp index 9f9f2e4..8ee166b 100644 --- a/unittests/ADT/StringMapTest.cpp +++ b/unittests/ADT/StringMapTest.cpp @@ -9,6 +9,7 @@ #include "gtest/gtest.h" #include "llvm/ADT/StringMap.h" +#include "llvm/Support/DataTypes.h" using namespace llvm; namespace { @@ -21,7 +22,7 @@ protected: static const char testKey[]; static const uint32_t testValue; static const char* testKeyFirst; - static const char* testKeyLast; + static size_t testKeyLength; static const std::string testKeyStr; void assertEmptyMap() { @@ -34,10 +35,11 @@ protected: // Lookup tests EXPECT_EQ(0u, testMap.count(testKey)); - EXPECT_EQ(0u, testMap.count(testKeyFirst, testKeyLast)); + 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(testKeyFirst, testKeyLast) == testMap.end()); + EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) == + testMap.end()); EXPECT_TRUE(testMap.find(testKeyStr) == testMap.end()); } @@ -56,10 +58,11 @@ protected: // Lookup tests EXPECT_EQ(1u, testMap.count(testKey)); - EXPECT_EQ(1u, testMap.count(testKeyFirst, testKeyLast)); + 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(testKeyFirst, testKeyLast) == testMap.begin()); + EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) == + testMap.begin()); EXPECT_TRUE(testMap.find(testKeyStr) == testMap.begin()); } }; @@ -67,7 +70,7 @@ protected: const char StringMapTest::testKey[] = "key"; const uint32_t StringMapTest::testValue = 1u; const char* StringMapTest::testKeyFirst = testKey; -const char* StringMapTest::testKeyLast = testKey + sizeof(testKey) - 1; +size_t StringMapTest::testKeyLength = sizeof(testKey) - 1; const std::string StringMapTest::testKeyStr(testKey); // Empty map tests. @@ -89,10 +92,10 @@ TEST_F(StringMapTest, ConstEmptyMapTest) { // Lookup tests EXPECT_EQ(0u, constTestMap.count(testKey)); - EXPECT_EQ(0u, constTestMap.count(testKeyFirst, testKeyLast)); + EXPECT_EQ(0u, constTestMap.count(StringRef(testKeyFirst, testKeyLength))); EXPECT_EQ(0u, constTestMap.count(testKeyStr)); EXPECT_TRUE(constTestMap.find(testKey) == constTestMap.end()); - EXPECT_TRUE(constTestMap.find(testKeyFirst, testKeyLast) == + EXPECT_TRUE(constTestMap.find(StringRef(testKeyFirst, testKeyLength)) == constTestMap.end()); EXPECT_TRUE(constTestMap.find(testKeyStr) == constTestMap.end()); } @@ -185,7 +188,7 @@ namespace { TEST_F(StringMapTest, StringMapEntryTest) { StringMap<uint32_t>::value_type* entry = StringMap<uint32_t>::value_type::Create( - testKeyFirst, testKeyLast, 1u); + testKeyFirst, testKeyFirst + testKeyLength, 1u); EXPECT_STREQ(testKey, entry->first()); EXPECT_EQ(1u, entry->second); } @@ -195,7 +198,8 @@ TEST_F(StringMapTest, InsertTest) { SCOPED_TRACE("InsertTest"); testMap.insert( StringMap<uint32_t>::value_type::Create( - testKeyFirst, testKeyLast, testMap.getAllocator(), 1u)); + testKeyFirst, testKeyFirst + testKeyLength, + testMap.getAllocator(), 1u)); assertSingleItemMap(); } |