From: Michal Voců Date: Fri, 16 Mar 2007 12:43:00 +0000 (+0000) Subject: * some tests X-Git-Tag: glite-lb-server-bones_R_2_2_4_1~7 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=15adce1f4a6a5f665fb7779043a3d9312bf3af0c;p=jra1mw.git * some tests --- 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 );