Last change
on this file since 12380 was
11071,
checked in by landauf, 9 years ago
|
merged branch cpp11_v3 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 | |
---|
6 | namespace 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() override |
---|
23 | { |
---|
24 | new IdentifierManager(); |
---|
25 | ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); |
---|
26 | } |
---|
27 | |
---|
28 | virtual void TearDown() override |
---|
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 != nullptr); |
---|
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.