testDiskIO.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3  *
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.
7  */
8 
9 #include "squid.h"
10 #include "compat/cppunit.h"
11 #include "DiskIO/DiskIOModule.h"
12 #include "HttpHeader.h"
13 #include "HttpReply.h"
14 #include "MemObject.h"
15 #include "Store.h"
16 #include "StoreFileSystem.h"
17 #include "testStoreSupport.h"
18 #include "unitTestMain.h"
19 
20 #include <stdexcept>
21 
22 /*
23  * test the DiskIO framework
24  */
25 
26 class TestDiskIO : public CPPUNIT_NS::TestFixture
27 {
31 
32 protected:
33  void testFindDefault();
34 };
35 
37 
39 class MyTestProgram: public TestProgram
40 {
41 public:
42  /* TestProgram API */
43  void startup() override;
44 };
45 
46 void
48 {
49  Mem::Init();
51 }
52 
53 void
55 {
57 #if USE_DISKIO
58  /* enabled. we expect at least ONE */
59  CPPUNIT_ASSERT(module != nullptr);
60 #else
61  /* disabled. we don't expect ANY */
62  CPPUNIT_ASSERT(module == NULL);
63 #endif
64 }
65 
66 int
67 main(int argc, char *argv[])
68 {
69  return MyTestProgram().run(argc, argv);
70 }
71 
CPPUNIT_TEST(testFindDefault)
int main(int argc, char *argv[])
Definition: testDiskIO.cc:67
CPPUNIT_TEST_SUITE_REGISTRATION(TestDiskIO)
implements test program's main() function while enabling customization
Definition: unitTestMain.h:25
int run(int argc, char *argv[])
Definition: unitTestMain.h:44
#define NULL
Definition: types.h:145
static void SetupAllModules()
Definition: DiskIOModule.cc:45
CPPUNIT_TEST_SUITE(TestDiskIO)
void testFindDefault()
Definition: testDiskIO.cc:54
CPPUNIT_TEST_SUITE_END()
void Init()
Definition: old_api.cc:281
static DiskIOModule * FindDefault()
customizes our test setup
void startup() override

 

Introduction

Documentation

Support

Miscellaneous