]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/testCacheManager.cc
1 #define SQUID_UNIT_TEST 1
4 #include <cppunit/TestAssert.h>
7 #include "testCacheManager.h"
8 #include "CacheManager.h"
12 CPPUNIT_TEST_SUITE_REGISTRATION( testCacheManager
);
14 /* stub functions to link successfully */
25 /* init memory pools */
27 void testCacheManager::setUp()
33 * Test creating a CacheManager
36 testCacheManager::testCreate()
38 CacheManager::GetInstance(); //it's a singleton..
41 /* an action to register */
43 dummy_action(StoreEntry
* sentry
)
49 * registering an action makes it findable.
52 testCacheManager::testRegister()
54 CacheManager
*manager
=CacheManager::GetInstance();
56 manager
->registerAction("sample", "my sample", &dummy_action
, false, false);
57 CacheManagerAction
*anAction
= manager
->findAction("sample");
59 CPPUNIT_ASSERT_EQUAL(0, (int)anAction
->flags
.pw_req
);
60 CPPUNIT_ASSERT_EQUAL(0, (int)anAction
->flags
.atomic
);
61 CPPUNIT_ASSERT_EQUAL(String("sample"), String(anAction
->action
));
63 StoreEntry
*sentry
=new StoreEntry();
64 sentry
->flags
=0x25; //arbitrary test value
65 anAction
->run(sentry
);
66 CPPUNIT_ASSERT_EQUAL(1,(int)sentry
->flags
);