OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkChecksum.h" | 8 #include "SkChecksum.h" |
9 #include "SkString.h" | 9 #include "SkString.h" |
10 #include "SkTHash.h" | 10 #include "SkTHash.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 REPORTER_ASSERT(r, *found == -3.0); | 35 REPORTER_ASSERT(r, *found == -3.0); |
36 | 36 |
37 REPORTER_ASSERT(r, !map.find(2)); | 37 REPORTER_ASSERT(r, !map.find(2)); |
38 | 38 |
39 const int N = 20; | 39 const int N = 20; |
40 | 40 |
41 for (int i = 0; i < N; i++) { | 41 for (int i = 0; i < N; i++) { |
42 map.set(i, 2.0*i); | 42 map.set(i, 2.0*i); |
43 } | 43 } |
44 for (int i = 0; i < N; i++) { | 44 for (int i = 0; i < N; i++) { |
45 double* found = map.find(i);; | 45 double* found = map.find(i); |
46 REPORTER_ASSERT(r, found); | 46 REPORTER_ASSERT(r, found); |
47 REPORTER_ASSERT(r, *found == i*2.0); | 47 REPORTER_ASSERT(r, *found == i*2.0); |
48 } | 48 } |
49 for (int i = N; i < 2*N; i++) { | 49 for (int i = N; i < 2*N; i++) { |
50 REPORTER_ASSERT(r, !map.find(i)); | 50 REPORTER_ASSERT(r, !map.find(i)); |
51 } | 51 } |
52 | 52 |
53 REPORTER_ASSERT(r, map.count() == N); | 53 REPORTER_ASSERT(r, map.count() == N); |
54 | 54 |
55 for (int i = 0; i < N/2; i++) { | 55 for (int i = 0; i < N/2; i++) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 set.add(copyCounter2); | 143 set.add(copyCounter2); |
144 REPORTER_ASSERT(r, globalCounter == 3); | 144 REPORTER_ASSERT(r, globalCounter == 3); |
145 REPORTER_ASSERT(r, set.contains(copyCounter1)); | 145 REPORTER_ASSERT(r, set.contains(copyCounter1)); |
146 REPORTER_ASSERT(r, set.contains(copyCounter2)); | 146 REPORTER_ASSERT(r, set.contains(copyCounter2)); |
147 REPORTER_ASSERT(r, globalCounter == 3); | 147 REPORTER_ASSERT(r, globalCounter == 3); |
148 set.add(copyCounter1); | 148 set.add(copyCounter1); |
149 set.add(copyCounter2); | 149 set.add(copyCounter2); |
150 // We allow copies for same-value adds for now. | 150 // We allow copies for same-value adds for now. |
151 REPORTER_ASSERT(r, globalCounter == 5); | 151 REPORTER_ASSERT(r, globalCounter == 5); |
152 } | 152 } |
OLD | NEW |