Title: [277817] trunk/Tools
Revision
277817
Author
rmoris...@apple.com
Date
2021-05-20 12:34:32 -0700 (Thu, 20 May 2021)

Log Message

The test of SmallSet.cpp should pass the right HashTrait to the HashSet it uses as a reference
https://bugs.webkit.org/show_bug.cgi?id=226027

Reviewed by Mark Lam.

SmallSet allows all values except for the max value.
So we test it on small values, including 0.

HashSet by default forbids 0, so it made the test crash.
We can trivially fix it by passing UnsignedWithZeroKeyHashTraits, which allows everything which is not max() or max()-1

* TestWebKitAPI/Tests/WTF/SmallSet.cpp:
(TestWebKitAPI::testSmallSetOfUnsigned):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (277816 => 277817)


--- trunk/Tools/ChangeLog	2021-05-20 19:25:09 UTC (rev 277816)
+++ trunk/Tools/ChangeLog	2021-05-20 19:34:32 UTC (rev 277817)
@@ -1,3 +1,19 @@
+2021-05-20  Robin Morisset  <rmoris...@apple.com>
+
+        The test of SmallSet.cpp should pass the right HashTrait to the HashSet it uses as a reference
+        https://bugs.webkit.org/show_bug.cgi?id=226027
+
+        Reviewed by Mark Lam.
+
+        SmallSet allows all values except for the max value.
+        So we test it on small values, including 0.
+
+        HashSet by default forbids 0, so it made the test crash.
+        We can trivially fix it by passing UnsignedWithZeroKeyHashTraits, which allows everything which is not max() or max()-1
+
+        * TestWebKitAPI/Tests/WTF/SmallSet.cpp:
+        (TestWebKitAPI::testSmallSetOfUnsigned):
+
 2021-05-20  Sam Sneddon  <gsnedd...@apple.com>
 
         Add tox file for webkitpy

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/SmallSet.cpp (277816 => 277817)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/SmallSet.cpp	2021-05-20 19:25:09 UTC (rev 277816)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/SmallSet.cpp	2021-05-20 19:34:32 UTC (rev 277817)
@@ -27,6 +27,7 @@
 
 #include "Test.h"
 #include <wtf/HashSet.h>
+#include <wtf/HashTraits.h>
 #include <wtf/SmallSet.h>
 #include <wtf/Vector.h>
 
@@ -66,7 +67,7 @@
     }
 
     unsigned count = 0;
-    HashSet<T> referenceSet;
+    HashSet<T, IntHash<T>, WTF::UnsignedWithZeroKeyHashTraits<T>> referenceSet;
     for (unsigned i : set) {
         referenceSet.add(i);
         ++count;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to