mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-06-11 04:35:39 +00:00
Add test logs, fix seg faults in tests
This commit is contained in:
parent
1ae57dc6e8
commit
c35ab1f9e3
@ -29,8 +29,9 @@ constexpr const char* GetFileNameFromAbsolutePath(const char* path) {
|
|||||||
// they will not be valid constexpr and will be evaluated at runtime instead of compile time!
|
// they will not be valid constexpr and will be evaluated at runtime instead of compile time!
|
||||||
// The full string is still stored in the binary, however the offset of the filename in the absolute paths
|
// The full string is still stored in the binary, however the offset of the filename in the absolute paths
|
||||||
// is used in the instruction instead of the start of the absolute path.
|
// is used in the instruction instead of the start of the absolute path.
|
||||||
#define LOG(message, ...) do { auto str = FILENAME_AND_LINE; Game::logger->Log(str, message, ##__VA_ARGS__); Game::logger->Flush(); } while(0)
|
#define LOG(message, ...) do { auto str = FILENAME_AND_LINE; Game::logger->Log(str, message, ##__VA_ARGS__); } while(0)
|
||||||
#define LOG_DEBUG(message, ...) do { auto str = FILENAME_AND_LINE; Game::logger->LogDebug(str, message, ##__VA_ARGS__); } while(0)
|
#define LOG_DEBUG(message, ...) do { auto str = FILENAME_AND_LINE; Game::logger->LogDebug(str, message, ##__VA_ARGS__); } while(0)
|
||||||
|
#define LOG_TEST(message, ...) do { auto str = FILENAME_AND_LINE; Game::logger->LogDebug(str, message, ##__VA_ARGS__); Game::logger->Flush();} while(0)
|
||||||
|
|
||||||
// Writer class for writing data to files.
|
// Writer class for writing data to files.
|
||||||
class Writer {
|
class Writer {
|
||||||
|
@ -71,11 +71,11 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeserializeSimpleMoverPlatformSubComponent() {
|
void DeserializeSimpleMoverPlatformSubComponent() {
|
||||||
bool dirtyStartingPoint;
|
bool dirtyStartingPoint = false;
|
||||||
bitStream.Read(dirtyStartingPoint);
|
bitStream.Read(dirtyStartingPoint);
|
||||||
ASSERT_TRUE(dirtyStartingPoint);
|
ASSERT_TRUE(dirtyStartingPoint);
|
||||||
|
|
||||||
bool hasStartingPoint;
|
bool hasStartingPoint = false;
|
||||||
bitStream.Read(hasStartingPoint);
|
bitStream.Read(hasStartingPoint);
|
||||||
ASSERT_TRUE(hasStartingPoint);
|
ASSERT_TRUE(hasStartingPoint);
|
||||||
|
|
||||||
@ -231,6 +231,8 @@ TEST_F(MovingPlatformComponentTests, MovingPlatformSerializationTest) {
|
|||||||
|
|
||||||
TEST_F(MovingPlatformComponentTests, MovingPlatformSubComponentPathAdvanceForwardTest) {
|
TEST_F(MovingPlatformComponentTests, MovingPlatformSubComponentPathAdvanceForwardTest) {
|
||||||
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
||||||
|
moverPlatformSubComponent.SetupPath("ExamplePath", 0, false);
|
||||||
|
|
||||||
moverPlatformSubComponent.AdvanceToNextWaypoint();
|
moverPlatformSubComponent.AdvanceToNextWaypoint();
|
||||||
ASSERT_EQ(moverPlatformSubComponent.GetCurrentWaypointIndex(), 1);
|
ASSERT_EQ(moverPlatformSubComponent.GetCurrentWaypointIndex(), 1);
|
||||||
ASSERT_EQ(moverPlatformSubComponent.GetNextWaypointIndex(), 2);
|
ASSERT_EQ(moverPlatformSubComponent.GetNextWaypointIndex(), 2);
|
||||||
@ -247,6 +249,8 @@ TEST_F(MovingPlatformComponentTests, MovingPlatformSubComponentPathAdvanceForwar
|
|||||||
|
|
||||||
TEST_F(MovingPlatformComponentTests, MovingPlatformSubComponentPathAdvanceReverseTest) {
|
TEST_F(MovingPlatformComponentTests, MovingPlatformSubComponentPathAdvanceReverseTest) {
|
||||||
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
||||||
|
moverPlatformSubComponent.SetupPath("ExamplePath", 0, true);
|
||||||
|
|
||||||
moverPlatformSubComponent.AdvanceToNextReverseWaypoint();
|
moverPlatformSubComponent.AdvanceToNextReverseWaypoint();
|
||||||
ASSERT_EQ(moverPlatformSubComponent.GetCurrentWaypointIndex(), 1);
|
ASSERT_EQ(moverPlatformSubComponent.GetCurrentWaypointIndex(), 1);
|
||||||
ASSERT_EQ(moverPlatformSubComponent.GetNextWaypointIndex(), 0);
|
ASSERT_EQ(moverPlatformSubComponent.GetNextWaypointIndex(), 0);
|
||||||
@ -264,6 +268,8 @@ TEST_F(MovingPlatformComponentTests, MovingPlatformSubComponentPathAdvanceRevers
|
|||||||
|
|
||||||
TEST_F(MovingPlatformComponentTests, MovingPlatformSubComponentPathAdvanceTest) {
|
TEST_F(MovingPlatformComponentTests, MovingPlatformSubComponentPathAdvanceTest) {
|
||||||
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
||||||
|
moverPlatformSubComponent.SetupPath("ExamplePath", 0, false);
|
||||||
|
|
||||||
moverPlatformSubComponent.AdvanceToNextWaypoint();
|
moverPlatformSubComponent.AdvanceToNextWaypoint();
|
||||||
ASSERT_EQ(moverPlatformSubComponent.GetCurrentWaypointIndex(), 1);
|
ASSERT_EQ(moverPlatformSubComponent.GetCurrentWaypointIndex(), 1);
|
||||||
ASSERT_EQ(moverPlatformSubComponent.GetNextWaypointIndex(), 2);
|
ASSERT_EQ(moverPlatformSubComponent.GetNextWaypointIndex(), 2);
|
||||||
@ -301,6 +307,8 @@ TEST_F(MovingPlatformComponentTests, MovingPlatformMoverSpeedCalculationTest) {
|
|||||||
|
|
||||||
TEST_F(MovingPlatformComponentTests, MovingPlatformNextAndCurrentWaypointAccess) {
|
TEST_F(MovingPlatformComponentTests, MovingPlatformNextAndCurrentWaypointAccess) {
|
||||||
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
||||||
|
moverPlatformSubComponent.SetupPath("ExamplePath", 0, false);
|
||||||
|
|
||||||
ASSERT_EQ(moverPlatformSubComponent.GetCurrentWaypoint().position, NiPoint3(1, 2, 3));
|
ASSERT_EQ(moverPlatformSubComponent.GetCurrentWaypoint().position, NiPoint3(1, 2, 3));
|
||||||
ASSERT_EQ(moverPlatformSubComponent.GetNextWaypoint().position, NiPoint3(4, 5, 6));
|
ASSERT_EQ(moverPlatformSubComponent.GetNextWaypoint().position, NiPoint3(4, 5, 6));
|
||||||
moverPlatformSubComponent.AdvanceToNextWaypoint();
|
moverPlatformSubComponent.AdvanceToNextWaypoint();
|
||||||
@ -310,6 +318,8 @@ TEST_F(MovingPlatformComponentTests, MovingPlatformNextAndCurrentWaypointAccess)
|
|||||||
|
|
||||||
TEST_F(MovingPlatformComponentTests, MovingPlatformRunTest) {
|
TEST_F(MovingPlatformComponentTests, MovingPlatformRunTest) {
|
||||||
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
||||||
|
moverPlatformSubComponent.SetupPath("ExamplePath", 0, false);
|
||||||
|
|
||||||
path.pathWaypoints.at(0).position = NiPoint3(99.296440f, 419.293335f, 207.219498f);
|
path.pathWaypoints.at(0).position = NiPoint3(99.296440f, 419.293335f, 207.219498f);
|
||||||
path.pathWaypoints.at(0).movingPlatform.speed = 16.0f;
|
path.pathWaypoints.at(0).movingPlatform.speed = 16.0f;
|
||||||
|
|
||||||
@ -327,6 +337,8 @@ TEST_F(MovingPlatformComponentTests, MovingPlatformRunTest) {
|
|||||||
|
|
||||||
TEST_F(MovingPlatformComponentTests, MovingPlatformPercentBetweenPointsTest) {
|
TEST_F(MovingPlatformComponentTests, MovingPlatformPercentBetweenPointsTest) {
|
||||||
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
MoverPlatformSubComponent moverPlatformSubComponent(baseEntity->GetComponent<MovingPlatformComponent>());
|
||||||
|
moverPlatformSubComponent.SetupPath("ExamplePath", 0, false);
|
||||||
|
|
||||||
path.pathWaypoints.at(0).position = NiPoint3(0, 0, 1);
|
path.pathWaypoints.at(0).position = NiPoint3(0, 0, 1);
|
||||||
path.pathWaypoints.at(1).position = NiPoint3(0, 0, 3);
|
path.pathWaypoints.at(1).position = NiPoint3(0, 0, 3);
|
||||||
// moverPlatformSubComponent.m_Position = NiPoint3(0, 0, 1);
|
// moverPlatformSubComponent.m_Position = NiPoint3(0, 0, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user