Gen7Tests/src/main.cpp

40 lines
1.5 KiB
C++

#define CATCH_CONFIG_RUNNER
#include "../extern/catch.hpp"
#include "BuildData/BuildNatures.hpp"
#include "BuildData/BuildSpecies.hpp"
#include "BuildData/BuildTypes.hpp"
#include "Library.hpp"
int main(int argc, char* argv[]) {
Catch::Session session;
std::string typesFile = "Types.csv";
std::string naturesFile = "Natures.csv";
std::string pokemonFile = "Pokemon.json";
using namespace Catch::clara;
auto cli = session.cli() | Opt(pokemonFile, "Species")["--species"]("Which species file to load.") |
Opt(typesFile, "Types")["--types"]("Which Types file to load.") |
Opt(naturesFile, "Natures")["--natures"]("Which Natures file to load.");
session.cli(cli);
int returnCode = session.applyCommandLine(argc, argv);
if (returnCode != 0) // Indicates a command line error
return returnCode;
auto typesLibrary = BuildTypes::Build(typesFile);
auto natureLibrary = BuildNatures::Build(naturesFile);
auto speciesLibrary = BuildSpecies::BuildLibrary(pokemonFile, typesLibrary);
if (typesLibrary == nullptr || speciesLibrary == nullptr || natureLibrary == nullptr)
return 1;
auto settings = new PkmnLib::Library::LibrarySettings(100, 4, 4096);
auto library = new PkmnLib::Library::PokemonLibrary(settings, speciesLibrary, nullptr, nullptr, nullptr,
typesLibrary, natureLibrary);
Library::SetStaticLib(library);
return session.run();
}