Changeset 10624 for code/trunk/test/core
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 1 deleted
- 18 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/test/core/CMakeLists.txt
r10188 r10624 12 12 class/IdentifierClassHierarchyTest.cc 13 13 class/IdentifierSimpleClassHierarchyTest.cc 14 class/IdentifierNestedClassHierarchyTest.cc 14 15 class/IdentifierExternalClassHierarchyTest.cc 15 16 class/OrxonoxClassTest.cc … … 25 26 object/ObjectListBaseTest.cc 26 27 object/ObjectListIteratorTest.cc 27 object/S martPtrTest.cc28 object/StrongPtrTest.cc 28 29 object/WeakPtrTest.cc 30 singleton/ScopeTest.cc 29 31 ) 30 32 ADD_DEPENDENCIES(all_tests core_test) -
code/trunk/test/core/class/IdentifiableTest.cc
r9659 r10624 2 2 #include "core/CoreIncludes.h" 3 3 #include "core/class/Identifiable.h" 4 #include "core/module/ModuleInstance.h" 4 5 5 6 namespace orxonox … … 7 8 namespace 8 9 { 9 class Identifiable Test: public Identifiable10 class IdentifiableClass : public Identifiable 10 11 { 11 12 public: 12 IdentifiableTest() { RegisterObject(IdentifiableTest); } 13 IdentifiableClass() { RegisterObject(IdentifiableClass); } 14 }; 15 16 RegisterClassNoArgs(IdentifiableClass); 17 18 // Fixture 19 class IdentifiableTest : public ::testing::Test 20 { 21 public: 22 virtual void SetUp() 23 { 24 new IdentifierManager(); 25 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 26 } 27 28 virtual void TearDown() 29 { 30 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 31 delete &IdentifierManager::getInstance(); 32 } 13 33 }; 14 34 } 15 35 16 TEST (IdentifiableTest, CanCreate)36 TEST_F(IdentifiableTest, CanCreate) 17 37 { 18 Identifiable Test* test = new IdentifiableTest();38 IdentifiableClass* test = new IdentifiableClass(); 19 39 ASSERT_TRUE(test != NULL); 20 40 delete test; 21 41 } 22 42 23 TEST (IdentifiableTest, HasIdentifierAssigned)43 TEST_F(IdentifiableTest, HasIdentifierAssigned) 24 44 { 25 Identifiable Testtest;45 IdentifiableClass test; 26 46 EXPECT_TRUE(test.getIdentifier()); 27 47 } 28 48 29 TEST (IdentifiableTest, CanBeIdentified)49 TEST_F(IdentifiableTest, CanBeIdentified) 30 50 { 31 Identifiable Testtest;32 EXPECT_TRUE(test.isA(Class(Identifiable Test)));51 IdentifiableClass test; 52 EXPECT_TRUE(test.isA(Class(IdentifiableClass))); 33 53 } 34 54 } -
code/trunk/test/core/class/IdentifierClassHierarchyTest.cc
r9659 r10624 4 4 #include "core/class/OrxonoxClass.h" 5 5 #include "core/class/OrxonoxInterface.h" 6 #include "core/module/ModuleInstance.h" 6 7 7 8 namespace orxonox … … 19 20 namespace 20 21 { 21 class BaseInterface1 : public OrxonoxInterface22 class BaseInterface1 : virtual public OrxonoxInterface 22 23 { 23 24 public: … … 30 31 }; 31 32 32 class BaseInterface2 : public OrxonoxInterface33 class BaseInterface2 : virtual public OrxonoxInterface 33 34 { 34 35 public: … … 124 125 }; 125 126 127 RegisterAbstractClass(BaseInterface1).inheritsFrom<OrxonoxInterface>(); 128 RegisterAbstractClass(BaseInterface2).inheritsFrom<OrxonoxInterface>(); 129 RegisterAbstractClass(Interface1).inheritsFrom<BaseInterface1>(); 130 RegisterAbstractClass(Interface2).inheritsFrom<BaseInterface2>(); 131 RegisterClassNoArgs(BaseClass); 132 RegisterClassNoArgs(Class0); 133 RegisterClassNoArgs(Class1); 134 RegisterClassNoArgs(Class2a); 135 RegisterClassNoArgs(Class2b); 136 RegisterClassNoArgs(Class3); 137 126 138 // Fixture 127 139 class IdentifierClassHierarchyTest : public ::testing::Test … … 130 142 virtual void SetUp() 131 143 { 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 144 new IdentifierManager(); 145 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 146 Context::setRootContext(new Context(NULL)); 147 Identifier::initConfigValues_s = false; // TODO: hack! 148 148 IdentifierManager::getInstance().createClassHierarchy(); 149 149 } … … 151 151 virtual void TearDown() 152 152 { 153 IdentifierManager::getInstance().destroyAllIdentifiers(); 154 } 155 }; 153 IdentifierManager::getInstance().destroyClassHierarchy(); 154 Context::destroyRootContext(); 155 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 156 delete &IdentifierManager::getInstance(); 157 } 158 }; 159 160 bool contains(const std::list<const Identifier*> identifiers, Identifier* identifier) 161 { 162 return std::find(identifiers.begin(), identifiers.end(), identifier) != identifiers.end(); 163 } 156 164 157 165 bool contains(const std::set<const Identifier*> identifiers, Identifier* identifier) 158 166 { 159 167 return identifiers.find(identifier) != identifiers.end(); 160 }161 }162 163 TEST(IdentifierClassHierarchyTest_NoFixture, NoInitialization)164 {165 {166 Identifier* identifier = Class(BaseInterface1);167 EXPECT_EQ(0u, identifier->getChildren().size());168 EXPECT_EQ(0u, identifier->getParents().size());169 }170 {171 Identifier* identifier = Class(BaseInterface2);172 EXPECT_EQ(0u, identifier->getChildren().size());173 EXPECT_EQ(0u, identifier->getParents().size());174 }175 {176 Identifier* identifier = Class(Interface1);177 EXPECT_EQ(0u, identifier->getChildren().size());178 EXPECT_EQ(0u, identifier->getParents().size());179 }180 {181 Identifier* identifier = Class(Interface2);182 EXPECT_EQ(0u, identifier->getChildren().size());183 EXPECT_EQ(0u, identifier->getParents().size());184 }185 {186 Identifier* identifier = Class(BaseClass);187 EXPECT_EQ(0u, identifier->getChildren().size());188 EXPECT_EQ(0u, identifier->getParents().size());189 }190 {191 Identifier* identifier = Class(Class0);192 EXPECT_EQ(0u, identifier->getChildren().size());193 EXPECT_EQ(0u, identifier->getParents().size());194 }195 {196 Identifier* identifier = Class(Class1);197 EXPECT_EQ(0u, identifier->getChildren().size());198 EXPECT_EQ(0u, identifier->getParents().size());199 }200 {201 Identifier* identifier = Class(Class2a);202 EXPECT_EQ(0u, identifier->getChildren().size());203 EXPECT_EQ(0u, identifier->getParents().size());204 }205 {206 Identifier* identifier = Class(Class2b);207 EXPECT_EQ(0u, identifier->getChildren().size());208 EXPECT_EQ(0u, identifier->getParents().size());209 }210 {211 Identifier* identifier = Class(Class3);212 EXPECT_EQ(0u, identifier->getChildren().size());213 EXPECT_EQ(0u, identifier->getParents().size());214 168 } 215 169 } -
code/trunk/test/core/class/IdentifierExternalClassHierarchyTest.cc
r9659 r10624 2 2 #include "core/CoreIncludes.h" 3 3 #include "core/class/Identifiable.h" 4 #include "core/module/ModuleInstance.h" 4 5 5 6 namespace orxonox … … 38 39 }; 39 40 41 RegisterAbstractClass(Interface).inheritsFrom<Identifiable>(); 42 RegisterClassNoArgs(BaseClass); 43 RegisterClassNoArgs(RealClass); 44 40 45 // Fixture 41 46 class IdentifierExternalClassHierarchyTest : public ::testing::Test … … 44 49 virtual void SetUp() 45 50 { 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 51 new IdentifierManager(); 52 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 53 Context::setRootContext(new Context(NULL)); 54 Identifier::initConfigValues_s = false; // TODO: hack! 52 55 IdentifierManager::getInstance().createClassHierarchy(); 53 56 } … … 55 58 virtual void TearDown() 56 59 { 57 IdentifierManager::getInstance().destroyAllIdentifiers(); 60 IdentifierManager::getInstance().destroyClassHierarchy(); 61 Context::destroyRootContext(); 62 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 63 delete &IdentifierManager::getInstance(); 58 64 } 59 65 }; 66 67 bool contains(const std::list<const Identifier*> identifiers, Identifier* identifier) 68 { 69 return std::find(identifiers.begin(), identifiers.end(), identifier) != identifiers.end(); 70 } 60 71 61 72 bool contains(const std::set<const Identifier*> identifiers, Identifier* identifier) 62 73 { 63 74 return identifiers.find(identifier) != identifiers.end(); 64 }65 }66 67 TEST(IdentifierExternalClassHierarchyTest_NoFixture, NoInitialization)68 {69 {70 Identifier* identifier = Class(Interface);71 EXPECT_EQ(0u, identifier->getChildren().size());72 EXPECT_EQ(0u, identifier->getParents().size());73 }74 {75 Identifier* identifier = Class(BaseClass);76 EXPECT_EQ(0u, identifier->getChildren().size());77 EXPECT_EQ(0u, identifier->getParents().size());78 }79 {80 Identifier* identifier = Class(RealClass);81 EXPECT_EQ(0u, identifier->getChildren().size());82 EXPECT_EQ(0u, identifier->getParents().size());83 75 } 84 76 } -
code/trunk/test/core/class/IdentifierSimpleClassHierarchyTest.cc
r9659 r10624 4 4 #include "core/class/OrxonoxClass.h" 5 5 #include "core/class/OrxonoxInterface.h" 6 #include "core/module/ModuleInstance.h" 6 7 7 8 namespace orxonox … … 9 10 namespace 10 11 { 11 class Interface : public OrxonoxInterface12 class Interface : virtual public OrxonoxInterface 12 13 { 13 14 public: … … 40 41 }; 41 42 43 RegisterAbstractClass(Interface).inheritsFrom<OrxonoxInterface>(); 44 RegisterClassNoArgs(BaseClass); 45 RegisterClassNoArgs(RealClass); 46 42 47 // Fixture 43 48 class IdentifierSimpleClassHierarchyTest : public ::testing::Test … … 46 51 virtual void SetUp() 47 52 { 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 53 new IdentifierManager(); 54 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 55 Context::setRootContext(new Context(NULL)); 56 Identifier::initConfigValues_s = false; // TODO: hack! 57 57 IdentifierManager::getInstance().createClassHierarchy(); 58 58 } … … 60 60 virtual void TearDown() 61 61 { 62 IdentifierManager::getInstance().destroyAllIdentifiers(); 62 IdentifierManager::getInstance().destroyClassHierarchy(); 63 Context::destroyRootContext(); 64 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 65 delete &IdentifierManager::getInstance(); 63 66 } 64 67 }; 68 69 bool contains(const std::list<const Identifier*> identifiers, Identifier* identifier) 70 { 71 return std::find(identifiers.begin(), identifiers.end(), identifier) != identifiers.end(); 72 } 65 73 66 74 bool contains(const std::set<const Identifier*> identifiers, Identifier* identifier) 67 75 { 68 76 return identifiers.find(identifier) != identifiers.end(); 69 }70 }71 72 TEST(IdentifierSimpleClassHierarchyTest_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 77 } 89 78 } -
code/trunk/test/core/class/IdentifierTest.cc
r9659 r10624 2 2 #include "core/CoreIncludes.h" 3 3 #include "core/class/Identifiable.h" 4 #include "core/module/ModuleInstance.h" 4 5 5 6 namespace orxonox … … 18 19 TestSubclass() { RegisterObject(TestSubclass); } 19 20 }; 21 22 RegisterClassNoArgs(TestClass); 23 RegisterClassNoArgs(TestSubclass); 24 25 // Fixture 26 class IdentifierTest : public ::testing::Test 27 { 28 public: 29 virtual void SetUp() 30 { 31 new IdentifierManager(); 32 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 33 } 34 35 virtual void TearDown() 36 { 37 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 38 delete &IdentifierManager::getInstance(); 39 } 40 }; 20 41 } 21 42 22 TEST (IdentifierTest, IdentifierExistsOfClass)43 TEST_F(IdentifierTest, IdentifierExistsOfClass) 23 44 { 24 45 TestClass test; … … 28 49 } 29 50 30 TEST (IdentifierTest, IdentifierExistsOfSubclass)51 TEST_F(IdentifierTest, IdentifierExistsOfSubclass) 31 52 { 32 53 TestSubclass test; … … 36 57 } 37 58 38 TEST (IdentifierTest, HasNameOfClass)59 TEST_F(IdentifierTest, HasNameOfClass) 39 60 { 40 61 TestClass test; … … 44 65 } 45 66 46 TEST (IdentifierTest, HasNameOfSubClass)67 TEST_F(IdentifierTest, HasNameOfSubClass) 47 68 { 48 69 TestSubclass test; -
code/trunk/test/core/class/OrxonoxClassTest.cc
r9649 r10624 1 1 #include <gtest/gtest.h> 2 2 #include "core/class/OrxonoxClass.h" 3 #include "core/class/IdentifierManager.h" 3 4 #include "core/object/Context.h" 4 5 … … 17 18 virtual void SetUp() 18 19 { 20 new IdentifierManager(); 19 21 Context::setRootContext(new Context(NULL)); 20 22 } … … 22 24 virtual void TearDown() 23 25 { 24 Context::setRootContext(NULL); 26 Context::destroyRootContext(); 27 delete &IdentifierManager::getInstance(); 25 28 } 26 29 }; -
code/trunk/test/core/class/OrxonoxInterfaceTest.cc
r9649 r10624 2 2 #include "core/class/OrxonoxInterface.h" 3 3 #include "core/class/OrxonoxClass.h" 4 #include "core/class/IdentifierManager.h" 4 5 #include "core/object/Context.h" 5 6 … … 32 33 virtual void SetUp() 33 34 { 35 new IdentifierManager(); 34 36 Context::setRootContext(new Context(NULL)); 35 37 } … … 37 39 virtual void TearDown() 38 40 { 39 Context::setRootContext(NULL); 41 Context::destroyRootContext(); 42 delete &IdentifierManager::getInstance(); 40 43 } 41 44 }; -
code/trunk/test/core/class/SubclassIdentifierTest.cc
r9659 r10624 4 4 #include "core/class/SubclassIdentifier.h" 5 5 #include "core/class/OrxonoxClass.h" 6 #include "core/module/ModuleInstance.h" 6 7 7 8 namespace orxonox … … 21 22 }; 22 23 24 RegisterClass(TestClass); 25 RegisterClass(TestSubclass); 26 23 27 // Fixture 24 28 class SubclassIdentifierTest : public ::testing::Test … … 27 31 virtual void SetUp() 28 32 { 29 registerClass("OrxonoxClass", new ClassFactoryNoArgs<OrxonoxClass>());30 registerClass("TestClass", new ClassFactoryWithContext<TestClass>());31 registerClass("TestSubclass", new ClassFactoryWithContext<TestSubclass>());32 33 new IdentifierManager(); 34 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 35 Context::setRootContext(new Context(NULL)); 36 Identifier::initConfigValues_s = false; // TODO: hack! 33 37 IdentifierManager::getInstance().createClassHierarchy(); 34 35 Context::setRootContext(new Context(NULL));36 38 } 37 39 38 40 virtual void TearDown() 39 41 { 40 Context::setRootContext(NULL); 41 42 IdentifierManager::getInstance().destroyAllIdentifiers(); 42 IdentifierManager::getInstance().destroyClassHierarchy(); 43 Context::destroyRootContext(); 44 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 45 delete &IdentifierManager::getInstance(); 43 46 } 44 47 }; -
code/trunk/test/core/class/SuperTest.cc
r9659 r10624 5 5 #include "core/BaseObject.h" 6 6 #include "core/class/Super.h" 7 #include "core/module/ModuleInstance.h" 7 8 8 9 namespace orxonox … … 62 63 }; 63 64 64 // Fixture 65 RegisterClass(TestClass); 66 RegisterClass(TestSubclass); 67 68 // Fixture 65 69 class SuperTest : public ::testing::Test 66 70 { … … 68 72 virtual void SetUp() 69 73 { 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 74 new IdentifierManager(); 75 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 76 Context::setRootContext(new Context(NULL)); 77 Identifier::initConfigValues_s = false; // TODO: hack! 77 78 IdentifierManager::getInstance().createClassHierarchy(); 78 79 Context::setRootContext(new Context(NULL));80 79 } 81 80 82 81 virtual void TearDown() 83 82 { 84 Context::setRootContext(NULL); 85 86 IdentifierManager::getInstance().destroyAllIdentifiers(); 83 IdentifierManager::getInstance().destroyClassHierarchy(); 84 Context::destroyRootContext(); 85 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 86 delete &IdentifierManager::getInstance(); 87 87 } 88 88 }; … … 97 97 98 98 EXPECT_EQ(1u, identifier->getDirectParents().size()); 99 EXPECT_TRUE( identifier->getDirectParents().find(Class(TestClass)) != identifier->getDirectParents().end());99 EXPECT_TRUE(std::find(identifier->getDirectParents().begin(), identifier->getDirectParents().end(), Class(TestClass)) != identifier->getDirectParents().end()); 100 100 } 101 101 { … … 106 106 107 107 EXPECT_EQ(1u, identifier->getDirectParents().size()); 108 EXPECT_TRUE( identifier->getDirectParents().find(Class(BaseObject)) != identifier->getDirectParents().end());108 EXPECT_TRUE(std::find(identifier->getDirectParents().begin(), identifier->getDirectParents().end(), Class(BaseObject)) != identifier->getDirectParents().end()); 109 109 } 110 110 } -
code/trunk/test/core/command/CommandTest.cc
r9603 r10624 1 1 #include <gtest/gtest.h> 2 #include "core/command/ConsoleCommand.h" 2 #include "core/class/Identifier.h" 3 #include "core/class/IdentifierManager.h" 4 #include "core/command/ConsoleCommandIncludes.h" 3 5 #include "core/command/CommandExecutor.h" 4 6 #include "core/object/Destroyable.h" 7 #include "core/module/ModuleInstance.h" 5 8 6 9 namespace orxonox … … 130 133 ModifyConsoleCommand("test").popFunction(); 131 134 } 135 136 // Fixture 137 class CommandTest : public ::testing::Test 138 { 139 public: 140 virtual void SetUp() 141 { 142 new IdentifierManager(); 143 new ConsoleCommandManager(); 144 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::CONSOLE_COMMAND); 145 Context::setRootContext(new Context(NULL)); 146 Identifier::initConfigValues_s = false; // TODO: hack! 147 IdentifierManager::getInstance().createClassHierarchy(); 148 } 149 150 virtual void TearDown() 151 { 152 IdentifierManager::getInstance().destroyClassHierarchy(); 153 Context::destroyRootContext(); 154 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::CONSOLE_COMMAND); 155 delete &ConsoleCommandManager::getInstance(); 156 delete &IdentifierManager::getInstance(); 157 } 158 }; 132 159 } 133 160 … … 139 166 } 140 167 141 TEST (CommandTest, ModuleTest)168 TEST_F(CommandTest, ModuleTest) 142 169 { 143 170 test(0, 0, 0); -
code/trunk/test/core/object/ClassFactoryTest.cc
r9649 r10624 3 3 #include "core/BaseObject.h" 4 4 #include "core/object/Context.h" 5 #include "core/module/ModuleInstance.h" 6 #include "core/CoreIncludes.h" 5 7 6 8 namespace orxonox … … 14 16 virtual void SetUp() 15 17 { 18 new IdentifierManager(); 19 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 16 20 Context::setRootContext(new Context(NULL)); 17 21 } … … 19 23 virtual void TearDown() 20 24 { 21 Context::setRootContext(NULL); 25 Context::destroyRootContext(); 26 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 27 delete &IdentifierManager::getInstance(); 22 28 } 23 29 }; -
code/trunk/test/core/object/ContextTest.cc
r9659 r10624 3 3 #include "core/class/OrxonoxClass.h" 4 4 #include "core/CoreIncludes.h" 5 #include "core/module/ModuleInstance.h" 5 6 6 7 namespace orxonox … … 14 15 }; 15 16 17 RegisterClassNoArgs(SubclassContext); 18 16 19 // Fixture 17 20 class ContextTest : public ::testing::Test … … 20 23 virtual void SetUp() 21 24 { 25 new IdentifierManager(); 26 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 22 27 Context::setRootContext(new Context(NULL)); 23 28 } … … 25 30 virtual void TearDown() 26 31 { 27 Context::setRootContext(NULL); 32 Context::destroyRootContext(); 33 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 34 delete &IdentifierManager::getInstance(); 28 35 } 29 36 }; -
code/trunk/test/core/object/IteratorTest.cc
r9659 r10624 6 6 #include "core/class/OrxonoxInterface.h" 7 7 #include "core/CoreIncludes.h" 8 #include "core/module/ModuleInstance.h" 8 9 9 10 namespace orxonox … … 24 25 }; 25 26 27 RegisterClassNoArgs(TestInterface); 28 RegisterClassNoArgs(TestClass); 29 26 30 // Fixture 27 31 class IteratorTest : public ::testing::Test … … 30 34 virtual void SetUp() 31 35 { 36 new IdentifierManager(); 37 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 32 38 Context::setRootContext(new Context(NULL)); 33 39 } … … 35 41 virtual void TearDown() 36 42 { 37 Context::setRootContext(NULL); 43 Context::destroyRootContext(); 44 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 45 delete &IdentifierManager::getInstance(); 38 46 } 39 47 }; -
code/trunk/test/core/object/ListableTest.cc
r9659 r10624 2 2 #include "core/object/Listable.h" 3 3 #include "core/CoreIncludes.h" 4 #include "core/module/ModuleInstance.h" 4 5 5 6 namespace orxonox … … 10 11 { 11 12 public: 12 ListableClassTest() { RegisterObject(ListableClassTest); }13 ListableClassTest() { RegisterObject(ListableClassTest); } 13 14 }; 14 15 … … 18 19 ListableSubclassTest() { RegisterObject(ListableSubclassTest); } 19 20 }; 21 22 RegisterClassNoArgs(ListableClassTest); 23 RegisterClassNoArgs(ListableSubclassTest); 20 24 21 25 template <class T> … … 35 39 virtual void SetUp() 36 40 { 41 new IdentifierManager(); 42 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 37 43 Context::setRootContext(new Context(NULL)); 38 44 } … … 40 46 virtual void TearDown() 41 47 { 42 Context::setRootContext(NULL); 48 Context::destroyRootContext(); 49 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 50 delete &IdentifierManager::getInstance(); 43 51 } 44 52 }; -
code/trunk/test/core/object/ObjectListIteratorTest.cc
r9659 r10624 5 5 #include "core/object/Listable.h" 6 6 #include "core/CoreIncludes.h" 7 #include "core/module/ModuleInstance.h" 7 8 8 9 namespace orxonox … … 17 18 }; 18 19 20 RegisterClassNoArgs(ListableTest); 21 19 22 // Fixture 20 23 class ObjectListIteratorTest : public ::testing::Test … … 23 26 virtual void SetUp() 24 27 { 28 new IdentifierManager(); 29 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 25 30 Context::setRootContext(new Context(NULL)); 26 31 } … … 28 33 virtual void TearDown() 29 34 { 30 Context::setRootContext(NULL); 35 Context::destroyRootContext(); 36 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); 37 delete &IdentifierManager::getInstance(); 31 38 } 32 39 }; -
code/trunk/test/core/object/WeakPtrTest.cc
r9603 r10624 45 45 test->destroy(); 46 46 } 47 48 void isNull(const WeakPtr<DestroyableTest> weakPtr) 49 { 50 EXPECT_TRUE(weakPtr == NULL); 51 EXPECT_TRUE(weakPtr == 0); 52 EXPECT_TRUE(!weakPtr); 53 EXPECT_FALSE(weakPtr != NULL); 54 EXPECT_FALSE(weakPtr != 0); 55 EXPECT_FALSE(weakPtr); 56 } 57 58 TEST(WeakPtrTest, IsNull) 59 { 60 { 61 WeakPtr<DestroyableTest> weakPtr; 62 isNull(weakPtr); 63 } 64 { 65 WeakPtr<DestroyableTest> weakPtr = NULL; 66 isNull(weakPtr); 67 } 68 { 69 WeakPtr<DestroyableTest> weakPtr; 70 weakPtr = NULL; 71 isNull(weakPtr); 72 } 73 { 74 WeakPtr<DestroyableTest> weakPtr = 0; 75 isNull(weakPtr); 76 } 77 { 78 WeakPtr<DestroyableTest> weakPtr; 79 weakPtr = 0; 80 isNull(weakPtr); 81 } 82 } 83 84 TEST(WeakPtrTest, IsNotNull) 85 { 86 DestroyableTest* test = new DestroyableTest(); 87 WeakPtr<DestroyableTest> weakPtr = test; 88 EXPECT_FALSE(weakPtr == NULL); 89 EXPECT_FALSE(weakPtr == 0); 90 EXPECT_FALSE(!weakPtr); 91 EXPECT_TRUE(weakPtr != NULL); 92 EXPECT_TRUE(weakPtr != 0); 93 EXPECT_TRUE(weakPtr); 94 test->destroy(); 95 } 47 96 }
Note: See TracChangeset
for help on using the changeset viewer.