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

Side by Side Diff: tests/UtilsTest.cpp

Issue 12334131: Change random number generator for tests to SkMWCRandom (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Rebase to latest Created 7 years, 9 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/StreamTest.cpp ('k') | tests/Writer32Test.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 "SkRefCnt.h" 10 #include "SkRefCnt.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 REPORTER_ASSERT(reporter, 1 == obj.getRefCnt()); 48 REPORTER_ASSERT(reporter, 1 == obj.getRefCnt());
49 } 49 }
50 50
51 ///////////////////////////////////////////////////////////////////////////// 51 /////////////////////////////////////////////////////////////////////////////
52 52
53 #define kSEARCH_COUNT 91 53 #define kSEARCH_COUNT 91
54 54
55 static void test_search(skiatest::Reporter* reporter) { 55 static void test_search(skiatest::Reporter* reporter) {
56 int i, array[kSEARCH_COUNT]; 56 int i, array[kSEARCH_COUNT];
57 SkRandom rand; 57 SkMWCRandom rand;
58 58
59 for (i = 0; i < kSEARCH_COUNT; i++) { 59 for (i = 0; i < kSEARCH_COUNT; i++) {
60 array[i] = rand.nextS(); 60 array[i] = rand.nextS();
61 } 61 }
62 62
63 SkTHeapSort<int>(array, kSEARCH_COUNT); 63 SkTHeapSort<int>(array, kSEARCH_COUNT);
64 // make sure we got sorted properly 64 // make sure we got sorted properly
65 for (i = 1; i < kSEARCH_COUNT; i++) { 65 for (i = 1; i < kSEARCH_COUNT; i++) {
66 REPORTER_ASSERT(reporter, array[i-1] <= array[i]); 66 REPORTER_ASSERT(reporter, array[i-1] <= array[i]);
67 } 67 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 p - gTest[i].fUtf8 == (int)strlen(gTest[i].fUtf8)); 147 p - gTest[i].fUtf8 == (int)strlen(gTest[i].fUtf8));
148 } 148 }
149 149
150 test_utf16(reporter); 150 test_utf16(reporter);
151 test_search(reporter); 151 test_search(reporter);
152 test_autounref(reporter); 152 test_autounref(reporter);
153 } 153 }
154 154
155 #include "TestClassDef.h" 155 #include "TestClassDef.h"
156 DEFINE_TESTCLASS("Utils", UtfTestClass, TestUTF) 156 DEFINE_TESTCLASS("Utils", UtfTestClass, TestUTF)
OLDNEW
« no previous file with comments | « tests/StreamTest.cpp ('k') | tests/Writer32Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698