Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/invaders/test/core/class/IdentifierTest.cc @ 9948

Last change on this file since 9948 was 9659, checked in by landauf, 11 years ago

removed RegisterRootObject (replaced by RegisterObject)

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1#include <gtest/gtest.h>
2#include "core/CoreIncludes.h"
3#include "core/class/Identifiable.h"
4
5namespace orxonox
6{
7    namespace
8    {
9        class TestClass : public Identifiable
10        {
11            public:
12                TestClass() { RegisterObject(TestClass); }
13        };
14
15        class TestSubclass : public TestClass
16        {
17            public:
18                TestSubclass() { RegisterObject(TestSubclass); }
19        };
20    }
21
22    TEST(IdentifierTest, IdentifierExistsOfClass)
23    {
24        TestClass test;
25
26        Identifier* identifier = Class(TestClass);
27        EXPECT_TRUE(identifier != NULL);
28    }
29
30    TEST(IdentifierTest, IdentifierExistsOfSubclass)
31    {
32        TestSubclass test;
33
34        Identifier* identifier = Class(TestSubclass);
35        EXPECT_TRUE(identifier != NULL);
36    }
37
38    TEST(IdentifierTest, HasNameOfClass)
39    {
40        TestClass test;
41
42        Identifier* identifier = Class(TestClass);
43        EXPECT_EQ("TestClass", identifier->getName());
44    }
45
46    TEST(IdentifierTest, HasNameOfSubClass)
47    {
48        TestSubclass test;
49
50        Identifier* identifier = Class(TestSubclass);
51        EXPECT_EQ("TestSubclass", identifier->getName());
52    }
53}
Note: See TracBrowser for help on using the repository browser.