]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/testCacheManager.cc
2 #include <cppunit/TestAssert.h>
5 #include "testCacheManager.h"
6 #include "CacheManager.h"
10 CPPUNIT_TEST_SUITE_REGISTRATION( testCacheManager
);
12 /* stub functions to link successfully */
23 /* init memory pools */
25 void testCacheManager::setUp()
31 * Test creating a CacheManager
34 testCacheManager::testCreate()
36 CacheManager::GetInstance(); //it's a singleton..
39 /* an action to register */
41 dummy_action(StoreEntry
* sentry
)
47 * registering an action makes it findable.
50 testCacheManager::testRegister()
52 CacheManager
*manager
=CacheManager::GetInstance();
54 manager
->registerAction("sample", "my sample", &dummy_action
, false, false);
55 CacheManagerAction
*anAction
= manager
->findAction("sample");
57 CPPUNIT_ASSERT_EQUAL(0, (int)anAction
->flags
.pw_req
);
58 CPPUNIT_ASSERT_EQUAL(0, (int)anAction
->flags
.atomic
);
59 CPPUNIT_ASSERT_EQUAL(String("sample"), String(anAction
->action
));
61 StoreEntry
*sentry
=new StoreEntry();
62 sentry
->flags
=0x25; //arbitrary test value
63 anAction
->run(sentry
);
64 CPPUNIT_ASSERT_EQUAL(1,(int)sentry
->flags
);