Correct tests now
This commit is contained in:
parent
7e613ca2a0
commit
71e5faf139
@ -1,14 +1,12 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
#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 <fstream>
|
||||
|
||||
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<Adresse>();
|
||||
const auto adresse = deserializer.at("adresse").get<Characteristic>();
|
||||
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<Adresse>();
|
||||
const auto adresse = deserializer.at("chance").get<Characteristic>();
|
||||
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<Adresse>();
|
||||
const auto adresse = deserializer.at("endurance").get<Characteristic>();
|
||||
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<Adresse>();
|
||||
const auto adresse = deserializer.at("habilete").get<Characteristic>();
|
||||
REQUIRE(adresse.get_base() == 2);
|
||||
REQUIRE(adresse.get_carac() == 0);
|
||||
REQUIRE(adresse.get_materiel() == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user