diff options
author | Bill Wendling <isanbard@gmail.com> | 2009-01-08 08:26:46 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2009-01-08 08:26:46 +0000 |
commit | 691c20d8fbfcd5915bd64ec66c370a85b6f92020 (patch) | |
tree | c54b121c970457c8e5389bee5da6255dad2c4649 /llvm/unittests/ADT/StringMapTest.cpp | |
parent | 55927bdccd6f0c3788bd59d724c91af8d8d615cf (diff) | |
download | llvm-691c20d8fbfcd5915bd64ec66c370a85b6f92020.zip llvm-691c20d8fbfcd5915bd64ec66c370a85b6f92020.tar.gz llvm-691c20d8fbfcd5915bd64ec66c370a85b6f92020.tar.bz2 |
* Don't explicitly cast "0" to "void*". This doesn't work well with specialized
StringMapEntryInitializer classes. Leave it for the compiler to figure out what
the type is and what "0" should be transformed into.
* Un-disable the unit tests which test the StringMapEntryInitializer class.
llvm-svn: 61922
Diffstat (limited to 'llvm/unittests/ADT/StringMapTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/StringMapTest.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/llvm/unittests/ADT/StringMapTest.cpp b/llvm/unittests/ADT/StringMapTest.cpp index 3f135f6..bceff19 100644 --- a/llvm/unittests/ADT/StringMapTest.cpp +++ b/llvm/unittests/ADT/StringMapTest.cpp @@ -11,6 +11,19 @@ #include "llvm/ADT/StringMap.h" using namespace llvm; +namespace llvm { + +template <> +class StringMapEntryInitializer<uint32_t> { +public: + template <typename InitTy> + static void Initialize(StringMapEntry<uint32_t> &T, InitTy InitVal) { + T.second = InitVal; + } +}; + +} + namespace { // Test fixture @@ -140,10 +153,11 @@ TEST_F(StringMapTest, InsertAndEraseTest) { // Test StringMapEntry::Create() method. // DISABLED because this fails without a StringMapEntryInitializer, and // I can't get it to compile with one. -TEST_F(StringMapTest, DISABLED_StringMapEntryTest) { +TEST_F(StringMapTest, StringMapEntryTest) { + MallocAllocator A; StringMap<uint32_t>::value_type* entry = StringMap<uint32_t>::value_type::Create( - testKeyFirst, testKeyLast, 1u); + testKeyFirst, testKeyLast, A, 1u); EXPECT_STREQ(testKey, entry->first()); EXPECT_EQ(1u, entry->second); } @@ -151,7 +165,7 @@ TEST_F(StringMapTest, DISABLED_StringMapEntryTest) { // Test insert() method // DISABLED because this fails without a StringMapEntryInitializer, and // I can't get it to compile with one. -TEST_F(StringMapTest, DISABLED_InsertTest) { +TEST_F(StringMapTest, InsertTest) { SCOPED_TRACE("InsertTest"); testMap.insert( StringMap<uint32_t>::value_type::Create( |