mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-11 01:48:07 +00:00
Fix failing component tests and add missing component tests with submodule initialization
Co-authored-by: aronwk-aaron <26027722+aronwk-aaron@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "BuildBorderComponent.h"
|
||||
#include "Entity.h"
|
||||
#include "BitStream.h"
|
||||
#include "GameDependencies.h"
|
||||
|
||||
class BuildBorderComponentTest : public GameDependenciesTest {
|
||||
protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* Test BuildBorderComponent serialization for initial update
|
||||
*/
|
||||
TEST_F(BuildBorderComponentTest, SerializeInitialUpdate) {
|
||||
Entity testEntity(15, info);
|
||||
BuildBorderComponent buildBorderComponent(&testEntity);
|
||||
|
||||
RakNet::BitStream bitStream;
|
||||
buildBorderComponent.Serialize(bitStream, true);
|
||||
|
||||
bitStream.ResetReadPointer();
|
||||
|
||||
// BuildBorderComponent always writes true for initial update
|
||||
bool hasBorderData;
|
||||
ASSERT_TRUE(bitStream.Read(hasBorderData));
|
||||
EXPECT_TRUE(hasBorderData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test BuildBorderComponent serialization for regular update (should write nothing)
|
||||
*/
|
||||
TEST_F(BuildBorderComponentTest, SerializeRegularUpdate) {
|
||||
Entity testEntity(15, info);
|
||||
BuildBorderComponent buildBorderComponent(&testEntity);
|
||||
|
||||
RakNet::BitStream bitStream;
|
||||
buildBorderComponent.Serialize(bitStream, false);
|
||||
|
||||
bitStream.ResetReadPointer();
|
||||
|
||||
// For regular updates, BuildBorderComponent writes nothing
|
||||
EXPECT_EQ(bitStream.GetNumberOfBitsUsed(), 0);
|
||||
}
|
Reference in New Issue
Block a user