-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from LimpingPebble/feat/stone-objects-idendifi…
…cations Feat/stone objects idendifications
- Loading branch information
Showing
44 changed files
with
200 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include "Core/Object.hpp" | ||
|
||
#include <gtest/gtest.h> | ||
|
||
using namespace Stone; | ||
|
||
class MockObject : public Core::Object { | ||
STONE_OBJECT(MockObject) | ||
}; | ||
|
||
class MockSubObject : public MockObject { | ||
STONE_OBJECT(MockSubObject) | ||
}; | ||
|
||
TEST(Object, ClassName) { | ||
auto mockObject = std::make_shared<MockObject>(); | ||
EXPECT_STREQ(mockObject->getClassName(), "MockObject"); | ||
|
||
auto mockSubObject = std::make_shared<MockSubObject>(); | ||
EXPECT_STREQ(mockSubObject->getClassName(), "MockSubObject"); | ||
|
||
const void *ptrFromObject = mockObject->getClassName(); | ||
const void *ptrFromClass = MockObject::StaticClassName(); | ||
|
||
EXPECT_EQ(ptrFromObject, ptrFromClass); | ||
|
||
EXPECT_EQ(mockObject->getClassName(), MockObject::StaticClassName()); | ||
} | ||
|
||
TEST(Object, HashCode) { | ||
auto mockObject = std::make_shared<MockObject>(); | ||
auto mockSubObject = std::make_shared<MockSubObject>(); | ||
|
||
EXPECT_EQ(mockObject->getClassHashCode(), MockObject::StaticHashCode()); | ||
EXPECT_EQ(mockSubObject->getClassHashCode(), MockSubObject::StaticHashCode()); | ||
} | ||
|
||
TEST(Object, SwitchClassName) { | ||
|
||
auto mockObject = std::make_shared<MockObject>(); | ||
auto mockSubObject = std::make_shared<MockSubObject>(); | ||
|
||
std::map<std::intptr_t, int> classCaster = { | ||
{ Core::Object::StaticHashCode(), 0}, | ||
{ MockObject::StaticHashCode(), 1}, | ||
{MockSubObject::StaticHashCode(), 2} | ||
}; | ||
|
||
EXPECT_EQ(classCaster[mockObject->getClassHashCode()], 1); | ||
EXPECT_EQ(classCaster[mockSubObject->getClassHashCode()], 2); | ||
} | ||
|
||
TEST(Object, Id) { | ||
auto object = std::make_shared<MockObject>(); | ||
auto object2 = std::make_shared<MockObject>(); | ||
|
||
EXPECT_NE(object->getId(), object2->getId()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.