| 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 | 8 |
| 9 | 9 |
| 10 #ifndef GrRedBlackTree_DEFINED | 10 #ifndef GrRedBlackTree_DEFINED |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 } | 943 } |
| 944 #endif | 944 #endif |
| 945 | 945 |
| 946 #include "SkRandom.h" | 946 #include "SkRandom.h" |
| 947 | 947 |
| 948 template <typename T, typename C> | 948 template <typename T, typename C> |
| 949 void GrRedBlackTree<T,C>::UnitTest() { | 949 void GrRedBlackTree<T,C>::UnitTest() { |
| 950 GrRedBlackTree<int> tree; | 950 GrRedBlackTree<int> tree; |
| 951 typedef GrRedBlackTree<int>::Iter iter; | 951 typedef GrRedBlackTree<int>::Iter iter; |
| 952 | 952 |
| 953 SkRandom r; | 953 SkMWCRandom r; |
| 954 | 954 |
| 955 int count[100] = {0}; | 955 int count[100] = {0}; |
| 956 // add 10K ints | 956 // add 10K ints |
| 957 for (int i = 0; i < 10000; ++i) { | 957 for (int i = 0; i < 10000; ++i) { |
| 958 int x = r.nextU()%100; | 958 int x = r.nextU()%100; |
| 959 SkDEBUGCODE(Iter xi = ) tree.insert(x); | 959 SkDEBUGCODE(Iter xi = ) tree.insert(x); |
| 960 GrAssert(*xi == x); | 960 GrAssert(*xi == x); |
| 961 ++count[x]; | 961 ++count[x]; |
| 962 } | 962 } |
| 963 | 963 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 // remove all entries | 1109 // remove all entries |
| 1110 while (!tree.empty()) { | 1110 while (!tree.empty()) { |
| 1111 tree.remove(tree.begin()); | 1111 tree.remove(tree.begin()); |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 // test reset on empty tree. | 1114 // test reset on empty tree. |
| 1115 tree.reset(); | 1115 tree.reset(); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 #endif | 1118 #endif |
| OLD | NEW |