* some tests
authorMichal Voců <michal@ruk.cuni.cz>
Fri, 16 Mar 2007 12:43:00 +0000 (12:43 +0000)
committerMichal Voců <michal@ruk.cuni.cz>
Fri, 16 Mar 2007 12:43:00 +0000 (12:43 +0000)
org.glite.lb.logger/src-nt/test/EventManagerTest.cpp [new file with mode: 0644]
org.glite.lb.logger/src-nt/test/SingletonTest.cpp [new file with mode: 0644]

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 (file)
index 0000000..bedaa03
--- /dev/null
@@ -0,0 +1,18 @@
+#include <cppunit/extensions/HelperMacros.h>
+
+#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 (file)
index 0000000..734db17
--- /dev/null
@@ -0,0 +1,55 @@
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "Singleton.H"
+
+class one : public Singleton<one> {
+       friend class Singleton<one>;
+};
+
+class two : public Singleton<two> {
+       friend class Singleton<two>;
+};
+
+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 );