Index: base/containers/scoped_ptr_map_unittest.cc |
diff --git a/base/containers/scoped_ptr_map_unittest.cc b/base/containers/scoped_ptr_map_unittest.cc |
index ef70440f758121ca82601ff0692e74c39351cd4a..1d8f179b0675e759c5a818062d3a62db68da0fd4 100644 |
--- a/base/containers/scoped_ptr_map_unittest.cc |
+++ b/base/containers/scoped_ptr_map_unittest.cc |
@@ -4,6 +4,7 @@ |
#include "base/containers/scoped_ptr_map.h" |
+#include <functional> |
#include <map> |
#include <utility> |
@@ -143,6 +144,19 @@ TEST(ScopedPtrMapTest, Clear) { |
EXPECT_TRUE(scoped_map.empty()); |
} |
+TEST(ScopedPtrMapTest, Compare) { |
+ // Construct a ScopedPtrMap with a custom comparison function. |
+ bool destroyed = false; |
+ ScopedPtrMap<int, scoped_ptr<ScopedDestroyer>, std::greater<int>> scoped_map; |
+ scoped_map.insert(0, make_scoped_ptr(new ScopedDestroyer(&destroyed))); |
+ scoped_map.insert(1, make_scoped_ptr(new ScopedDestroyer(&destroyed))); |
+ |
+ auto it = scoped_map.begin(); |
+ EXPECT_EQ(1, it->first); |
+ ++it; |
+ EXPECT_EQ(0, it->first); |
+} |
+ |
TEST(ScopedPtrMapTest, Scope) { |
bool destroyed = false; |
{ |