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

Unified Diff: tests/TSetTest.cpp

Issue 19283005: Deterministic SkTSet and PDF Output (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add sorting for testing in SkTSet::validate() and some code review fixes Created 7 years, 5 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
« src/pdf/SkTSet.h ('K') | « src/pdf/SkTSet.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/TSetTest.cpp
diff --git a/tests/TSetTest.cpp b/tests/TSetTest.cpp
index 1cb9056a615658c395ce87be3d3a37c7b23ee8b1..8f276f7bc74e5bba1b43467c78fd5d549486e573 100644
--- a/tests/TSetTest.cpp
+++ b/tests/TSetTest.cpp
@@ -41,7 +41,7 @@ static int f(int i) {
return (long(i) * PRIME1) % PRIME2;
}
-// Will expose contains() and find() too.
+// Will expose contains() too.
static void TestTSet_advanced(skiatest::Reporter* reporter) {
SkTSet<int> set0;
@@ -60,6 +60,11 @@ static void TestTSet_advanced(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, !set0.add(f(i)));
}
+ // Test deterministic output
+ for (int i = 0; i < COUNT; i++) {
+ REPORTER_ASSERT(reporter, set0[i] == f(i));
+ }
+
// Test copy constructor too.
SkTSet<int> set1 = set0;
@@ -68,6 +73,7 @@ static void TestTSet_advanced(skiatest::Reporter* reporter) {
for (int i = 0; i < COUNT; i++) {
REPORTER_ASSERT(reporter, set1.contains(f(i)));
+ REPORTER_ASSERT(reporter, set1[i] == f(i));
}
// Test operator= too.
@@ -79,6 +85,7 @@ static void TestTSet_advanced(skiatest::Reporter* reporter) {
for (int i = 0; i < COUNT; i++) {
REPORTER_ASSERT(reporter, set2.contains(f(i)));
+ REPORTER_ASSERT(reporter, set2[i] == f(i));
}
#ifdef SK_DEBUG
@@ -108,6 +115,12 @@ static void TestTSet_merge(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, set.contains(i));
}
+ // check deterministic output
+ for (int i = 0; i < COUNT; i++) {
+ REPORTER_ASSERT(reporter, set[i] == 2 * i);
+ REPORTER_ASSERT(reporter, set[COUNT + i] == 2 * i + 1);
+ }
+
#ifdef SK_DEBUG
set.validate();
setOdd.validate();
« src/pdf/SkTSet.h ('K') | « src/pdf/SkTSet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698