CreatureLib/tests/TestLibrary/TestLibrary.cpp

56 lines
1.7 KiB
C++

#ifdef TESTS_BUILD
#include "../../extern/catch.hpp"
#include "../../src/Battling/Library/BattleLibrary.hpp"
#include "../../src/Library/SpeciesLibrary.hpp"
#include "../../src/Library/AttackLibrary.hpp"
#include "../../src/Library/ItemLibrary.hpp"
#include "../../src/Library/GrowthRates/GrowthRateLibrary.hpp"
#include "../../src/Library/DataLibrary.hpp"
using namespace CreatureLib::Core;
using namespace CreatureLib::Library;
using namespace CreatureLib::Battling;
static BattleLibrary* __library = nullptr;
static SpeciesLibrary* BuildSpeciesLibrary(){
auto l = new SpeciesLibrary();
l->LoadSpecies("testSpecies1", new CreatureSpecies(0, "testSpecies1",
new SpeciesVariant("default", 1,1, 10, {"fire", "water"},
StatisticSet<uint16_t >(10,10,10,10,10,10),
{"testTalent"}, {"testSecretTalent"},
new LearnableAttacks(100)),
0.5f, "testGrowthRate", 5, 100));
return l;
}
static AttackLibrary* BuildAttackLibrary(){
auto l = new AttackLibrary();
return l;
}
static ItemLibrary* BuildItemLibrary(){
auto l = new ItemLibrary();
return l;
}
static GrowthRateLibrary* BuildGrowthRateLibrary(){
auto l = new GrowthRateLibrary();
return l;
}
static BattleLibrary* BuildLibrary(){
auto l = new DataLibrary(LibrarySettings(100, 4), BuildSpeciesLibrary(), BuildAttackLibrary(),
BuildItemLibrary(), BuildGrowthRateLibrary());
auto battleLib = new BattleLibrary(l, new BattleStatCalculator());
return battleLib;
}
[[maybe_unused]]
static BattleLibrary* GetLibrary(){
if (__library == nullptr){
__library = BuildLibrary();
}
return __library;
}
#endif