Changeset 10400 for code/branches/core7/test
- Timestamp:
- Apr 26, 2015, 3:22:27 PM (10 years ago)
- Location:
- code/branches/core7/test/core
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/test/core/class/IdentifiableTest.cc
r9659 r10400 12 12 IdentifiableTest() { RegisterObject(IdentifiableTest); } 13 13 }; 14 15 RegisterClassNoArgs(IdentifiableTest); 14 16 } 15 17 -
code/branches/core7/test/core/class/IdentifierClassHierarchyTest.cc
r10372 r10400 124 124 }; 125 125 126 RegisterAbstractClass(BaseInterface1).inheritsFrom<OrxonoxInterface>(); 127 RegisterAbstractClass(BaseInterface2).inheritsFrom<OrxonoxInterface>(); 128 RegisterAbstractClass(Interface1).inheritsFrom<BaseInterface1>(); 129 RegisterAbstractClass(Interface2).inheritsFrom<BaseInterface2>(); 130 RegisterClassNoArgs(BaseClass); 131 RegisterClassNoArgs(Class0); 132 RegisterClassNoArgs(Class1); 133 RegisterClassNoArgs(Class2a); 134 RegisterClassNoArgs(Class2b); 135 RegisterClassNoArgs(Class3); 136 126 137 // Fixture 127 138 class IdentifierClassHierarchyTest : public ::testing::Test … … 130 141 virtual void SetUp() 131 142 { 132 registerClass("Context", new ClassFactoryWithContext<Context>());133 registerClass("Listable", new ClassFactoryWithContext<Listable>());134 registerClass("Configurable", new ClassFactoryNoArgs<Configurable>());135 registerClass("OrxonoxInterface", new ClassFactoryNoArgs<OrxonoxInterface>());136 registerClass("OrxonoxClass", new ClassFactoryNoArgs<OrxonoxClass>());137 registerClass("BaseInterface1", static_cast<ClassFactory<BaseInterface1>*>(NULL), false)->inheritsFrom(Class(OrxonoxInterface));138 registerClass("BaseInterface2", static_cast<ClassFactory<BaseInterface2>*>(NULL), false)->inheritsFrom(Class(OrxonoxInterface));139 registerClass("Interface1", static_cast<ClassFactory<Interface1>*>(NULL), false)->inheritsFrom(Class(BaseInterface1));140 registerClass("Interface2", static_cast<ClassFactory<Interface2>*>(NULL), false)->inheritsFrom(Class(BaseInterface2));141 registerClass("BaseClass", new ClassFactoryNoArgs<BaseClass>());142 registerClass("Class0", new ClassFactoryNoArgs<Class0>());143 registerClass("Class1", new ClassFactoryNoArgs<Class1>());144 registerClass("Class2a", new ClassFactoryNoArgs<Class2a>());145 registerClass("Class2b", new ClassFactoryNoArgs<Class2b>());146 registerClass("Class3", new ClassFactoryNoArgs<Class3>());147 148 IdentifierManager::getInstance().createClassHierarchy();149 143 } 150 144 151 145 virtual void TearDown() 152 146 { 153 IdentifierManager::getInstance().destroyAllIdentifiers();154 147 } 155 148 }; … … 166 159 } 167 160 168 TEST(IdentifierClassHierarchyTest_NoFixture, NoInitialization)169 {170 {171 Identifier* identifier = Class(BaseInterface1);172 EXPECT_EQ(0u, identifier->getChildren().size());173 EXPECT_EQ(0u, identifier->getParents().size());174 }175 {176 Identifier* identifier = Class(BaseInterface2);177 EXPECT_EQ(0u, identifier->getChildren().size());178 EXPECT_EQ(0u, identifier->getParents().size());179 }180 {181 Identifier* identifier = Class(Interface1);182 EXPECT_EQ(0u, identifier->getChildren().size());183 EXPECT_EQ(0u, identifier->getParents().size());184 }185 {186 Identifier* identifier = Class(Interface2);187 EXPECT_EQ(0u, identifier->getChildren().size());188 EXPECT_EQ(0u, identifier->getParents().size());189 }190 {191 Identifier* identifier = Class(BaseClass);192 EXPECT_EQ(0u, identifier->getChildren().size());193 EXPECT_EQ(0u, identifier->getParents().size());194 }195 {196 Identifier* identifier = Class(Class0);197 EXPECT_EQ(0u, identifier->getChildren().size());198 EXPECT_EQ(0u, identifier->getParents().size());199 }200 {201 Identifier* identifier = Class(Class1);202 EXPECT_EQ(0u, identifier->getChildren().size());203 EXPECT_EQ(0u, identifier->getParents().size());204 }205 {206 Identifier* identifier = Class(Class2a);207 EXPECT_EQ(0u, identifier->getChildren().size());208 EXPECT_EQ(0u, identifier->getParents().size());209 }210 {211 Identifier* identifier = Class(Class2b);212 EXPECT_EQ(0u, identifier->getChildren().size());213 EXPECT_EQ(0u, identifier->getParents().size());214 }215 {216 Identifier* identifier = Class(Class3);217 EXPECT_EQ(0u, identifier->getChildren().size());218 EXPECT_EQ(0u, identifier->getParents().size());219 }220 }161 // TEST(IdentifierClassHierarchyTest_NoFixture, NoInitialization) 162 // { 163 // { 164 // Identifier* identifier = Class(BaseInterface1); 165 // EXPECT_EQ(0u, identifier->getChildren().size()); 166 // EXPECT_EQ(0u, identifier->getParents().size()); 167 // } 168 // { 169 // Identifier* identifier = Class(BaseInterface2); 170 // EXPECT_EQ(0u, identifier->getChildren().size()); 171 // EXPECT_EQ(0u, identifier->getParents().size()); 172 // } 173 // { 174 // Identifier* identifier = Class(Interface1); 175 // EXPECT_EQ(0u, identifier->getChildren().size()); 176 // EXPECT_EQ(0u, identifier->getParents().size()); 177 // } 178 // { 179 // Identifier* identifier = Class(Interface2); 180 // EXPECT_EQ(0u, identifier->getChildren().size()); 181 // EXPECT_EQ(0u, identifier->getParents().size()); 182 // } 183 // { 184 // Identifier* identifier = Class(BaseClass); 185 // EXPECT_EQ(0u, identifier->getChildren().size()); 186 // EXPECT_EQ(0u, identifier->getParents().size()); 187 // } 188 // { 189 // Identifier* identifier = Class(Class0); 190 // EXPECT_EQ(0u, identifier->getChildren().size()); 191 // EXPECT_EQ(0u, identifier->getParents().size()); 192 // } 193 // { 194 // Identifier* identifier = Class(Class1); 195 // EXPECT_EQ(0u, identifier->getChildren().size()); 196 // EXPECT_EQ(0u, identifier->getParents().size()); 197 // } 198 // { 199 // Identifier* identifier = Class(Class2a); 200 // EXPECT_EQ(0u, identifier->getChildren().size()); 201 // EXPECT_EQ(0u, identifier->getParents().size()); 202 // } 203 // { 204 // Identifier* identifier = Class(Class2b); 205 // EXPECT_EQ(0u, identifier->getChildren().size()); 206 // EXPECT_EQ(0u, identifier->getParents().size()); 207 // } 208 // { 209 // Identifier* identifier = Class(Class3); 210 // EXPECT_EQ(0u, identifier->getChildren().size()); 211 // EXPECT_EQ(0u, identifier->getParents().size()); 212 // } 213 // } 221 214 222 215 TEST_F(IdentifierClassHierarchyTest, TestBaseInterface1) -
code/branches/core7/test/core/class/IdentifierExternalClassHierarchyTest.cc
r10372 r10400 38 38 }; 39 39 40 RegisterAbstractClass(Interface).inheritsFrom<Identifiable>(); 41 RegisterClassNoArgs(BaseClass); 42 RegisterClassNoArgs(RealClass); 43 40 44 // Fixture 41 45 class IdentifierExternalClassHierarchyTest : public ::testing::Test … … 44 48 virtual void SetUp() 45 49 { 46 registerClass("Context", new ClassFactoryWithContext<Context>());47 registerClass("Listable", new ClassFactoryWithContext<Listable>());48 registerClass("Interface", static_cast<ClassFactory<Interface>*>(NULL), false)->inheritsFrom(Class(Identifiable));49 registerClass("BaseClass", new ClassFactoryNoArgs<BaseClass>());50 registerClass("RealClass", new ClassFactoryNoArgs<RealClass>());51 52 IdentifierManager::getInstance().createClassHierarchy();53 50 } 54 51 55 52 virtual void TearDown() 56 53 { 57 IdentifierManager::getInstance().destroyAllIdentifiers();58 54 } 59 55 }; … … 70 66 } 71 67 72 TEST(IdentifierExternalClassHierarchyTest_NoFixture, NoInitialization)73 {74 {75 Identifier* identifier = Class(Interface);76 EXPECT_EQ(0u, identifier->getChildren().size());77 EXPECT_EQ(0u, identifier->getParents().size());78 }79 {80 Identifier* identifier = Class(BaseClass);81 EXPECT_EQ(0u, identifier->getChildren().size());82 EXPECT_EQ(0u, identifier->getParents().size());83 }84 {85 Identifier* identifier = Class(RealClass);86 EXPECT_EQ(0u, identifier->getChildren().size());87 EXPECT_EQ(0u, identifier->getParents().size());88 }89 }68 // TEST(IdentifierExternalClassHierarchyTest_NoFixture, NoInitialization) 69 // { 70 // { 71 // Identifier* identifier = Class(Interface); 72 // EXPECT_EQ(0u, identifier->getChildren().size()); 73 // EXPECT_EQ(0u, identifier->getParents().size()); 74 // } 75 // { 76 // Identifier* identifier = Class(BaseClass); 77 // EXPECT_EQ(0u, identifier->getChildren().size()); 78 // EXPECT_EQ(0u, identifier->getParents().size()); 79 // } 80 // { 81 // Identifier* identifier = Class(RealClass); 82 // EXPECT_EQ(0u, identifier->getChildren().size()); 83 // EXPECT_EQ(0u, identifier->getParents().size()); 84 // } 85 // } 90 86 91 87 TEST_F(IdentifierExternalClassHierarchyTest, TestInterface) -
code/branches/core7/test/core/class/IdentifierNestedClassHierarchyTest.cc
r10372 r10400 90 90 }; 91 91 92 RegisterClassNoArgs(Nested1); 93 RegisterClassNoArgs(Nested2); 94 RegisterClassNoArgs(BaseClass); 95 RegisterClassNoArgs(Class1_notNested); 96 RegisterClassNoArgs(Class2_oneNested); 97 RegisterClassNoArgs(Class3_twoNested); 98 RegisterClassNoArgs(Class4_class1Nested); 99 RegisterClassNoArgs(Class5_class2Nested); 100 RegisterClassNoArgs(Class6_class3Nested); 101 RegisterClassNoArgs(Class3_Child); 102 RegisterClassNoArgs(Class6_Child); 103 92 104 // Fixture 93 105 class IdentifierNestedClassHierarchyTest : public ::testing::Test … … 96 108 virtual void SetUp() 97 109 { 98 registerClass("Context", new ClassFactoryWithContext<Context>());99 registerClass("Listable", new ClassFactoryWithContext<Listable>());100 registerClass("Configurable", new ClassFactoryNoArgs<Configurable>());101 registerClass("OrxonoxClass", new ClassFactoryNoArgs<OrxonoxClass>());102 registerClass("Nested1", new ClassFactoryNoArgs<Nested1>());103 registerClass("Nested2", new ClassFactoryNoArgs<Nested2>());104 registerClass("BaseClass", new ClassFactoryNoArgs<BaseClass>());105 registerClass("Class1_notNested", new ClassFactoryNoArgs<Class1_notNested>());106 registerClass("Class2_oneNested", new ClassFactoryNoArgs<Class2_oneNested>());107 registerClass("Class3_twoNested", new ClassFactoryNoArgs<Class3_twoNested>());108 registerClass("Class4_class1Nested", new ClassFactoryNoArgs<Class4_class1Nested>());109 registerClass("Class5_class2Nested", new ClassFactoryNoArgs<Class5_class2Nested>());110 registerClass("Class6_class3Nested", new ClassFactoryNoArgs<Class6_class3Nested>());111 registerClass("Class3_Child", new ClassFactoryNoArgs<Class3_Child>());112 registerClass("Class6_Child", new ClassFactoryNoArgs<Class6_Child>());113 114 IdentifierManager::getInstance().createClassHierarchy();115 110 } 116 111 117 112 virtual void TearDown() 118 113 { 119 IdentifierManager::getInstance().destroyAllIdentifiers();120 114 } 121 115 }; -
code/branches/core7/test/core/class/IdentifierSimpleClassHierarchyTest.cc
r10372 r10400 9 9 namespace 10 10 { 11 class Interface : public OrxonoxInterface11 class Interface : virtual public OrxonoxInterface 12 12 { 13 13 public: … … 40 40 }; 41 41 42 RegisterAbstractClass(Interface).inheritsFrom<OrxonoxInterface>(); 43 RegisterClassNoArgs(BaseClass); 44 RegisterClassNoArgs(RealClass); 45 42 46 // Fixture 43 47 class IdentifierSimpleClassHierarchyTest : public ::testing::Test … … 46 50 virtual void SetUp() 47 51 { 48 registerClass("Context", new ClassFactoryWithContext<Context>());49 registerClass("Listable", new ClassFactoryWithContext<Listable>());50 registerClass("Configurable", new ClassFactoryNoArgs<Configurable>());51 registerClass("OrxonoxInterface", new ClassFactoryNoArgs<OrxonoxInterface>());52 registerClass("OrxonoxClass", new ClassFactoryNoArgs<OrxonoxClass>());53 registerClass("Interface", static_cast<ClassFactory<Interface>*>(NULL), false)->inheritsFrom(Class(OrxonoxInterface));54 registerClass("BaseClass", new ClassFactoryNoArgs<BaseClass>());55 registerClass("RealClass", new ClassFactoryNoArgs<RealClass>());56 57 IdentifierManager::getInstance().createClassHierarchy();58 52 } 59 53 60 54 virtual void TearDown() 61 55 { 62 IdentifierManager::getInstance().destroyAllIdentifiers();63 56 } 64 57 }; … … 75 68 } 76 69 77 TEST(IdentifierSimpleClassHierarchyTest_NoFixture, NoInitialization)78 {79 {80 Identifier* identifier = Class(Interface);81 EXPECT_EQ(0u, identifier->getChildren().size());82 EXPECT_EQ(0u, identifier->getParents().size());83 }84 {85 Identifier* identifier = Class(BaseClass);86 EXPECT_EQ(0u, identifier->getChildren().size());87 EXPECT_EQ(0u, identifier->getParents().size());88 }89 {90 Identifier* identifier = Class(RealClass);91 EXPECT_EQ(0u, identifier->getChildren().size());92 EXPECT_EQ(0u, identifier->getParents().size());93 }94 }70 // TEST(IdentifierSimpleClassHierarchyTest_NoFixture, NoInitialization) 71 // { 72 // { 73 // Identifier* identifier = Class(Interface); 74 // EXPECT_EQ(0u, identifier->getChildren().size()); 75 // EXPECT_EQ(0u, identifier->getParents().size()); 76 // } 77 // { 78 // Identifier* identifier = Class(BaseClass); 79 // EXPECT_EQ(0u, identifier->getChildren().size()); 80 // EXPECT_EQ(0u, identifier->getParents().size()); 81 // } 82 // { 83 // Identifier* identifier = Class(RealClass); 84 // EXPECT_EQ(0u, identifier->getChildren().size()); 85 // EXPECT_EQ(0u, identifier->getParents().size()); 86 // } 87 // } 95 88 96 89 TEST_F(IdentifierSimpleClassHierarchyTest, TestInterface) -
code/branches/core7/test/core/class/IdentifierTest.cc
r9659 r10400 18 18 TestSubclass() { RegisterObject(TestSubclass); } 19 19 }; 20 21 RegisterClassNoArgs(TestClass); 22 RegisterClassNoArgs(TestSubclass); 20 23 } 21 24 -
code/branches/core7/test/core/class/SubclassIdentifierTest.cc
r9659 r10400 21 21 }; 22 22 23 RegisterClass(TestClass); 24 RegisterClass(TestSubclass); 25 23 26 // Fixture 24 27 class SubclassIdentifierTest : public ::testing::Test … … 27 30 virtual void SetUp() 28 31 { 29 registerClass("OrxonoxClass", new ClassFactoryNoArgs<OrxonoxClass>());30 registerClass("TestClass", new ClassFactoryWithContext<TestClass>());31 registerClass("TestSubclass", new ClassFactoryWithContext<TestSubclass>());32 33 IdentifierManager::getInstance().createClassHierarchy();34 35 32 Context::setRootContext(new Context(NULL)); 36 33 } … … 39 36 { 40 37 Context::setRootContext(NULL); 41 42 IdentifierManager::getInstance().destroyAllIdentifiers();43 38 } 44 39 }; -
code/branches/core7/test/core/class/SuperTest.cc
r10372 r10400 62 62 }; 63 63 64 RegisterClass(TestClass); 65 RegisterClass(TestSubclass); 66 64 67 // Fixture 65 68 class SuperTest : public ::testing::Test … … 68 71 virtual void SetUp() 69 72 { 70 IdentifierManager::getInstance().destroyAllIdentifiers();71 72 registerClass("OrxonoxClass", new ClassFactoryNoArgs<OrxonoxClass>());73 registerClass("BaseObject", new ClassFactoryWithContext<BaseObject>());74 registerClass("TestClass", new ClassFactoryWithContext<TestClass>());75 registerClass("TestSubclass", new ClassFactoryWithContext<TestSubclass>());76 77 IdentifierManager::getInstance().createClassHierarchy();78 79 73 Context::setRootContext(new Context(NULL)); 80 74 } … … 83 77 { 84 78 Context::setRootContext(NULL); 85 86 IdentifierManager::getInstance().destroyAllIdentifiers();87 79 } 88 80 }; -
code/branches/core7/test/core/command/CommandTest.cc
r10356 r10400 1 1 #include <gtest/gtest.h> 2 #include "core/class/Identifier.h" 3 #include "core/class/IdentifierManager.h" 2 4 #include "core/command/ConsoleCommandIncludes.h" 3 5 #include "core/command/CommandExecutor.h" … … 143 145 { 144 146 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(); 147 Identifier::initConfigValues_s = false; // TODO: hack! 148 IdentifierManager::getInstance().createClassHierarchy(); 145 149 146 150 test(0, 0, 0);
Note: See TracChangeset
for help on using the changeset viewer.