| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 // This is a GPU-backend specific test | 8 // This is a GPU-backend specific test |
| 9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 | 10 |
| 11 #include "GrRedBlackTree.h" | 11 #include "GrRedBlackTree.h" |
| 12 #include "SkRandom.h" | 12 #include "SkRandom.h" |
| 13 #include "Test.h" | 13 #include "Test.h" |
| 14 | 14 |
| 15 typedef GrRedBlackTree<int> Tree; | 15 typedef GrRedBlackTree<int> Tree; |
| 16 | 16 |
| 17 DEF_TEST(GrRedBlackTreeTest, reporter) { | 17 DEF_TEST(GrRedBlackTree, reporter) { |
| 18 Tree tree; | 18 Tree tree; |
| 19 | 19 |
| 20 SkRandom r; | 20 SkRandom r; |
| 21 | 21 |
| 22 int count[100] = {0}; | 22 int count[100] = {0}; |
| 23 // add 10K ints | 23 // add 10K ints |
| 24 for (int i = 0; i < 10000; ++i) { | 24 for (int i = 0; i < 10000; ++i) { |
| 25 int x = r.nextU() % 100; | 25 int x = r.nextU() % 100; |
| 26 Tree::Iter xi = tree.insert(x); | 26 Tree::Iter xi = tree.insert(x); |
| 27 REPORTER_ASSERT(reporter, *xi == x); | 27 REPORTER_ASSERT(reporter, *xi == x); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // remove all entries | 176 // remove all entries |
| 177 while (!tree.empty()) { | 177 while (!tree.empty()) { |
| 178 tree.remove(tree.begin()); | 178 tree.remove(tree.begin()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 // test reset on empty tree. | 181 // test reset on empty tree. |
| 182 tree.reset(); | 182 tree.reset(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 #endif | 185 #endif |
| OLD | NEW |