DarkflameServer/tests/dGameTests/GameDependencies.h
jadebenn a0d51e21ca
refactor: allow usage of NiPoint3 and NiQuaternion in constexpr context (#1414)
* allow usage of NiPoint3 and NiQuaternion in constexpr context

* removed .cpp files entirely

* moving circular dependency circumvention stuff to an .inl file

* real world usage!!!!!

* reverting weird branch cross-pollination

* removing more weird branch cross-pollination

* remove comment

* added inverse header guard to inl file

* Update NiPoint3.inl

* trying different constructor syntax

* reorganize into .inl files for readability

* uncomment include

* moved non-constexpr definitions to cpp file

* moved static definitions back to inl files

* testing fix

* moved constants into seperate namespace

* Undo change in build-and-test.yml

* nodiscard
2024-01-29 01:53:12 -06:00

56 lines
1.4 KiB
C++

#ifndef __GAMEDEPENDENCIES__H__
#define __GAMEDEPENDENCIES__H__
#include "Game.h"
#include "Logger.h"
#include "dServer.h"
#include "CDClientManager.h"
#include "EntityInfo.h"
#include "EntityManager.h"
#include "dConfig.h"
#include <gtest/gtest.h>
class dZoneManager;
class AssetManager;
class dServerMock : public dServer {
RakNet::BitStream* sentBitStream = nullptr;
public:
dServerMock() {};
~dServerMock() {};
RakNet::BitStream* GetMostRecentBitStream() { return sentBitStream; };
void Send(RakNet::BitStream* bitStream, const SystemAddress& sysAddr, bool broadcast) override { sentBitStream = bitStream; };
};
class GameDependenciesTest : public ::testing::Test {
protected:
void SetUpDependencies() {
info.pos = NiPoint3Constant::ZERO;
info.rot = NiQuaternionConstant::IDENTITY;
info.scale = 1.0f;
info.spawner = nullptr;
info.lot = 999;
Game::logger = new Logger("./testing.log", true, true);
Game::server = new dServerMock();
Game::config = new dConfig("worldconfig.ini");
Game::entityManager = new EntityManager();
// Create a CDClientManager instance and load from defaults
CDClientManager::Instance().LoadValuesFromDefaults();
}
void TearDownDependencies() {
if (Game::server) delete Game::server;
if (Game::entityManager) delete Game::entityManager;
if (Game::logger) {
Game::logger->Flush();
delete Game::logger;
}
if (Game::config) delete Game::config;
}
EntityInfo info{};
};
#endif //!__GAMEDEPENDENCIES__H__