aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-24 01:51:08 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-24 01:51:08 +0000
commita7aa810894ae85306541ed949848a4dd7f907a0b (patch)
tree061feec9866a1458f7e5e5e41422dd8d08a192b2 /tests
parent93a2e213441c75033b04365c7d68c8d3887288ac (diff)
Deterministic SkTSet and PDF Output
Addresses this issue: https://code.google.com/p/skia/issues/detail?id=1277 R=edisonn@google.com, vandebo@chromium.org Author: richardlin@chromium.org Review URL: https://chromiumcodereview.appspot.com/19283005 git-svn-id: http://skia.googlecode.com/svn/trunk@10298 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/TSetTest.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/TSetTest.cpp b/tests/TSetTest.cpp
index 1cb9056a61..8f276f7bc7 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();