1 /*
2  * Copyright (C) 1996-2021 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 #ifndef SQUID_COMPAT_CPPUNIT_H
10 #define SQUID_COMPAT_CPPUNIT_H
11 
12 // CPPUNIT test suite uses auto_ptr which is deprecated in C++0x
13 
14 #if HAVE_CPPUNIT_EXTENSIONS_HELPERMACROS_H
15 #if defined(__cplusplus) && HAVE_UNIQUE_PTR
16 #include <cppunit/extensions/HelperMacros.h>
17 
18 #undef CPPUNIT_TEST_SUITE_END
19 
20 // Clone from cppunit 1.12.1
21 #define CPPUNIT_TEST_SUITE_END()                                               \
22     }                                                                          \
23                                                                                \
24     static CPPUNIT_NS::TestSuite *suite()                                      \
25     {                                                                          \
26       const CPPUNIT_NS::TestNamer &namer = getTestNamer__();                   \
27       std::unique_ptr<CPPUNIT_NS::TestSuite> suite(                            \
28              new CPPUNIT_NS::TestSuite( namer.getFixtureName() ));             \
29       CPPUNIT_NS::ConcretTestFixtureFactory<TestFixtureType> factory;          \
30       CPPUNIT_NS::TestSuiteBuilderContextBase context( *suite.get(),           \
31                                                        namer,                  \
32                                                        factory );              \
33       TestFixtureType::addTestsToSuite( context );                             \
34       return suite.release();                                                  \
35     }                                                                          \
36   private: /* dummy typedef so that the macro can still end with ';'*/         \
37     typedef int CppUnitDummyTypedefForSemiColonEnding__
38 
39 #endif /* HAVE_UNIQUE_PTR */
40 #endif /* HAVE_CPPUNIT_EXTENSIONS_HELPERMACROS_H */
41 #endif /* SQUID_COMPAT_CPPUNIT_H */
42 
43