]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/testStore.cc
1 #define SQUID_UNIT_TEST 1
7 CPPUNIT_TEST_SUITE_REGISTRATION( testStore
);
9 // Stubs so this test will link cleanly
10 #include "comm/stub_libcomm.cc"
19 TestStore::get(const cache_key
*)
25 TestStore::get(String
, void (*)(StoreEntry
*, void*), void*)
34 TestStore::maxSize() const
40 TestStore::minSize() const
46 TestStore::stat(StoreEntry
&) const
48 const_cast<TestStore
*>(this)->statsCalled
= true;
52 TestStore::search(String
const url
, HttpRequest
*)
58 testStore::testSetRoot()
60 StorePointer
aStore(new TestStore
);
63 CPPUNIT_ASSERT(&Store::Root() == aStore
.getRaw());
68 testStore::testUnsetRoot()
70 StorePointer
aStore(new TestStore
);
71 StorePointer
aStore2(new TestStore
);
74 CPPUNIT_ASSERT(&Store::Root() == aStore2
.getRaw());
79 testStore::testStats()
81 TestStorePointer
aStore(new TestStore
);
82 Store::Root(aStore
.getRaw());
83 CPPUNIT_ASSERT(aStore
->statsCalled
== false);
84 Store::Stats(NullStoreEntry::getInstance());
85 CPPUNIT_ASSERT(aStore
->statsCalled
== true);
90 testStore::testMaxSize()
92 StorePointer
aStore(new TestStore
);
93 Store::Root(aStore
.getRaw());
94 CPPUNIT_ASSERT(aStore
->maxSize() == 3);