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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 return true; | 942 return true; |
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 | 951 |
952 SkMWCRandom r; | 952 SkRandom r; |
953 | 953 |
954 int count[100] = {0}; | 954 int count[100] = {0}; |
955 // add 10K ints | 955 // add 10K ints |
956 for (int i = 0; i < 10000; ++i) { | 956 for (int i = 0; i < 10000; ++i) { |
957 int x = r.nextU()%100; | 957 int x = r.nextU()%100; |
958 SkDEBUGCODE(Iter xi = ) tree.insert(x); | 958 SkDEBUGCODE(Iter xi = ) tree.insert(x); |
959 SkASSERT(*xi == x); | 959 SkASSERT(*xi == x); |
960 ++count[x]; | 960 ++count[x]; |
961 } | 961 } |
962 | 962 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 // remove all entries | 1108 // remove all entries |
1109 while (!tree.empty()) { | 1109 while (!tree.empty()) { |
1110 tree.remove(tree.begin()); | 1110 tree.remove(tree.begin()); |
1111 } | 1111 } |
1112 | 1112 |
1113 // test reset on empty tree. | 1113 // test reset on empty tree. |
1114 tree.reset(); | 1114 tree.reset(); |
1115 } | 1115 } |
1116 | 1116 |
1117 #endif | 1117 #endif |
OLD | NEW |