Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/test/core/class/IdentifiableTest.cc @ 10640

Last change on this file since 10640 was 10624, checked in by landauf, 9 years ago

merged branch core7 back to trunk

  • Property svn:eol-style set to native
File size: 1.5 KB
RevLine 
[9601]1#include <gtest/gtest.h>
2#include "core/CoreIncludes.h"
3#include "core/class/Identifiable.h"
[10624]4#include "core/module/ModuleInstance.h"
[9601]5
6namespace orxonox
7{
8    namespace
9    {
[10624]10        class IdentifiableClass : public Identifiable
[9601]11        {
12            public:
[10624]13                IdentifiableClass() { RegisterObject(IdentifiableClass); }
[9601]14        };
[10624]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                }
33        };
[9601]34    }
35
[10624]36    TEST_F(IdentifiableTest, CanCreate)
[9601]37    {
[10624]38        IdentifiableClass* test = new IdentifiableClass();
[9601]39        ASSERT_TRUE(test != NULL);
40        delete test;
41    }
42
[10624]43    TEST_F(IdentifiableTest, HasIdentifierAssigned)
[9601]44    {
[10624]45        IdentifiableClass test;
[9601]46        EXPECT_TRUE(test.getIdentifier());
47    }
48
[10624]49    TEST_F(IdentifiableTest, CanBeIdentified)
[9601]50    {
[10624]51        IdentifiableClass test;
52        EXPECT_TRUE(test.isA(Class(IdentifiableClass)));
[9601]53    }
54}
Note: See TracBrowser for help on using the repository browser.