Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: tests/ObjectPoolTest.cpp

Issue 616963006: Archive more dead code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkTObjectPool.h ('k') | tests/SListTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ObjectPoolTest.cpp
diff --git a/tests/ObjectPoolTest.cpp b/tests/ObjectPoolTest.cpp
deleted file mode 100644
index 404448ee7ceced3f3a5e4a574246230db7e117a1..0000000000000000000000000000000000000000
--- a/tests/ObjectPoolTest.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkTObjectPool.h"
-#include "SkTObjectPool.h"
-#include "Test.h"
-
-class PoolEntry {
-public:
-private:
- SK_DECLARE_INTERNAL_SLIST_INTERFACE(PoolEntry);
-};
-
-static const int kNumItemsPerBlock = 3;
-typedef SkTObjectPool<PoolEntry, kNumItemsPerBlock> ObjectPoolType;
-
-static bool verifyPool(skiatest::Reporter* reporter,
- const ObjectPoolType& pool,
- const char* stage,
- int available, int blocks) {
- if (available != pool.available()) {
- ERRORF(reporter, "%s - Pool available is %d not %d",
- stage, pool.available(), available);
- return false;
- }
- if (blocks != pool.blocks()) {
- ERRORF(reporter, "%s - Pool blocks is %d not %d",
- stage, pool.blocks(), blocks);
- return false;
- }
- return true;
-}
-
-static const int kNumToAcquire = kNumItemsPerBlock * 5;
-static void testObjectPool(skiatest::Reporter* reporter) {
- ObjectPoolType pool;
- SkTInternalSList<PoolEntry> used;
- verifyPool(reporter, pool, "empty", 0, 0);
- for (int index = 0; index < kNumToAcquire; ++index) {
- used.push(pool.acquire());
- int blocks = (index / kNumItemsPerBlock) + 1;
- int available = (blocks * kNumItemsPerBlock) - (index + 1);
- if (!verifyPool(reporter, pool, "acquire", available, blocks)) {
- return;
- }
- }
- int available = pool.available();
- int blocks = pool.blocks();
- for (int index = 0; index < kNumToAcquire / 2; ++index) {
- pool.release(used.pop());
- ++available;
- if (!verifyPool(reporter, pool, "release", available, blocks)) {
- return;
- }
- }
- available += used.getCount();
- pool.releaseAll(&used);
- REPORTER_ASSERT(reporter, used.isEmpty());
- verifyPool(reporter, pool, "releaseAll", available, blocks);
-}
-
-DEF_TEST(ObjectPool, reporter) {
- testObjectPool(reporter);
-}
« no previous file with comments | « src/core/SkTObjectPool.h ('k') | tests/SListTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698