]> git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/testCacheManager.cc
Summary: Synced with libecap, adopted pass-all-changes-through transactions
[thirdparty/squid.git] / src / tests / testCacheManager.cc
1 #include "squid.h"
2 #include <cppunit/TestAssert.h>
3
4 #include "Mem.h"
5 #include "testCacheManager.h"
6 #include "CacheManager.h"
7
8
9 CPPUNIT_TEST_SUITE_REGISTRATION( testCacheManager );
10
11 /* stub functions to link successfully */
12 void
13 shut_down(int)
14 {}
15
16 void
17 reconfigure(int)
18 {}
19
20 /* end stubs */
21
22 /* init memory pools */
23
24 void testCacheManager::setUp()
25 {
26 Mem::Init();
27 }
28
29 /*
30 * Test creating a CacheManager
31 */
32 void
33 testCacheManager::testCreate()
34 {
35 CacheManager();
36 }
37
38 /* an action to register */
39 static void
40 dummy_action(StoreEntry * sentry)
41 {}
42
43 /*
44 * registering an action makes it findable.
45 */
46 void
47 testCacheManager::testRegister()
48 {
49 CacheManager manager;
50 manager.registerAction("sample", "my sample", &dummy_action, false, false);
51 CacheManagerAction *anAction = manager.findAction("sample");
52 CPPUNIT_ASSERT_EQUAL(String("sample"), String(anAction->action));
53 CPPUNIT_ASSERT_EQUAL(String("my sample"), String(anAction->desc));
54 CPPUNIT_ASSERT_EQUAL(&dummy_action, anAction->handler);
55 CPPUNIT_ASSERT_EQUAL(0, (int)anAction->flags.pw_req);
56 CPPUNIT_ASSERT_EQUAL(0, (int)anAction->flags.atomic);
57 }