From 15adce1f4a6a5f665fb7779043a3d9312bf3af0c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Voc=C5=AF?= Date: Fri, 16 Mar 2007 12:43:00 +0000 Subject: [PATCH] * some tests --- .../src-nt/test/EventManagerTest.cpp | 18 +++++++ org.glite.lb.logger/src-nt/test/SingletonTest.cpp | 55 ++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 org.glite.lb.logger/src-nt/test/EventManagerTest.cpp create mode 100644 org.glite.lb.logger/src-nt/test/SingletonTest.cpp diff --git a/org.glite.lb.logger/src-nt/test/EventManagerTest.cpp b/org.glite.lb.logger/src-nt/test/EventManagerTest.cpp new file mode 100644 index 0000000..bedaa03 --- /dev/null +++ b/org.glite.lb.logger/src-nt/test/EventManagerTest.cpp @@ -0,0 +1,18 @@ +#include + +#include "EventManager.H" + +class EventManagerTest: public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(EventManagerTest); + CPPUNIT_TEST_SUITE_END(); +public: + + void setUp() { + } + + void tearDown() { + } + +}; + +CPPUNIT_TEST_SUITE_REGISTRATION( EventManagerTest ); diff --git a/org.glite.lb.logger/src-nt/test/SingletonTest.cpp b/org.glite.lb.logger/src-nt/test/SingletonTest.cpp new file mode 100644 index 0000000..734db17 --- /dev/null +++ b/org.glite.lb.logger/src-nt/test/SingletonTest.cpp @@ -0,0 +1,55 @@ +#include + +#include "Singleton.H" + +class one : public Singleton { + friend class Singleton; +}; + +class two : public Singleton { + friend class Singleton; +}; + +class SingletonTest: public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(SingletonTest); + CPPUNIT_TEST(getInstance); + CPPUNIT_TEST(pair); + CPPUNIT_TEST(noCreate); + CPPUNIT_TEST_SUITE_END(); +public: + + void setUp() { + } + + void tearDown() { + } + + void getInstance() { + one *p; + one *q; + + p = one::instance(); + q = one::instance(); + CPPUNIT_ASSERT(p != NULL); + CPPUNIT_ASSERT(q != NULL); + CPPUNIT_ASSERT(p == q); + } + + void pair() { + one *p; + two *q; + + p = one::instance(); + q = two::instance(); + CPPUNIT_ASSERT(p != NULL); + CPPUNIT_ASSERT(q != NULL); + CPPUNIT_ASSERT((void*)p != (void*)q); + } + + void noCreate() { + one *p = new one; + + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION( SingletonTest ); -- 1.8.2.3