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

Unified Diff: base/strings/string16_unittest.cc

Issue 1502373009: Allow std::unordered_*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, more HashPair -> HashInts Created 4 years, 11 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/strings/string16.h ('k') | base/strings/string_piece.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/string16_unittest.cc
diff --git a/base/strings/string16_unittest.cc b/base/strings/string16_unittest.cc
index 4e582181a863aa5114deb33ffc0e860b14f5385a..0d2ca808e92918fedff2d3243cc9e30ecbea0565 100644
--- a/base/strings/string16_unittest.cc
+++ b/base/strings/string16_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <sstream>
+#include <unordered_set>
#include "base/strings/string16.h"
@@ -11,8 +12,6 @@
namespace base {
-#if defined(WCHAR_T_IS_UTF32)
-
// We define a custom operator<< for string16 so we can use it with logging.
// This tests that conversion.
TEST(String16Test, OutputStream) {
@@ -53,6 +52,15 @@ TEST(String16Test, OutputStream) {
}
}
-#endif
+TEST(String16Test, Hash) {
+ string16 str1 = ASCIIToUTF16("hello");
+ string16 str2 = ASCIIToUTF16("world");
+
+ std::unordered_set<string16> set;
+
+ set.insert(str1);
+ EXPECT_EQ(1u, set.count(str1));
+ EXPECT_EQ(0u, set.count(str2));
+}
} // namespace base
« no previous file with comments | « base/strings/string16.h ('k') | base/strings/string_piece.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698