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 #include "SkRandom.h" | 8 #include "SkRandom.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 // This is a GPU-backend specific test | 10 // This is a GPU-backend specific test |
11 #if SK_SUPPORT_GPU | 11 #if SK_SUPPORT_GPU |
12 #include "GrOrderedSet.h" | 12 #include "GrOrderedSet.h" |
13 | 13 |
14 typedef GrOrderedSet<int> Set; | 14 typedef GrOrderedSet<int> Set; |
15 typedef GrOrderedSet<const char*, GrStrLess> Set2; | 15 typedef GrOrderedSet<const char*, GrStrLess> Set2; |
16 | 16 |
17 DEF_TEST(GrOrderedSetTest, reporter) { | 17 DEF_TEST(GrOrderedSet, reporter) { |
18 Set set; | 18 Set set; |
19 | 19 |
20 REPORTER_ASSERT(reporter, set.empty()); | 20 REPORTER_ASSERT(reporter, set.empty()); |
21 | 21 |
22 SkRandom r; | 22 SkRandom r; |
23 | 23 |
24 int count[1000] = {0}; | 24 int count[1000] = {0}; |
25 // add 10K ints | 25 // add 10K ints |
26 for (int i = 0; i < 10000; ++i) { | 26 for (int i = 0; i < 10000; ++i) { |
27 int x = r.nextU() % 1000; | 27 int x = r.nextU() % 1000; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 set2.remove(set2.find("ant")); | 141 set2.remove(set2.find("ant")); |
142 REPORTER_ASSERT(reporter, set2.find("ant") == set2.end()); | 142 REPORTER_ASSERT(reporter, set2.find("ant") == set2.end()); |
143 REPORTER_ASSERT(reporter, set2.count() == 3); | 143 REPORTER_ASSERT(reporter, set2.count() == 3); |
144 | 144 |
145 set2.reset(); | 145 set2.reset(); |
146 REPORTER_ASSERT(reporter, set2.empty()); | 146 REPORTER_ASSERT(reporter, set2.empty()); |
147 } | 147 } |
148 | 148 |
149 #endif | 149 #endif |
OLD | NEW |