Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 8 | #include "src/core/SkTBlockList.h" |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 9 | #include "tests/Test.h" |
| 10 | |
| 11 | namespace { |
| 12 | struct C { |
| 13 | C() : fID(-1) { ++gInstCnt; } |
| 14 | C(int id) : fID(id) { ++gInstCnt; } |
Michael Ludwig | a291b37 | 2020-07-16 14:20:49 -0400 | [diff] [blame] | 15 | C(C&& c) : C(c.fID) {} |
Michael Ludwig | c97ebe0 | 2020-07-17 08:39:46 -0400 | [diff] [blame] | 16 | C(const C& c) : C(c.fID) {} |
| 17 | |
Ben Wagner | 14ba58f | 2020-03-30 17:53:53 -0400 | [diff] [blame] | 18 | C& operator=(C&&) = default; |
Michael Ludwig | c97ebe0 | 2020-07-17 08:39:46 -0400 | [diff] [blame] | 19 | C& operator=(const C&) = default; |
| 20 | |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 21 | ~C() { --gInstCnt; } |
Michael Ludwig | c97ebe0 | 2020-07-17 08:39:46 -0400 | [diff] [blame] | 22 | |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 23 | int fID; |
| 24 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 25 | // Under the hood, SkTBlockList and SkBlockAllocator round up to max_align_t. If 'C' was |
Michael Ludwig | cc848b5 | 2020-07-22 16:36:49 -0400 | [diff] [blame] | 26 | // just 4 bytes, that often means the internal blocks can squeeze a few extra instances in. This |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 27 | // is fine, but makes predicting a little trickier, so make sure C is a bit bigger. |
| 28 | int fPadding[4]; |
| 29 | |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 30 | static int gInstCnt; |
| 31 | }; |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 32 | int C::gInstCnt = 0; |
Michael Ludwig | 1d4c08f | 2020-07-21 13:04:42 -0400 | [diff] [blame] | 33 | |
| 34 | struct D { |
| 35 | int fID; |
| 36 | }; |
| 37 | |
John Stiles | a6841be | 2020-08-06 14:11:56 -0400 | [diff] [blame] | 38 | } // namespace |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 39 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 40 | class TBlockListTestAccess { |
| 41 | public: |
| 42 | template<int N> |
| 43 | static size_t ScratchBlockSize(SkTBlockList<C, N>& list) { |
| 44 | return (size_t) list.fAllocator->scratchBlockSize(); |
| 45 | } |
| 46 | |
| 47 | template<int N> |
| 48 | static size_t TotalSize(SkTBlockList<C, N>& list) { |
| 49 | return list.fAllocator->totalSize(); |
| 50 | } |
| 51 | }; |
| 52 | |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 53 | // Checks that the allocator has the correct count, etc and that the element IDs are correct. |
| 54 | // Then pops popCnt items and checks again. |
| 55 | template<int N> |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 56 | static void check_allocator_helper(SkTBlockList<C, N>* allocator, int cnt, int popCnt, |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 57 | skiatest::Reporter* reporter) { |
| 58 | REPORTER_ASSERT(reporter, (0 == cnt) == allocator->empty()); |
| 59 | REPORTER_ASSERT(reporter, cnt == allocator->count()); |
| 60 | REPORTER_ASSERT(reporter, cnt == C::gInstCnt); |
| 61 | |
| 62 | int i = 0; |
| 63 | for (const C& c : allocator->items()) { |
| 64 | REPORTER_ASSERT(reporter, i == c.fID); |
| 65 | REPORTER_ASSERT(reporter, allocator->item(i).fID == i); |
| 66 | ++i; |
| 67 | } |
| 68 | REPORTER_ASSERT(reporter, i == cnt); |
| 69 | |
| 70 | if (cnt > 0) { |
| 71 | REPORTER_ASSERT(reporter, cnt-1 == allocator->back().fID); |
| 72 | } |
| 73 | |
| 74 | if (popCnt > 0) { |
John Stiles | 9765973 | 2021-08-12 10:48:09 -0400 | [diff] [blame] | 75 | for (i = 0; i < popCnt; ++i) { |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 76 | allocator->pop_back(); |
| 77 | } |
| 78 | check_allocator_helper(allocator, cnt - popCnt, 0, reporter); |
| 79 | } |
| 80 | } |
| 81 | |
Michael Ludwig | 26b4ffd | 2020-07-15 12:36:44 -0400 | [diff] [blame] | 82 | template<int N> |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 83 | static void check_iterator_helper(SkTBlockList<C, N>* allocator, |
Michael Ludwig | cc848b5 | 2020-07-22 16:36:49 -0400 | [diff] [blame] | 84 | const std::vector<C*>& expected, |
Michael Ludwig | 26b4ffd | 2020-07-15 12:36:44 -0400 | [diff] [blame] | 85 | skiatest::Reporter* reporter) { |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 86 | const SkTBlockList<C, N>* cAlloc = allocator; |
Michael Ludwig | 26b4ffd | 2020-07-15 12:36:44 -0400 | [diff] [blame] | 87 | REPORTER_ASSERT(reporter, (size_t) allocator->count() == expected.size()); |
| 88 | // Forward+const |
| 89 | int i = 0; |
| 90 | for (const C& c : cAlloc->items()) { |
| 91 | REPORTER_ASSERT(reporter, (uintptr_t) &c == (uintptr_t) expected[i]); |
| 92 | ++i; |
| 93 | } |
| 94 | REPORTER_ASSERT(reporter, (size_t) i == expected.size()); |
| 95 | |
| 96 | // Forward+non-const |
| 97 | i = 0; |
| 98 | for (C& c : allocator->items()) { |
| 99 | REPORTER_ASSERT(reporter, (uintptr_t) &c == (uintptr_t) expected[i]); |
| 100 | ++i; |
| 101 | } |
| 102 | REPORTER_ASSERT(reporter, (size_t) i == expected.size()); |
| 103 | |
| 104 | // Reverse+const |
| 105 | i = (int) expected.size() - 1; |
| 106 | for (const C& c : cAlloc->ritems()) { |
| 107 | REPORTER_ASSERT(reporter, (uintptr_t) &c == (uintptr_t) expected[i]); |
| 108 | --i; |
| 109 | } |
| 110 | REPORTER_ASSERT(reporter, i == -1); |
| 111 | |
| 112 | // Reverse+non-const |
| 113 | i = (int) expected.size() - 1; |
| 114 | for (C& c : allocator->ritems()) { |
| 115 | REPORTER_ASSERT(reporter, (uintptr_t) &c == (uintptr_t) expected[i]); |
| 116 | --i; |
| 117 | } |
| 118 | REPORTER_ASSERT(reporter, i == -1); |
| 119 | |
| 120 | // Also test random access |
John Stiles | 9765973 | 2021-08-12 10:48:09 -0400 | [diff] [blame] | 121 | for (i = 0; i < allocator->count(); ++i) { |
Michael Ludwig | 26b4ffd | 2020-07-15 12:36:44 -0400 | [diff] [blame] | 122 | REPORTER_ASSERT(reporter, (uintptr_t) &allocator->item(i) == (uintptr_t) expected[i]); |
| 123 | REPORTER_ASSERT(reporter, (uintptr_t) &cAlloc->item(i) == (uintptr_t) expected[i]); |
| 124 | } |
| 125 | } |
| 126 | |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 127 | // Adds cnt items to the allocator, tests the cnts and iterators, pops popCnt items and checks |
| 128 | // again. Finally it resets the allocator and checks again. |
| 129 | template<int N> |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 130 | static void check_allocator(SkTBlockList<C, N>* allocator, int cnt, int popCnt, |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 131 | skiatest::Reporter* reporter) { |
Michael Ludwig | c97ebe0 | 2020-07-17 08:39:46 -0400 | [diff] [blame] | 132 | enum ItemInitializer : int { |
| 133 | kCopyCtor, |
| 134 | kMoveCtor, |
| 135 | kCopyAssign, |
| 136 | kMoveAssign, |
| 137 | kEmplace, |
| 138 | }; |
| 139 | static constexpr int kInitCount = (int) kEmplace + 1; |
| 140 | |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 141 | SkASSERT(allocator); |
| 142 | SkASSERT(allocator->empty()); |
Michael Ludwig | 26b4ffd | 2020-07-15 12:36:44 -0400 | [diff] [blame] | 143 | std::vector<C*> items; |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 144 | for (int i = 0; i < cnt; ++i) { |
Michael Ludwig | c97ebe0 | 2020-07-17 08:39:46 -0400 | [diff] [blame] | 145 | switch((ItemInitializer) (i % kInitCount)) { |
| 146 | case kCopyCtor: |
| 147 | allocator->push_back(C(i)); |
| 148 | break; |
| 149 | case kMoveCtor: |
| 150 | allocator->push_back(std::move(C(i))); |
| 151 | break; |
| 152 | case kCopyAssign: |
| 153 | allocator->push_back() = C(i); |
| 154 | break; |
| 155 | case kMoveAssign: |
| 156 | allocator->push_back() = std::move(C(i)); |
| 157 | break; |
| 158 | case kEmplace: |
| 159 | allocator->emplace_back(i); |
| 160 | break; |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 161 | } |
Michael Ludwig | 26b4ffd | 2020-07-15 12:36:44 -0400 | [diff] [blame] | 162 | items.push_back(&allocator->back()); |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 163 | } |
Michael Ludwig | 26b4ffd | 2020-07-15 12:36:44 -0400 | [diff] [blame] | 164 | check_iterator_helper(allocator, items, reporter); |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 165 | check_allocator_helper(allocator, cnt, popCnt, reporter); |
| 166 | allocator->reset(); |
Michael Ludwig | 26b4ffd | 2020-07-15 12:36:44 -0400 | [diff] [blame] | 167 | check_iterator_helper(allocator, {}, reporter); |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 168 | check_allocator_helper(allocator, 0, 0, reporter); |
| 169 | } |
| 170 | |
| 171 | template<int N> |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 172 | static void run_allocator_test(SkTBlockList<C, N>* allocator, skiatest::Reporter* reporter) { |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 173 | check_allocator(allocator, 0, 0, reporter); |
| 174 | check_allocator(allocator, 1, 1, reporter); |
| 175 | check_allocator(allocator, 2, 2, reporter); |
| 176 | check_allocator(allocator, 10, 1, reporter); |
| 177 | check_allocator(allocator, 10, 5, reporter); |
| 178 | check_allocator(allocator, 10, 10, reporter); |
| 179 | check_allocator(allocator, 100, 10, reporter); |
| 180 | } |
| 181 | |
Michael Ludwig | 1d4c08f | 2020-07-21 13:04:42 -0400 | [diff] [blame] | 182 | template<int N1, int N2> |
| 183 | static void run_concat_test(skiatest::Reporter* reporter, int aCount, int bCount) { |
| 184 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 185 | SkTBlockList<C, N1> listA; |
| 186 | SkTBlockList<C, N2> listB; |
Michael Ludwig | 1d4c08f | 2020-07-21 13:04:42 -0400 | [diff] [blame] | 187 | |
| 188 | for (int i = 0; i < aCount; ++i) { |
| 189 | listA.emplace_back(i); |
| 190 | } |
| 191 | for (int i = 0; i < bCount; ++i) { |
| 192 | listB.emplace_back(aCount + i); |
| 193 | } |
| 194 | |
Michael Ludwig | 1d4c08f | 2020-07-21 13:04:42 -0400 | [diff] [blame] | 195 | REPORTER_ASSERT(reporter, listA.count() == aCount && listB.count() == bCount); |
| 196 | REPORTER_ASSERT(reporter, C::gInstCnt == aCount + bCount); |
| 197 | |
| 198 | // Concatenate B into A and verify. |
| 199 | listA.concat(std::move(listB)); |
| 200 | REPORTER_ASSERT(reporter, listA.count() == aCount + bCount); |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 201 | // SkTBlockList guarantees the moved list is empty, but clang-tidy doesn't know about it; |
Michael Ludwig | cc848b5 | 2020-07-22 16:36:49 -0400 | [diff] [blame] | 202 | // in practice we won't really be using moved lists so this won't pollute our main code base |
| 203 | // with lots of warning disables. |
Michael Ludwig | 1d4c08f | 2020-07-21 13:04:42 -0400 | [diff] [blame] | 204 | REPORTER_ASSERT(reporter, listB.count() == 0); // NOLINT(bugprone-use-after-move) |
| 205 | REPORTER_ASSERT(reporter, C::gInstCnt == aCount + bCount); |
| 206 | |
| 207 | int i = 0; |
| 208 | for (const C& item : listA.items()) { |
| 209 | // By construction of A and B originally, the concatenated id sequence is continuous |
| 210 | REPORTER_ASSERT(reporter, i == item.fID); |
| 211 | i++; |
| 212 | } |
| 213 | REPORTER_ASSERT(reporter, i == (aCount + bCount)); |
| 214 | } |
| 215 | |
| 216 | template<int N1, int N2> |
| 217 | static void run_concat_trivial_test(skiatest::Reporter* reporter, int aCount, int bCount) { |
| 218 | static_assert(std::is_trivially_copyable<D>::value); |
| 219 | |
| 220 | // This is similar to run_concat_test(), except since D is trivial we can't verify the instant |
| 221 | // counts that are tracked via ctor/dtor. |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 222 | SkTBlockList<D, N1> listA; |
| 223 | SkTBlockList<D, N2> listB; |
Michael Ludwig | 1d4c08f | 2020-07-21 13:04:42 -0400 | [diff] [blame] | 224 | |
| 225 | for (int i = 0; i < aCount; ++i) { |
| 226 | listA.push_back({i}); |
| 227 | } |
| 228 | for (int i = 0; i < bCount; ++i) { |
| 229 | listB.push_back({aCount + i}); |
| 230 | } |
| 231 | |
Michael Ludwig | 1d4c08f | 2020-07-21 13:04:42 -0400 | [diff] [blame] | 232 | REPORTER_ASSERT(reporter, listA.count() == aCount && listB.count() == bCount); |
| 233 | // Concatenate B into A and verify. |
| 234 | listA.concat(std::move(listB)); |
| 235 | REPORTER_ASSERT(reporter, listA.count() == aCount + bCount); |
| 236 | REPORTER_ASSERT(reporter, listB.count() == 0); // NOLINT(bugprone-use-after-move): see above |
| 237 | |
| 238 | int i = 0; |
| 239 | for (const D& item : listA.items()) { |
| 240 | // By construction of A and B originally, the concatenated id sequence is continuous |
| 241 | REPORTER_ASSERT(reporter, i == item.fID); |
| 242 | i++; |
| 243 | } |
| 244 | REPORTER_ASSERT(reporter, i == (aCount + bCount)); |
| 245 | } |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 246 | |
| 247 | template<int N> |
| 248 | static void run_reserve_test(skiatest::Reporter* reporter) { |
| 249 | constexpr int kItemsPerBlock = N + 4; // Make this a number > 1, even if N starting items == 1 |
| 250 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 251 | SkTBlockList<C, N> list(kItemsPerBlock); |
| 252 | size_t initialSize = TBlockListTestAccess::TotalSize(list); |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 253 | // Should be able to add N instances of T w/o changing size from initialSize |
| 254 | for (int i = 0; i < N; ++i) { |
| 255 | list.push_back(C(i)); |
| 256 | } |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 257 | REPORTER_ASSERT(reporter, initialSize == TBlockListTestAccess::TotalSize(list)); |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 258 | |
| 259 | // Reserve room for 2*kItemsPerBlock items |
| 260 | list.reserve(2 * kItemsPerBlock); |
| 261 | REPORTER_ASSERT(reporter, list.count() == N); // count shouldn't change though |
| 262 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 263 | size_t reservedSize = TBlockListTestAccess::TotalSize(list); |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 264 | REPORTER_ASSERT(reporter, reservedSize >= initialSize + 2 * kItemsPerBlock * sizeof(C)); |
| 265 | for (int i = 0; i < 2 * kItemsPerBlock; ++i) { |
| 266 | list.push_back(C(i)); |
| 267 | } |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 268 | REPORTER_ASSERT(reporter, reservedSize == TBlockListTestAccess::TotalSize(list)); |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 269 | |
| 270 | // Make the next block partially fully (N > 0 but < kItemsPerBlock) |
| 271 | for (int i = 0; i < N; ++i) { |
| 272 | list.push_back(C(i)); |
| 273 | } |
| 274 | |
| 275 | // Reserve room again for 2*kItemsPerBlock, but reserve should automatically take account of the |
| 276 | // (kItemsPerBlock-N) that are still available in the active block |
| 277 | list.reserve(2 * kItemsPerBlock); |
| 278 | int extraReservedCount = kItemsPerBlock + N; |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 279 | // Because SkTBlockList normally allocates blocks in fixed sizes, and extraReservedCount > |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 280 | // items-per-block, it will always use that size and not that of the growth policy. |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 281 | REPORTER_ASSERT(reporter, TBlockListTestAccess::ScratchBlockSize(list) >= |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 282 | extraReservedCount * sizeof(C)); |
| 283 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 284 | reservedSize = TBlockListTestAccess::TotalSize(list); |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 285 | for (int i = 0; i < 2 * kItemsPerBlock; ++i) { |
| 286 | list.push_back(C(i)); |
| 287 | } |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 288 | REPORTER_ASSERT(reporter, reservedSize == TBlockListTestAccess::TotalSize(list)); |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 289 | |
| 290 | // If we reserve a count < items-per-block, it will use the fixed size from the growth policy. |
| 291 | list.reserve(2); |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 292 | REPORTER_ASSERT(reporter, TBlockListTestAccess::ScratchBlockSize(list) >= |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 293 | kItemsPerBlock * sizeof(C)); |
| 294 | |
| 295 | // Ensure the reservations didn't initialize any more D's than anticipated |
| 296 | int expectedInstanceCount = 2 * (N + 2 * kItemsPerBlock); |
| 297 | REPORTER_ASSERT(reporter, expectedInstanceCount == C::gInstCnt); |
| 298 | |
| 299 | list.reset(); |
| 300 | REPORTER_ASSERT(reporter, 0 == C::gInstCnt); |
| 301 | } |
| 302 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 303 | DEF_TEST(SkTBlockList, reporter) { |
Michael Ludwig | c97ebe0 | 2020-07-17 08:39:46 -0400 | [diff] [blame] | 304 | // Test combinations of allocators with and without stack storage and with different block sizes |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 305 | SkTBlockList<C> a1(1); |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 306 | run_allocator_test(&a1, reporter); |
| 307 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 308 | SkTBlockList<C> a2(2); |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 309 | run_allocator_test(&a2, reporter); |
| 310 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 311 | SkTBlockList<C> a5(5); |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 312 | run_allocator_test(&a5, reporter); |
| 313 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 314 | SkTBlockList<C, 1> sa1; |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 315 | run_allocator_test(&sa1, reporter); |
| 316 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 317 | SkTBlockList<C, 3> sa3; |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 318 | run_allocator_test(&sa3, reporter); |
| 319 | |
Michael Ludwig | c1ed11d | 2021-08-24 11:49:55 -0400 | [diff] [blame] | 320 | SkTBlockList<C, 4> sa4; |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 321 | run_allocator_test(&sa4, reporter); |
Michael Ludwig | 68e5f29 | 2020-07-20 16:17:14 -0400 | [diff] [blame] | 322 | |
| 323 | run_reserve_test<1>(reporter); |
| 324 | run_reserve_test<2>(reporter); |
| 325 | run_reserve_test<3>(reporter); |
| 326 | run_reserve_test<4>(reporter); |
| 327 | run_reserve_test<5>(reporter); |
Michael Ludwig | 1d4c08f | 2020-07-21 13:04:42 -0400 | [diff] [blame] | 328 | |
| 329 | run_concat_test<1, 1>(reporter, 10, 10); |
| 330 | run_concat_test<5, 1>(reporter, 50, 10); |
| 331 | run_concat_test<1, 5>(reporter, 10, 50); |
| 332 | run_concat_test<5, 5>(reporter, 100, 100); |
| 333 | |
| 334 | run_concat_trivial_test<1, 1>(reporter, 10, 10); |
| 335 | run_concat_trivial_test<5, 1>(reporter, 50, 10); |
| 336 | run_concat_trivial_test<1, 5>(reporter, 10, 50); |
| 337 | run_concat_trivial_test<5, 5>(reporter, 100, 100); |
Michael Ludwig | 4519134 | 2020-03-24 12:29:39 -0400 | [diff] [blame] | 338 | } |