| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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) |
| OLD | NEW |