|
Last change
on this file since 10543 was
10535,
checked in by landauf, 10 years ago
|
|
statically initialized instances are now registered with a type. CoreStaticInitializationHandler initializes all instances in core, NetworkStaticInitializationHandler initializes all instances in network.
|
-
Property svn:eol-style set to
native
|
|
File size:
1.4 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() |
|---|
| 23 | { |
|---|
| 24 | ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | virtual void TearDown() |
|---|
| 28 | { |
|---|
| 29 | ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); |
|---|
| 30 | } |
|---|
| 31 | }; |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | TEST_F(IdentifiableTest, CanCreate) |
|---|
| 35 | { |
|---|
| 36 | IdentifiableClass* test = new IdentifiableClass(); |
|---|
| 37 | ASSERT_TRUE(test != NULL); |
|---|
| 38 | delete test; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | TEST_F(IdentifiableTest, HasIdentifierAssigned) |
|---|
| 42 | { |
|---|
| 43 | IdentifiableClass test; |
|---|
| 44 | EXPECT_TRUE(test.getIdentifier()); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | TEST_F(IdentifiableTest, CanBeIdentified) |
|---|
| 48 | { |
|---|
| 49 | IdentifiableClass test; |
|---|
| 50 | EXPECT_TRUE(test.isA(Class(IdentifiableClass))); |
|---|
| 51 | } |
|---|
| 52 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.