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

Unified Diff: base/containers/hash_tables_unittest.cc

Issue 623383002: Align base::hash_map with C++11, part 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hash-1
Patch Set: clean up stale includes 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
« no previous file with comments | « base/containers/hash_tables.h ('k') | base/containers/small_map_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « base/containers/hash_tables.h ('k') | base/containers/small_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698