#include #include #include using namespace character; TEST_CASE("[E] Serialize sheet", "[serialize][0]") { CharacterSheet sheet; BillyObjects gestion{}; REQUIRE(gestion.insert_object(sheet, weapons::Sword)); REQUIRE(gestion.insert_object(sheet, weapons::Lance)); REQUIRE(gestion.insert_object(sheet, tools::Dagger)); BillyObjects::check_dagger_conditions(sheet); BillyObjects::json serializer; REQUIRE_NOTHROW(serializer["character_sheet"] = sheet); { std::ofstream file{ "character_sheet.json" }; file << serializer << std::flush; } } TEST_CASE("[F] Deserialize sheet", "[deserialize][0]") { const auto deserializer = []() { std::ifstream file{ "character_sheet.json" }; return json::parse(file); }(); const auto sheet = deserializer.at("character_sheet").get(); }