Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / base / containers / hash_tables_unittest.cc
index 65724ec..60fbeaa 100644 (file)
@@ -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