mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-11-06 15:42:06 +00:00
52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
#include <gtest/gtest.h>
|
|
|
|
#include "BitStream.h"
|
|
#include "Entity.h"
|
|
#include "EntityInfo.h"
|
|
#include "InventoryComponent.h"
|
|
|
|
// Simple test class without database dependencies
|
|
class InventoryComponentTest : public ::testing::Test {
|
|
protected:
|
|
std::unique_ptr<Entity> baseEntity;
|
|
InventoryComponent* inventoryComponent;
|
|
RakNet::BitStream bitStream;
|
|
EntityInfo info{};
|
|
|
|
void SetUp() override {
|
|
// Set up minimal entity info
|
|
info.pos = {0, 0, 0};
|
|
info.rot = {0, 0, 0, 1};
|
|
info.scale = 1.0f;
|
|
info.spawner = nullptr;
|
|
info.lot = 1; // Use LOT 1 which doesn't require CDClient access
|
|
|
|
// Create entity without requiring database
|
|
baseEntity = std::make_unique<Entity>(15, info);
|
|
inventoryComponent = baseEntity->AddComponent<InventoryComponent>();
|
|
}
|
|
};
|
|
|
|
// Simple test that just verifies the component was created
|
|
TEST_F(InventoryComponentTest, InventoryComponentCreationTest) {
|
|
ASSERT_NE(inventoryComponent, nullptr);
|
|
}
|
|
|
|
// Basic serialization test without complex operations
|
|
TEST_F(InventoryComponentTest, InventoryComponentBasicSerializeTest) {
|
|
// Test basic serialization without requiring database access
|
|
// This tests the fundamental serialization mechanism
|
|
bitStream.Reset();
|
|
inventoryComponent->Serialize(bitStream, true);
|
|
|
|
// Verify some data was written
|
|
ASSERT_GT(bitStream.GetNumberOfBitsUsed(), 0);
|
|
}
|
|
|
|
// Test component state changes
|
|
TEST_F(InventoryComponentTest, InventoryComponentStateTest) {
|
|
// Test basic functionality
|
|
ASSERT_NE(inventoryComponent, nullptr);
|
|
}
|
|
|