Changeset 10533 for code/branches/core7/test
- Timestamp:
- Jun 6, 2015, 6:12:11 PM (9 years ago)
- Location:
- code/branches/core7/test/core/class
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/test/core/class/IdentifiableTest.cc
r10400 r10533 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 Identifiable Test() { RegisterObject(IdentifiableTest); }13 IdentifiableClass() { RegisterObject(IdentifiableClass); } 13 14 }; 14 15 15 RegisterClassNoArgs(IdentifiableTest); 16 RegisterClassNoArgs(IdentifiableClass); 17 18 // Fixture 19 class IdentifiableTest : public ::testing::Test 20 { 21 public: 22 virtual void SetUp() 23 { 24 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(); 25 } 26 27 virtual void TearDown() 28 { 29 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(); 30 } 31 }; 16 32 } 17 33 18 TEST (IdentifiableTest, CanCreate)34 TEST_F(IdentifiableTest, CanCreate) 19 35 { 20 Identifiable Test* test = new IdentifiableTest();36 IdentifiableClass* test = new IdentifiableClass(); 21 37 ASSERT_TRUE(test != NULL); 22 38 delete test; 23 39 } 24 40 25 TEST (IdentifiableTest, HasIdentifierAssigned)41 TEST_F(IdentifiableTest, HasIdentifierAssigned) 26 42 { 27 Identifiable Testtest;43 IdentifiableClass test; 28 44 EXPECT_TRUE(test.getIdentifier()); 29 45 } 30 46 31 TEST (IdentifiableTest, CanBeIdentified)47 TEST_F(IdentifiableTest, CanBeIdentified) 32 48 { 33 Identifiable Testtest;34 EXPECT_TRUE(test.isA(Class(Identifiable Test)));49 IdentifiableClass test; 50 EXPECT_TRUE(test.isA(Class(IdentifiableClass))); 35 51 } 36 52 } -
code/branches/core7/test/core/class/IdentifierClassHierarchyTest.cc
r10530 r10533 165 165 } 166 166 167 TEST(IdentifierClassHierarchyTest_NoFixture, NoInitialization)168 {169 {170 Identifier* identifier = Class(BaseInterface1);171 EXPECT_EQ(0u, identifier->getChildren().size());172 EXPECT_EQ(0u, identifier->getParents().size());173 }174 {175 Identifier* identifier = Class(BaseInterface2);176 EXPECT_EQ(0u, identifier->getChildren().size());177 EXPECT_EQ(0u, identifier->getParents().size());178 }179 {180 Identifier* identifier = Class(Interface1);181 EXPECT_EQ(0u, identifier->getChildren().size());182 EXPECT_EQ(0u, identifier->getParents().size());183 }184 {185 Identifier* identifier = Class(Interface2);186 EXPECT_EQ(0u, identifier->getChildren().size());187 EXPECT_EQ(0u, identifier->getParents().size());188 }189 {190 Identifier* identifier = Class(BaseClass);191 EXPECT_EQ(0u, identifier->getChildren().size());192 EXPECT_EQ(0u, identifier->getParents().size());193 }194 {195 Identifier* identifier = Class(Class0);196 EXPECT_EQ(0u, identifier->getChildren().size());197 EXPECT_EQ(0u, identifier->getParents().size());198 }199 {200 Identifier* identifier = Class(Class1);201 EXPECT_EQ(0u, identifier->getChildren().size());202 EXPECT_EQ(0u, identifier->getParents().size());203 }204 {205 Identifier* identifier = Class(Class2a);206 EXPECT_EQ(0u, identifier->getChildren().size());207 EXPECT_EQ(0u, identifier->getParents().size());208 }209 {210 Identifier* identifier = Class(Class2b);211 EXPECT_EQ(0u, identifier->getChildren().size());212 EXPECT_EQ(0u, identifier->getParents().size());213 }214 {215 Identifier* identifier = Class(Class3);216 EXPECT_EQ(0u, identifier->getChildren().size());217 EXPECT_EQ(0u, identifier->getParents().size());218 }219 }220 221 167 TEST_F(IdentifierClassHierarchyTest, TestBaseInterface1) 222 168 { -
code/branches/core7/test/core/class/IdentifierExternalClassHierarchyTest.cc
r10530 r10533 72 72 } 73 73 74 TEST(IdentifierExternalClassHierarchyTest_NoFixture, NoInitialization)75 {76 {77 Identifier* identifier = Class(Interface);78 EXPECT_EQ(0u, identifier->getChildren().size());79 EXPECT_EQ(0u, identifier->getParents().size());80 }81 {82 Identifier* identifier = Class(BaseClass);83 EXPECT_EQ(0u, identifier->getChildren().size());84 EXPECT_EQ(0u, identifier->getParents().size());85 }86 {87 Identifier* identifier = Class(RealClass);88 EXPECT_EQ(0u, identifier->getChildren().size());89 EXPECT_EQ(0u, identifier->getParents().size());90 }91 }92 93 74 TEST_F(IdentifierExternalClassHierarchyTest, TestInterface) 94 75 { -
code/branches/core7/test/core/class/IdentifierSimpleClassHierarchyTest.cc
r10530 r10533 74 74 } 75 75 76 TEST(IdentifierSimpleClassHierarchyTest_NoFixture, NoInitialization)77 {78 {79 Identifier* identifier = Class(Interface);80 EXPECT_EQ(0u, identifier->getChildren().size());81 EXPECT_EQ(0u, identifier->getParents().size());82 }83 {84 Identifier* identifier = Class(BaseClass);85 EXPECT_EQ(0u, identifier->getChildren().size());86 EXPECT_EQ(0u, identifier->getParents().size());87 }88 {89 Identifier* identifier = Class(RealClass);90 EXPECT_EQ(0u, identifier->getChildren().size());91 EXPECT_EQ(0u, identifier->getParents().size());92 }93 }94 95 76 TEST_F(IdentifierSimpleClassHierarchyTest, TestInterface) 96 77 { -
code/branches/core7/test/core/class/IdentifierTest.cc
r10400 r10533 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 … … 21 22 RegisterClassNoArgs(TestClass); 22 23 RegisterClassNoArgs(TestSubclass); 24 25 // Fixture 26 class IdentifierTest : public ::testing::Test 27 { 28 public: 29 virtual void SetUp() 30 { 31 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(); 32 } 33 34 virtual void TearDown() 35 { 36 ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(); 37 } 38 }; 23 39 } 24 40 25 TEST (IdentifierTest, IdentifierExistsOfClass)41 TEST_F(IdentifierTest, IdentifierExistsOfClass) 26 42 { 27 43 TestClass test; … … 31 47 } 32 48 33 TEST (IdentifierTest, IdentifierExistsOfSubclass)49 TEST_F(IdentifierTest, IdentifierExistsOfSubclass) 34 50 { 35 51 TestSubclass test; … … 39 55 } 40 56 41 TEST (IdentifierTest, HasNameOfClass)57 TEST_F(IdentifierTest, HasNameOfClass) 42 58 { 43 59 TestClass test; … … 47 63 } 48 64 49 TEST (IdentifierTest, HasNameOfSubClass)65 TEST_F(IdentifierTest, HasNameOfSubClass) 50 66 { 51 67 TestSubclass test;
Note: See TracChangeset
for help on using the changeset viewer.