Switch to doctest over Catch for unit tests.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/Library/Natures/NatureLibrary.hpp"
|
||||
#include "../../src/Library/Statistic.hpp"
|
||||
|
||||
using namespace PkmnLib::Library;
|
||||
|
||||
TEST_CASE("Able to create and delete nature library", "library") {
|
||||
TEST_CASE("Able to create and delete nature library") {
|
||||
auto lib = new NatureLibrary();
|
||||
delete lib;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to insert into nature library", "library") {
|
||||
TEST_CASE("Able to insert into nature library") {
|
||||
auto lib = new NatureLibrary();
|
||||
lib->LoadNature("testNature"_cnc, new Nature(Statistic::PhysicalAttack, Statistic::Speed));
|
||||
delete lib;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to retrieve nature by name", "library") {
|
||||
TEST_CASE("Able to retrieve nature by name") {
|
||||
auto lib = new NatureLibrary();
|
||||
lib->LoadNature("testNature"_cnc, new Nature(Statistic::PhysicalAttack, Statistic::Speed));
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "../../extern/catch.hpp"
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/Library/Species/SpeciesLibrary.hpp"
|
||||
|
||||
TEST_CASE("Able to build and destroy empty library", "library") {
|
||||
TEST_CASE("Able to build and destroy empty library") {
|
||||
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
||||
delete lib;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to build, destroy and insert library", "library") {
|
||||
TEST_CASE("Able to build, destroy and insert library") {
|
||||
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
||||
lib->Insert("foo"_cnc.GetHash(),
|
||||
new PkmnLib::Library::PokemonSpecies(
|
||||
@@ -21,7 +21,7 @@ TEST_CASE("Able to build, destroy and insert library", "library") {
|
||||
delete lib;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to insert and retrieve from library", "library") {
|
||||
TEST_CASE("Able to insert and retrieve from library") {
|
||||
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
||||
lib->Insert("foo"_cnc.GetHash(),
|
||||
new PkmnLib::Library::PokemonSpecies(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/Library/Species/PokemonSpecies.hpp"
|
||||
|
||||
TEST_CASE("Able to create and destroy species", "library") {
|
||||
TEST_CASE("Able to create and destroy species") {
|
||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||
1, "foo"_cnc,
|
||||
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
||||
@@ -13,7 +13,7 @@ TEST_CASE("Able to create and destroy species", "library") {
|
||||
delete species;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to get default forme", "library") {
|
||||
TEST_CASE("Able to get default forme") {
|
||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||
1, "foo"_cnc,
|
||||
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
||||
@@ -28,7 +28,7 @@ TEST_CASE("Able to get default forme", "library") {
|
||||
delete species;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to get default forme name", "library") {
|
||||
TEST_CASE("Able to get default forme name") {
|
||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||
1, "foo"_cnc,
|
||||
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
||||
@@ -44,7 +44,7 @@ TEST_CASE("Able to get default forme name", "library") {
|
||||
delete species;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to get species name", "library") {
|
||||
TEST_CASE("Able to get species name") {
|
||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||
1, "foo"_cnc,
|
||||
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
||||
@@ -58,7 +58,7 @@ TEST_CASE("Able to get species name", "library") {
|
||||
delete species;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to get species id", "library") {
|
||||
TEST_CASE("Able to get species id") {
|
||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||
1, "foo"_cnc,
|
||||
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
||||
@@ -72,7 +72,7 @@ TEST_CASE("Able to get species id", "library") {
|
||||
delete species;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to get species gender ratio", "library") {
|
||||
TEST_CASE("Able to get species gender ratio") {
|
||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||
1, "foo"_cnc,
|
||||
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
||||
@@ -86,7 +86,7 @@ TEST_CASE("Able to get species gender ratio", "library") {
|
||||
delete species;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to get species growth rate", "library") {
|
||||
TEST_CASE("Able to get species growth rate") {
|
||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||
1, "foo"_cnc,
|
||||
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
||||
@@ -100,7 +100,7 @@ TEST_CASE("Able to get species growth rate", "library") {
|
||||
delete species;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to get species capture rate", "library") {
|
||||
TEST_CASE("Able to get species capture rate") {
|
||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||
1, "foo"_cnc,
|
||||
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
||||
@@ -114,7 +114,7 @@ TEST_CASE("Able to get species capture rate", "library") {
|
||||
delete species;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to get species base happiness", "library") {
|
||||
TEST_CASE("Able to get species base happiness") {
|
||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||
1, "foo"_cnc,
|
||||
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
||||
@@ -128,7 +128,7 @@ TEST_CASE("Able to get species base happiness", "library") {
|
||||
delete species;
|
||||
}
|
||||
|
||||
TEST_CASE("Able to set and get evolution", "library") {
|
||||
TEST_CASE("Able to set and get evolution") {
|
||||
auto species = new PkmnLib::Library::PokemonSpecies(
|
||||
1, "foo"_cnc,
|
||||
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/Battling/Pokemon/CreatePokemon.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/Battling/Pokemon/CreatePokemon.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/Battling/Library/ExperienceLibrary.hpp"
|
||||
#include "../../src/Battling/Pokemon/CreatePokemon.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
using namespace PkmnLib::Battling;
|
||||
|
||||
TEST_CASE("Basic Experience gain test", "battling") {
|
||||
TEST_CASE("Basic Experience gain test") {
|
||||
auto lib = TestLibrary::GetLibrary();
|
||||
auto mon1 = CreatePokemon(lib, "testSpecies"_cnc, 55).Build();
|
||||
auto initialExp = mon1->GetExperience();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/Battling/Pokemon/CreatePokemon.hpp"
|
||||
#include "../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
@@ -277,7 +277,7 @@ TEST_CASE("Invoke ChangeEffectiveness script function") {
|
||||
REQUIRE(script != nullptr);
|
||||
float b = 0;
|
||||
script->ChangeEffectiveness(nullptr, nullptr, 0, &b);
|
||||
REQUIRE(b == Approx(0.75));
|
||||
REQUIRE(b == doctest::Approx(0.75));
|
||||
|
||||
delete script;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../extern/doctest.hpp"
|
||||
#include "../../../../src/Battling/Pokemon/CreatePokemon.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../extern/doctest.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../extern/doctest.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../extern/doctest.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
@@ -92,7 +92,7 @@ TEST_CASE("Validate Move Category in Script") {
|
||||
data.Context->SetArgDWord(1, (asDWORD)move->GetCategory());
|
||||
|
||||
auto result = data.Context->Execute();
|
||||
INFO("exception: " << data.Context->GetExceptionString())
|
||||
INFO("exception: " << data.Context->GetExceptionString());
|
||||
REQUIRE(result == asEXECUTION_FINISHED);
|
||||
REQUIRE((bool)data.Context->GetReturnByte());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../extern/doctest.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../extern/doctest.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user