Tests for serializer, valid.
TODO: CI
This commit is contained in:
parent
a5ce3c378f
commit
0dc0329770
@ -1,17 +1,63 @@
|
||||
#include <catch2/catch.hpp>
|
||||
#include "characteristic/adresse.hpp"
|
||||
#include "characteristic/chance.hpp"
|
||||
#include "characteristic/endurance.hpp"
|
||||
#include "characteristic/habilete.hpp"
|
||||
|
||||
using namespace character::characteristic;
|
||||
|
||||
TEST_CASE("Serialize adresse", "[serialize][0]") {
|
||||
Adresse adresse;
|
||||
json serializer;
|
||||
|
||||
REQUIRE_NOTHROW(serializer.emplace("adresse", adresse));
|
||||
|
||||
const auto &tester = serializer.at("adresse");
|
||||
|
||||
REQUIRE_NOTHROW(tester.at("base") == 1);
|
||||
REQUIRE_NOTHROW(tester.at("carac") == 0);
|
||||
REQUIRE_NOTHROW(tester.at("materiel") == 0);
|
||||
REQUIRE_NOTHROW(tester.at("additional") == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Serialize chance", "[serialize][1]") {
|
||||
Chance chance;
|
||||
json serializer;
|
||||
|
||||
REQUIRE_NOTHROW(serializer.emplace("chance", chance));
|
||||
|
||||
const auto &tester = serializer.at("chance");
|
||||
|
||||
REQUIRE_NOTHROW(tester.at("base") == 3);
|
||||
REQUIRE_NOTHROW(tester.at("carac") == 0);
|
||||
REQUIRE_NOTHROW(tester.at("materiel") == 0);
|
||||
REQUIRE_NOTHROW(tester.at("additional") == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Serialize endurance", "[serialize][2]") {
|
||||
Endurance endurance;
|
||||
json serializer;
|
||||
|
||||
REQUIRE_NOTHROW(serializer.emplace("endurance", endurance));
|
||||
|
||||
const auto &tester = serializer.at("endurance");
|
||||
|
||||
REQUIRE_NOTHROW(tester.at("base") == 2);
|
||||
REQUIRE_NOTHROW(tester.at("carac") == 0);
|
||||
REQUIRE_NOTHROW(tester.at("materiel") == 0);
|
||||
REQUIRE_NOTHROW(tester.at("additional") == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Serialize habilete", "[serialize][3]") {
|
||||
Habilete habilete;
|
||||
json serializer;
|
||||
|
||||
REQUIRE_NOTHROW(serializer.emplace("habilete", habilete));
|
||||
|
||||
const auto &tester = serializer.at("habilete");
|
||||
|
||||
REQUIRE_NOTHROW(tester.at("base") == 2);
|
||||
REQUIRE_NOTHROW(tester.at("carac") == 0);
|
||||
REQUIRE_NOTHROW(tester.at("materiel") == 0);
|
||||
REQUIRE_NOTHROW(tester.at("additional") == 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user