From 71e5faf13960534b8ea9f2f94f7741616a65cb89 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Wed, 30 Oct 2024 09:57:09 +0100 Subject: [PATCH] Correct tests now --- Unit testing/characteristics_tests.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Unit testing/characteristics_tests.cpp b/Unit testing/characteristics_tests.cpp index 0cbc84e..c96d713 100644 --- a/Unit testing/characteristics_tests.cpp +++ b/Unit testing/characteristics_tests.cpp @@ -1,14 +1,12 @@ #include -#include "characteristic/adresse.hpp" -#include "characteristic/chance.hpp" -#include "characteristic/endurance.hpp" -#include "characteristic/habilete.hpp" +#include "characteristic/characteristic.hpp" +#include "character_sheet.hpp" #include using namespace character::characteristic; TEST_CASE("[A] Serialize adresse", "[serialize][0]") { - Adresse adresse; + Characteristic adresse{ characType::Adresse }; json serializer; REQUIRE_NOTHROW(serializer.emplace("adresse", adresse)); @@ -27,7 +25,7 @@ TEST_CASE("[A] Serialize adresse", "[serialize][0]") { } TEST_CASE("[A] Serialize chance", "[serialize][1]") { - Chance chance; + Characteristic chance{ characType::Chance }; json serializer; REQUIRE_NOTHROW(serializer.emplace("chance", chance)); @@ -46,7 +44,7 @@ TEST_CASE("[A] Serialize chance", "[serialize][1]") { } TEST_CASE("[A] Serialize endurance", "[serialize][2]") { - Endurance endurance; + Characteristic endurance{ characType::Endurance }; json serializer; REQUIRE_NOTHROW(serializer.emplace("endurance", endurance)); @@ -65,7 +63,7 @@ TEST_CASE("[A] Serialize endurance", "[serialize][2]") { } TEST_CASE("[A] Serialize habilete", "[serialize][3]") { - Habilete habilete; + Characteristic habilete{ characType::Habilete }; json serializer; REQUIRE_NOTHROW(serializer.emplace("habilete", habilete)); @@ -90,7 +88,7 @@ TEST_CASE("[B] Deserialize adresse", "[deserialize][0]") { return des; }(); REQUIRE_NOTHROW([&]() -> void { - const auto adresse = deserializer.at("adresse").get(); + const auto adresse = deserializer.at("adresse").get(); REQUIRE(adresse.get_base() == 1); REQUIRE(adresse.get_carac() == 0); REQUIRE(adresse.get_materiel() == 0); @@ -105,7 +103,7 @@ TEST_CASE("[B] Deserialize chance", "[deserialize][1]") { return des; }(); REQUIRE_NOTHROW([&]() -> void { - const auto adresse = deserializer.at("chance").get(); + const auto adresse = deserializer.at("chance").get(); REQUIRE(adresse.get_base() == 3); REQUIRE(adresse.get_carac() == 0); REQUIRE(adresse.get_materiel() == 0); @@ -120,7 +118,7 @@ TEST_CASE("[B] Deserialize endurance", "[deserialize][2]") { return des; }(); REQUIRE_NOTHROW([&]() -> void { - const auto adresse = deserializer.at("endurance").get(); + const auto adresse = deserializer.at("endurance").get(); REQUIRE(adresse.get_base() == 2); REQUIRE(adresse.get_carac() == 0); REQUIRE(adresse.get_materiel() == 0); @@ -135,7 +133,7 @@ TEST_CASE("[B] Deserialize habilete", "[deserialize][3]") { return des; }(); REQUIRE_NOTHROW([&]() -> void { - const auto adresse = deserializer.at("habilete").get(); + const auto adresse = deserializer.at("habilete").get(); REQUIRE(adresse.get_base() == 2); REQUIRE(adresse.get_carac() == 0); REQUIRE(adresse.get_materiel() == 0);