Changeset c6a59b for src/Patterns
- Timestamp:
- May 5, 2016, 1:06:20 PM (9 years ago)
- Children:
- c1e104
- Parents:
- 039e15
- git-author:
- Frederik Heber <heber@…> (05/05/16 09:20:08)
- git-committer:
- Frederik Heber <heber@…> (05/05/16 13:06:20)
- Location:
- src/Patterns
- Files:
-
- 3 edited
-
Makefile.am (modified) (1 diff)
-
unittests/SingletonUnitTest.cpp (modified) (2 diffs)
-
unittests/SingletonUnitTest.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Patterns/Makefile.am
r039e15 rc6a59b 23 23 $(top_srcdir)/src/CodePatterns/ManipulablePrototypeFactory_impl.hpp \ 24 24 $(top_srcdir)/src/CodePatterns/ObservedValue.hpp \ 25 $(top_srcdir)/src/CodePatterns/Registry_impl.hpp \26 $(top_srcdir)/src/CodePatterns/Singleton_impl.hpp \27 25 $(top_srcdir)/src/CodePatterns/PrototypeFactory.hpp \ 28 26 $(top_srcdir)/src/CodePatterns/PrototypeFactory_impl.hpp \ 29 27 $(top_srcdir)/src/CodePatterns/Registry.hpp \ 30 $(top_srcdir)/src/CodePatterns/Singleton.hpp 28 $(top_srcdir)/src/CodePatterns/Registry_impl.hpp \ 29 $(top_srcdir)/src/CodePatterns/Singleton.hpp \ 30 $(top_srcdir)/src/CodePatterns/Singleton_impl.hpp 31 31 32 32 PATTERNDEBUGHEADER = -
src/Patterns/unittests/SingletonUnitTest.cpp
r039e15 rc6a59b 81 81 CONSTRUCT_SINGLETON(SingletonStub2); 82 82 83 void SingletonTest::setUp(){} 83 void SingletonTest::setUp() 84 { 85 ASSERT_DO(Assert::Throw); 86 } 87 84 88 void SingletonTest::tearDown(){} 85 89 … … 152 156 // mechanism. Check with Valgrind to see if memory-leak occurs 153 157 std::cout << "Not purging Singleton!\n Check with Valgrind to see if automatic purgins is working!" << std::endl; 158 } 154 159 160 void SingletonTest::LockedTest(){ 161 const AtomicInstance<SingletonStub1> ptr_1_1(SingletonStub1::getLockedInstance()); 162 const SingletonStub1 &test_1 = *ptr_1_1; 163 164 // this deadlocks 165 // AtomicInstance<SingletonStub1> ptr_1_2(SingletonStub1::getLockedInstance()); 166 167 AtomicInstance<SingletonStub2> ptr_2_1(SingletonStub2::getLockedInstance()); 168 SingletonStub2 &test_2 = *ptr_2_1; 169 170 // this deadlocks 171 // AtomicInstance<SingletonStub2> ptr_2_2(SingletonStub2::getLockedInstance()); 155 172 } -
src/Patterns/unittests/SingletonUnitTest.hpp
r039e15 rc6a59b 20 20 CPPUNIT_TEST_SUITE( SingletonTest ); 21 21 CPPUNIT_TEST ( ConstructionTest ); 22 CPPUNIT_TEST ( LockedTest ); 22 23 CPPUNIT_TEST_SUITE_END(); 23 24 … … 27 28 28 29 void ConstructionTest(); 30 void LockedTest(); 29 31 }; 30 32
Note:
See TracChangeset
for help on using the changeset viewer.
