Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 6, 2015, 6:12:11 PM (9 years ago)
Author:
landauf
Message:

fixed tests

Location:
code/branches/core7/test/core/class
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/test/core/class/IdentifiableTest.cc

    r10400 r10533  
    22#include "core/CoreIncludes.h"
    33#include "core/class/Identifiable.h"
     4#include "core/module/ModuleInstance.h"
    45
    56namespace orxonox
     
    78    namespace
    89    {
    9         class IdentifiableTest : public Identifiable
     10        class IdentifiableClass : public Identifiable
    1011        {
    1112            public:
    12                 IdentifiableTest() { RegisterObject(IdentifiableTest); }
     13                IdentifiableClass() { RegisterObject(IdentifiableClass); }
    1314        };
    1415
    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        };
    1632    }
    1733
    18     TEST(IdentifiableTest, CanCreate)
     34    TEST_F(IdentifiableTest, CanCreate)
    1935    {
    20         IdentifiableTest* test = new IdentifiableTest();
     36        IdentifiableClass* test = new IdentifiableClass();
    2137        ASSERT_TRUE(test != NULL);
    2238        delete test;
    2339    }
    2440
    25     TEST(IdentifiableTest, HasIdentifierAssigned)
     41    TEST_F(IdentifiableTest, HasIdentifierAssigned)
    2642    {
    27         IdentifiableTest test;
     43        IdentifiableClass test;
    2844        EXPECT_TRUE(test.getIdentifier());
    2945    }
    3046
    31     TEST(IdentifiableTest, CanBeIdentified)
     47    TEST_F(IdentifiableTest, CanBeIdentified)
    3248    {
    33         IdentifiableTest test;
    34         EXPECT_TRUE(test.isA(Class(IdentifiableTest)));
     49        IdentifiableClass test;
     50        EXPECT_TRUE(test.isA(Class(IdentifiableClass)));
    3551    }
    3652}
  • code/branches/core7/test/core/class/IdentifierClassHierarchyTest.cc

    r10530 r10533  
    165165    }
    166166
    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 
    221167    TEST_F(IdentifierClassHierarchyTest, TestBaseInterface1)
    222168    {
  • code/branches/core7/test/core/class/IdentifierExternalClassHierarchyTest.cc

    r10530 r10533  
    7272    }
    7373
    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 
    9374    TEST_F(IdentifierExternalClassHierarchyTest, TestInterface)
    9475    {
  • code/branches/core7/test/core/class/IdentifierSimpleClassHierarchyTest.cc

    r10530 r10533  
    7474    }
    7575
    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 
    9576    TEST_F(IdentifierSimpleClassHierarchyTest, TestInterface)
    9677    {
  • code/branches/core7/test/core/class/IdentifierTest.cc

    r10400 r10533  
    22#include "core/CoreIncludes.h"
    33#include "core/class/Identifiable.h"
     4#include "core/module/ModuleInstance.h"
    45
    56namespace orxonox
     
    2122        RegisterClassNoArgs(TestClass);
    2223        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        };
    2339    }
    2440
    25     TEST(IdentifierTest, IdentifierExistsOfClass)
     41    TEST_F(IdentifierTest, IdentifierExistsOfClass)
    2642    {
    2743        TestClass test;
     
    3147    }
    3248
    33     TEST(IdentifierTest, IdentifierExistsOfSubclass)
     49    TEST_F(IdentifierTest, IdentifierExistsOfSubclass)
    3450    {
    3551        TestSubclass test;
     
    3955    }
    4056
    41     TEST(IdentifierTest, HasNameOfClass)
     57    TEST_F(IdentifierTest, HasNameOfClass)
    4258    {
    4359        TestClass test;
     
    4763    }
    4864
    49     TEST(IdentifierTest, HasNameOfSubClass)
     65    TEST_F(IdentifierTest, HasNameOfSubClass)
    5066    {
    5167        TestSubclass test;
Note: See TracChangeset for help on using the changeset viewer.