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

Side by Side Diff: tests/InfRectTest.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/GrMemoryPoolTest.cpp ('k') | tests/LListTest.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 "SkRect.h" 10 #include "SkRect.h"
(...skipping 17 matching lines...) Expand all
28 { { 0, 0, 10, 7 }, { 5, 3 } }, 28 { { 0, 0, 10, 7 }, { 5, 3 } },
29 { { 0, 0, 11, 6 }, { 5, 3 } }, 29 { { 0, 0, 11, 6 }, { 5, 3 } },
30 }; 30 };
31 for (size_t index = 0; index < SK_ARRAY_COUNT(gData); ++index) { 31 for (size_t index = 0; index < SK_ARRAY_COUNT(gData); ++index) {
32 REPORTER_ASSERT(reporter, 32 REPORTER_ASSERT(reporter,
33 gData[index].fRect.centerX() == gData[index].fCenter.x() ); 33 gData[index].fRect.centerX() == gData[index].fCenter.x() );
34 REPORTER_ASSERT(reporter, 34 REPORTER_ASSERT(reporter,
35 gData[index].fRect.centerY() == gData[index].fCenter.y() ); 35 gData[index].fRect.centerY() == gData[index].fCenter.y() );
36 } 36 }
37 37
38 SkMWCRandom rand; 38 SkRandom rand;
39 for (int i = 0; i < 10000; ++i) { 39 for (int i = 0; i < 10000; ++i) {
40 SkIRect r; 40 SkIRect r;
41 41
42 r.set(rand.nextS() >> 2, rand.nextS() >> 2, 42 r.set(rand.nextS() >> 2, rand.nextS() >> 2,
43 rand.nextS() >> 2, rand.nextS() >> 2); 43 rand.nextS() >> 2, rand.nextS() >> 2);
44 int cx = r.centerX(); 44 int cx = r.centerX();
45 int cy = r.centerY(); 45 int cy = r.centerY();
46 REPORTER_ASSERT(reporter, ((r.left() + r.right()) >> 1) == cx); 46 REPORTER_ASSERT(reporter, ((r.left() + r.right()) >> 1) == cx);
47 REPORTER_ASSERT(reporter, ((r.top() + r.bottom()) >> 1) == cy); 47 REPORTER_ASSERT(reporter, ((r.top() + r.bottom()) >> 1) == cy);
48 } 48 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 check_invalid(reporter, invalid[i], small, big, big); 82 check_invalid(reporter, invalid[i], small, big, big);
83 } 83 }
84 84
85 test_center(reporter); 85 test_center(reporter);
86 } 86 }
87 87
88 // need tests for SkStrSearch 88 // need tests for SkStrSearch
89 89
90 #include "TestClassDef.h" 90 #include "TestClassDef.h"
91 DEFINE_TESTCLASS("InfRect", InfRectTestClass, TestInfRect) 91 DEFINE_TESTCLASS("InfRect", InfRectTestClass, TestInfRect)
OLDNEW
« no previous file with comments | « tests/GrMemoryPoolTest.cpp ('k') | tests/LListTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698