Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 11003 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
Line 
1#include <gtest/gtest.h>
2#include "core/CoreIncludes.h"
3#include "core/class/Identifiable.h"
4#include "core/module/ModuleInstance.h"
5
6namespace orxonox
7{
8    namespace
9    {
10        class IdentifiableClass : public Identifiable
11        {
12            public:
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                }
33        };
34    }
35
36    TEST_F(IdentifiableTest, CanCreate)
37    {
38        IdentifiableClass* test = new IdentifiableClass();
39        ASSERT_TRUE(test != NULL);
40        delete test;
41    }
42
43    TEST_F(IdentifiableTest, HasIdentifierAssigned)
44    {
45        IdentifiableClass test;
46        EXPECT_TRUE(test.getIdentifier());
47    }
48
49    TEST_F(IdentifiableTest, CanBeIdentified)
50    {
51        IdentifiableClass test;
52        EXPECT_TRUE(test.isA(Class(IdentifiableClass)));
53    }
54}
Note: See TracBrowser for help on using the repository browser.