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

Side by Side Diff: tests/ClampRangeTest.cpp

Issue 23576015: Change old PRG to be SkLCGRandom; change new one to SkRandom (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix some spurious SkMWCRandoms Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/BitmapGetColorTest.cpp ('k') | tests/ClipStackTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Test.h" 8 #include "Test.h"
9 #include "gradients/SkClampRange.h" 9 #include "gradients/SkClampRange.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 test_range(-10, 1, 20); 100 test_range(-10, 1, 20);
101 test_range(10, -1, 20); 101 test_range(10, -1, 20);
102 test_range(-10, 3, 20); 102 test_range(-10, 3, 20);
103 test_range(10, -3, 20); 103 test_range(10, -3, 20);
104 104
105 test_range(ff(1), ff(16384), 100); 105 test_range(ff(1), ff(16384), 100);
106 test_range(ff(-1), ff(-16384), 100); 106 test_range(ff(-1), ff(-16384), 100);
107 test_range(ff(1)/2, ff(16384), 100); 107 test_range(ff(1)/2, ff(16384), 100);
108 test_range(ff(1)/2, ff(-16384), 100); 108 test_range(ff(1)/2, ff(-16384), 100);
109 109
110 SkMWCRandom rand; 110 SkRandom rand;
111 111
112 // test non-overflow cases 112 // test non-overflow cases
113 for (int i = 0; i < 1000000; i++) { 113 for (int i = 0; i < 1000000; i++) {
114 SkFixed fx = rand.nextS() >> 1; 114 SkFixed fx = rand.nextS() >> 1;
115 SkFixed sx = rand.nextS() >> 1; 115 SkFixed sx = rand.nextS() >> 1;
116 int count = rand.nextU() % 1000 + 1; 116 int count = rand.nextU() % 1000 + 1;
117 SkFixed dx = (sx - fx) / count; 117 SkFixed dx = (sx - fx) / count;
118 test_range(fx, dx, count); 118 test_range(fx, dx, count);
119 } 119 }
120 120
121 // test overflow cases 121 // test overflow cases
122 for (int i = 0; i < 100000; i++) { 122 for (int i = 0; i < 100000; i++) {
123 SkFixed fx = rand.nextS(); 123 SkFixed fx = rand.nextS();
124 SkFixed dx = rand.nextS(); 124 SkFixed dx = rand.nextS();
125 int count = rand.nextU() % 1000 + 1; 125 int count = rand.nextU() % 1000 + 1;
126 test_range(fx, dx, count); 126 test_range(fx, dx, count);
127 } 127 }
128 } 128 }
129 129
130 #ifdef USE_REPORTER 130 #ifdef USE_REPORTER
131 131
132 #include "TestClassDef.h" 132 #include "TestClassDef.h"
133 DEFINE_TESTCLASS("ClampRange", ClampRangeClass, TestClampRange) 133 DEFINE_TESTCLASS("ClampRange", ClampRangeClass, TestClampRange)
134 134
135 #endif 135 #endif
OLDNEW
« no previous file with comments | « tests/BitmapGetColorTest.cpp ('k') | tests/ClipStackTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698