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

Side by Side Diff: tests/Sk64Test.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/RegionTest.cpp ('k') | tests/SortTest.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 "SkRandom.h" 9 #include "SkRandom.h"
10 #include <math.h> 10 #include <math.h>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 b.set(6); 68 b.set(6);
69 c.set(-6); 69 c.set(-6);
70 REPORTER_ASSERT(reporter, a != b && b != c && a != c); 70 REPORTER_ASSERT(reporter, a != b && b != c && a != c);
71 REPORTER_ASSERT(reporter, !(a == b) && !(a == b) && !(a == b)); 71 REPORTER_ASSERT(reporter, !(a == b) && !(a == b) && !(a == b));
72 REPORTER_ASSERT(reporter, a < b && b > a && a <= b && b >= a); 72 REPORTER_ASSERT(reporter, a < b && b > a && a <= b && b >= a);
73 REPORTER_ASSERT(reporter, c < a && a > c && c <= a && a >= c); 73 REPORTER_ASSERT(reporter, c < a && a > c && c <= a && a >= c);
74 REPORTER_ASSERT(reporter, c < b && b > c && c <= b && b >= c); 74 REPORTER_ASSERT(reporter, c < b && b > c && c <= b && b >= c);
75 75
76 // Now test add/sub 76 // Now test add/sub
77 77
78 SkMWCRandom rand; 78 SkRandom rand;
79 int i; 79 int i;
80 80
81 for (i = 0; i < 1000; i++) 81 for (i = 0; i < 1000; i++)
82 { 82 {
83 int aa = rand.nextS() >> 1; 83 int aa = rand.nextS() >> 1;
84 int bb = rand.nextS() >> 1; 84 int bb = rand.nextS() >> 1;
85 a.set(aa); 85 a.set(aa);
86 b.set(bb); 86 b.set(bb);
87 REPORTER_ASSERT(reporter, a.get32() == aa && b.get32() == bb); 87 REPORTER_ASSERT(reporter, a.get32() == aa && b.get32() == bb);
88 c = a; c.add(bb); 88 c = a; c.add(bb);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 SkDebugf(" %d === numer %g denom %g div %g xdiv %x fxdiv %x\n", 194 SkDebugf(" %d === numer %g denom %g div %g xdiv %x fxdiv %x\n",
195 i, dnumer, ddenom, ddiv, dfixdiv, fixdiv); 195 i, dnumer, ddenom, ddiv, dfixdiv, fixdiv);
196 } 196 }
197 REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1); 197 REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1);
198 } 198 }
199 #endif 199 #endif
200 } 200 }
201 201
202 #include "TestClassDef.h" 202 #include "TestClassDef.h"
203 DEFINE_TESTCLASS("Sk64", Sk64TestClass, TestSk64) 203 DEFINE_TESTCLASS("Sk64", Sk64TestClass, TestSk64)
OLDNEW
« no previous file with comments | « tests/RegionTest.cpp ('k') | tests/SortTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698