Switch unit test library from Catch2 to DocTest.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/Library/BaseLibrary.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
using namespace CreatureLib::Library;
|
||||
TEST_CASE("Iterate over library", "[Library]") {
|
||||
TEST_CASE("Iterate over library") {
|
||||
auto& lib = TestLibrary::Get()->GetSpeciesLibrary();
|
||||
auto i = 0;
|
||||
for (auto b : *lib) {
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/Library/EffectParameter.hpp"
|
||||
|
||||
using namespace CreatureLib::Library;
|
||||
TEST_CASE("Bool EffectParameter", "[Library]") {
|
||||
TEST_CASE("Bool EffectParameter") {
|
||||
auto p = EffectParameter(true);
|
||||
REQUIRE(p.AsBool());
|
||||
auto p2 = EffectParameter(false);
|
||||
REQUIRE_FALSE(p2.AsBool());
|
||||
}
|
||||
|
||||
TEST_CASE("Int EffectParameter", "[Library]") {
|
||||
TEST_CASE("Int EffectParameter") {
|
||||
auto p = EffectParameter((int64_t)684);
|
||||
REQUIRE(p.AsInt() == 684);
|
||||
REQUIRE(p.AsFloat() == 684);
|
||||
}
|
||||
|
||||
TEST_CASE("String EffectParameter", "[Library]") {
|
||||
TEST_CASE("String EffectParameter") {
|
||||
auto p = EffectParameter((ArbUt::StringView) "foobar"_cnc);
|
||||
REQUIRE(p.AsString() == "foobar");
|
||||
}
|
||||
|
||||
TEST_CASE("Float EffectParameter", "[Library]") {
|
||||
TEST_CASE("Float EffectParameter") {
|
||||
auto p = EffectParameter(1.5f);
|
||||
REQUIRE(p.AsFloat() == Approx(1.5f));
|
||||
REQUIRE(p.AsFloat() == doctest::Approx(1.5f));
|
||||
REQUIRE(p.AsInt() == 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifdef TESTS_BUILD
|
||||
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../../src/Library/CreatureData/CreatureSpecies.hpp"
|
||||
|
||||
using namespace CreatureLib::Library;
|
||||
|
||||
TEST_CASE("Set Variant", "[Library]") {
|
||||
TEST_CASE("Set Variant") {
|
||||
auto defaultVariant = new SpeciesVariant("default", 0, 0, 0, {0, 1}, StatisticSet<uint16_t>(), {}, {}, nullptr);
|
||||
auto c = CreatureSpecies(0, "foo", defaultVariant, 0, "", 0);
|
||||
auto secondVariant = new SpeciesVariant("second", 0, 0, 0, {0, 1}, StatisticSet<uint16_t>(), {}, {}, nullptr);
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
TEST_CASE("Can Create Species Library", "[Library]") {
|
||||
TEST_CASE("Can Create Species Library") {
|
||||
auto l = TestLibrary::BuildSpeciesLibrary();
|
||||
REQUIRE(l != nullptr);
|
||||
delete l;
|
||||
}
|
||||
|
||||
TEST_CASE("Can Create Attack Library", "[Library]") {
|
||||
TEST_CASE("Can Create Attack Library") {
|
||||
auto l = TestLibrary::BuildAttackLibrary();
|
||||
REQUIRE(l != nullptr);
|
||||
delete l;
|
||||
}
|
||||
|
||||
TEST_CASE("Can Create Item Library", "[Library]") {
|
||||
TEST_CASE("Can Create Item Library") {
|
||||
auto l = TestLibrary::BuildItemLibrary();
|
||||
REQUIRE(l != nullptr);
|
||||
delete l;
|
||||
}
|
||||
|
||||
TEST_CASE("Can Create Growth Rate Library", "[Library]") {
|
||||
TEST_CASE("Can Create Growth Rate Library") {
|
||||
auto l = TestLibrary::BuildGrowthRateLibrary();
|
||||
REQUIRE(l != nullptr);
|
||||
delete l;
|
||||
}
|
||||
|
||||
TEST_CASE("Can Create Data Library", "[Library]") {
|
||||
TEST_CASE("Can Create Data Library") {
|
||||
auto l = TestLibrary::Get();
|
||||
REQUIRE(l != nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user