Last change
on this file since 12209 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
|
Rev | Line | |
---|
[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 | |
---|
| 6 | namespace 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: |
---|
[11071] | 22 | virtual void SetUp() override |
---|
[10624] | 23 | { |
---|
| 24 | new IdentifierManager(); |
---|
| 25 | ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); |
---|
| 26 | } |
---|
| 27 | |
---|
[11071] | 28 | virtual void TearDown() override |
---|
[10624] | 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(); |
---|
[11071] | 39 | ASSERT_TRUE(test != nullptr); |
---|
[9601] | 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.