Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1417)

Unified Diff: base/containers/hash_tables_unittest.cc

Issue 612323010: Align base::hash_map with C++11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try a different tack for C++ insanity Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/containers/hash_tables_unittest.cc
diff --git a/base/containers/hash_tables_unittest.cc b/base/containers/hash_tables_unittest.cc
index 65724ecae224d67c991a685fbf3459df4ee1c5ab..60fbeaabc099c7cd967ac5c6c6409160fa0413cf 100644
--- a/base/containers/hash_tables_unittest.cc
+++ b/base/containers/hash_tables_unittest.cc
@@ -4,6 +4,8 @@
#include "base/containers/hash_tables.h"
+#include <string>
+
#include "base/basictypes.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -50,4 +52,16 @@ TEST_F(HashPairTest, IntegerPairs) {
(GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
}
+// Verify that base::hash_set<const char*> compares by pointer value, not as C
+// strings.
+TEST(HashTableTest, CharPointers) {
+ std::string str1("hello");
+ std::string str2("hello");
+ base::hash_set<const char*> set;
+
+ set.insert(str1.c_str());
+ EXPECT_EQ(1u, set.count(str1.c_str()));
+ EXPECT_EQ(0u, set.count(str2.c_str()));
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698