20 #include <cppunit/ui/text/TestRunner.h> 21 #include <cppunit/TextOutputter.h> 22 #include <cppunit/extensions/TestFactoryRegistry.h> 23 #include <cppunit/extensions/HelperMacros.h> 24 #include <cppunit/TestAssert.h> 28 #include <coil/Singleton.h> 29 #include <coil/Task.h> 30 #include <coil/Time.h> 37 std::cout <<
"A ctor entered" << std::endl;
40 std::cout <<
"A ctor done" << std::endl;
57 std::cout <<
"B ctor entered" << std::endl;
60 std::cout <<
"B ctor done" << std::endl;
84 std::cout <<
"C ctor entered" << std::endl;
87 std::cout <<
"C ctor done" << std::endl;
102 std::cout <<
"thread entered" << std::endl;
103 for (
int i(0); i < 10; ++i)
105 std::cout <<
"Getting A in thread" << std::endl;;
106 A&
a(A_::instance());
107 std::cout <<
"Getting A done in thread" << std::endl;;
108 B& b(B_::instance());
124 :
public CppUnit::TestFixture
127 CPPUNIT_TEST(test_case0);
128 CPPUNIT_TEST_SUITE_END();
168 for (
int i(0); i < 10; ++i)
170 std::cout <<
"Getting A in main" << std::endl;
171 A&
a(A_::instance());
172 std::cout <<
"Getting A done in main" << std::endl;
174 std::cout <<
"Getting B in main" << std::endl;
175 B& b(B_::instance());
176 std::cout <<
"Getting B done in main" << std::endl;
178 std::cout <<
"Getting C in main" << std::endl;
180 std::cout <<
"Getting C done in main" << std::endl;
200 int main(
int argc,
char* argv[])
202 CppUnit::TextUi::TestRunner runner;
203 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
204 CppUnit::Outputter* outputter =
205 new CppUnit::TextOutputter(&runner.result(), std::cout);
206 runner.setOutputter(outputter);
211 #endif // Singleton_cpp int main(int argc, char **argv)
virtual void tearDown()
Test finalization.
virtual int svc()
Execute thread.
static C & instance()
Create instance.
SingletonTests()
Constructor.
Singleton template class.
~SingletonTests()
Destructor.
CPPUNIT_TEST_SUITE_REGISTRATION(Singleton::SingletonTests)
int usleep(useconds_t usec)
Stop a processing at specified micro second time.
virtual void activate()
Create a thread.
virtual void setUp()
Test initialization.