]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/testStore.cc
0993718d8aa9b3365cb8f7ffa91b12e0211f657e
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
11 #include "testStore.h"
12 #include "unitTestMain.h"
14 CPPUNIT_TEST_SUITE_REGISTRATION( testStore
);
23 TestStore::get(const cache_key
*)
29 TestStore::get(String
, void (*)(StoreEntry
*, void*), void*)
37 TestStore::maxSize() const
43 TestStore::minSize() const
49 TestStore::currentSize() const
55 TestStore::currentCount() const
61 TestStore::maxObjectSize() const
67 TestStore::getStats(StoreInfoStats
&) const
72 TestStore::stat(StoreEntry
&) const
74 const_cast<TestStore
*>(this)->statsCalled
= true;
84 testStore::testSetRoot()
86 Store::Controller
*aStore(new TestStore
);
89 CPPUNIT_ASSERT_EQUAL(&Store::Root(), aStore
);
94 testStore::testUnsetRoot()
96 Store::Controller
*aStore(new TestStore
);
97 Store::Controller
*aStore2(new TestStore
);
100 Store::Init(aStore2
);
101 CPPUNIT_ASSERT_EQUAL(&Store::Root(),aStore2
);
106 testStore::testStats()
108 TestStore
*aStore(new TestStore
);
110 CPPUNIT_ASSERT_EQUAL(false, aStore
->statsCalled
);
111 Store::Stats(NullStoreEntry::getInstance());
112 CPPUNIT_ASSERT_EQUAL(true, aStore
->statsCalled
);
117 testStore::testMaxSize()
119 Store::Controller
*aStore(new TestStore
);
121 CPPUNIT_ASSERT_EQUAL(static_cast<uint64_t>(3), aStore
->maxSize());