Changeset 11071 for code/trunk/test/core/object/ObjectListIteratorTest.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/test/core/object/ObjectListIteratorTest.cc
r10624 r11071 3 3 4 4 #include "core/object/ObjectListIterator.h" 5 #include "core/object/Listable.h" 5 #include "core/class/OrxonoxClass.h" 6 #include "core/class/OrxonoxInterface.h" 6 7 #include "core/CoreIncludes.h" 7 8 #include "core/module/ModuleInstance.h" … … 11 12 namespace 12 13 { 13 class ListableTest : public Listable14 class TestInterface : virtual public OrxonoxInterface 14 15 { 15 16 public: 16 ListableTest() { RegisterObject(ListableTest); } 17 TestInterface() { RegisterObject(TestInterface); } 18 }; 19 20 class TestClass : public OrxonoxClass, public TestInterface 21 { 22 public: 23 TestClass() { RegisterObject(TestClass); } 17 24 MOCK_METHOD0(test, void()); 18 25 }; 19 26 20 RegisterClassNoArgs(ListableTest); 27 RegisterClassNoArgs(TestInterface); 28 RegisterClassNoArgs(TestClass); 21 29 22 30 // Fixture … … 24 32 { 25 33 public: 26 virtual void SetUp() 34 virtual void SetUp() override 27 35 { 28 36 new IdentifierManager(); 29 37 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 30 Context::setRootContext(new Context( NULL));38 Context::setRootContext(new Context(nullptr)); 31 39 } 32 40 33 virtual void TearDown() 41 virtual void TearDown() override 34 42 { 35 43 Context::destroyRootContext(); … … 42 50 TEST_F(ObjectListIteratorTest, CanCreateIterator) 43 51 { 44 ObjectListIterator< ListableTest> it;52 ObjectListIterator<TestClass> it; 45 53 } 46 54 47 55 TEST_F(ObjectListIteratorTest, CanAssignIterator) 48 56 { 49 ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin(); 57 ObjectList<TestClass> list; 58 ObjectListIterator<TestClass> it = list.begin(); 50 59 } 51 60 … … 53 62 { 54 63 size_t i = 0; 55 for (ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin(); it != ObjectList<ListableTest>::end(); ++it) 64 ObjectList<TestClass> list; 65 for (ObjectListIterator<TestClass> it = list.begin(); it != list.end(); ++it) 56 66 ++i; 57 67 EXPECT_EQ(0u, i); … … 60 70 TEST_F(ObjectListIteratorTest, CanIterateOverFullList) 61 71 { 62 ListableTest test1; 63 ListableTest test2; 64 ListableTest test3; 72 TestClass test1; 73 TestClass test2; 74 TestClass test3; 75 TestInterface interface; 65 76 66 77 size_t i = 0; 67 for (ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin(); it != ObjectList<ListableTest>::end(); ++it) 78 ObjectList<TestClass> list; 79 for (ObjectListIterator<TestClass> it = list.begin(); it != list.end(); ++it) 68 80 { 69 81 ++i; … … 77 89 TEST_F(ObjectListIteratorTest, CanIterateReverseOverFullList) 78 90 { 79 ListableTest test1; 80 ListableTest test2; 81 ListableTest test3; 91 TestClass test1; 92 TestClass test2; 93 TestClass test3; 94 TestInterface interface; 82 95 83 96 size_t i = 0; 84 for (ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::rbegin(); it != ObjectList<ListableTest>::rend(); --it) 97 ObjectList<TestClass> list; 98 for (ObjectListIterator<TestClass> it = list.rbegin(); it != list.rend(); --it) 85 99 { 86 100 ++i; … … 94 108 TEST_F(ObjectListIteratorTest, CanCallObjects) 95 109 { 96 ListableTest test1; 97 ListableTest test2; 98 ListableTest test3; 110 TestClass test1; 111 TestClass test2; 112 TestClass test3; 113 TestInterface interface; 99 114 100 115 EXPECT_CALL(test1, test()); … … 102 117 EXPECT_CALL(test3, test()); 103 118 104 for (ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin(); it != ObjectList<ListableTest>::end(); ++it) 119 ObjectList<TestClass> list; 120 for (ObjectListIterator<TestClass> it = list.begin(); it != list.end(); ++it) 105 121 it->test(); 106 122 }
Note: See TracChangeset
for help on using the changeset viewer.