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

Unified Diff: Source/wtf/VectorTest.cpp

Issue 332113002: VectorComparer should check null. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add tests Created 6 years, 6 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 | « Source/wtf/Vector.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/VectorTest.cpp
diff --git a/Source/wtf/VectorTest.cpp b/Source/wtf/VectorTest.cpp
index c099e684ae9c4bba8c9744b59cea179a6aaf52ef..3c1e4783e83e071bf2d14d519c87c356422abfab 100644
--- a/Source/wtf/VectorTest.cpp
+++ b/Source/wtf/VectorTest.cpp
@@ -28,6 +28,7 @@
#include "wtf/HashSet.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassOwnPtr.h"
+#include "wtf/text/WTFString.h"
#include "wtf/Vector.h"
#include <gtest/gtest.h>
@@ -283,4 +284,22 @@ TEST(VectorTest, SwapWithInlineCapacity)
vectorB.swap(vectorA);
}
+class Comparable {
+};
+bool operator==(const Comparable& a, const Comparable& b) { return true; }
+
+template<typename T> void compare()
+{
+ EXPECT_TRUE(Vector<T>() == Vector<T>());
+ EXPECT_FALSE(Vector<T>(1) == Vector<T>(0));
+ EXPECT_FALSE(Vector<T>() == Vector<T>(1));
+ EXPECT_TRUE(Vector<T>(1) == Vector<T>(1));
+}
+
+TEST(VectorTest, Compare)
+{
+ compare<int>();
+ compare<Comparable>();
+ compare<WTF::String>();
+}
} // namespace
« no previous file with comments | « Source/wtf/Vector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698