1 #include <utl/CountedObject.h>
2 #include <utl/CountedObjectRegistry.h>
3 #include <tst/Verify.h>
5 #include <cppunit/extensions/HelperMacros.h>
13 #define ASSERT_EQUAL(x, y) CPPUNIT_ASSERT(Verify<Equal>(x, y))
15 #define ASSERT_OBJECT_COUNTS(o, c, d, e) \
16 ASSERT_EQUAL(utl::CountedObject<o>::GetObjectsCreated(), (long int)(c)); \
17 ASSERT_EQUAL(utl::CountedObject<o>::GetObjectsDestroyed(), (long int)(d)); \
18 ASSERT_EQUAL(utl::CountedObject<o>::GetObjectsExisting(), (long int)(e))
20 #define ASSERT_EXTENDED_OBJECT_COUNTS(o, c, d, e, cp, a) \
21 ASSERT_OBJECT_COUNTS(o, c, d, e); \
22 ASSERT_EQUAL(utl::CountedObject<o>::GetObjectsCopied(), (long int)(cp)); \
23 ASSERT_EQUAL(utl::CountedObject<o>::GetObjectsAssigned(), (long int)(a))
26 std::cout << 'c' << utl::CountedObject<o>::GetObjectsCreated() << " " \
27 "d" << utl::CountedObject<o>::GetObjectsDestroyed() << " " \
28 "e" << utl::CountedObject<o>::GetObjectsExisting() << " " \
29 "y" << utl::CountedObject<o>::GetObjectsCopied() << " " \
30 "=" << utl::CountedObject<o>::GetObjectsAssigned() << std::endl
44 CPPUNIT_TEST(testSimpleCount);
45 CPPUNIT_TEST(testCountTwoTypes);
46 CPPUNIT_TEST(testCopyAssign);
47 CPPUNIT_TEST(testPrintStatistics);
48 CPPUNIT_TEST_SUITE_END();
120 std::cerr << std::endl;
122 std::cerr << std::endl;
#define ASSERT_OBJECT_COUNTS(o, c, d, e)
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
#define ASSERT_EXTENDED_OBJECT_COUNTS(o, c, d, e, cp, a)
static void PrintStatistics(std::ostream &theStream, const std::string &filter="")
void testPrintStatistics()
Mix-in class for counting creation and destruction of objects.