Compare commits
No commits in common. "698aed88604203b1dc554d191509655c5d74ae2c" and "62f283be0bac6b73d9f761176c2b3245e02720fb" have entirely different histories.
698aed8860
...
62f283be0b
2 changed files with 10 additions and 9 deletions
|
|
@ -112,7 +112,7 @@ TEST_CASE("[D] Deserialize full BillyObjects", "[deserialize][1]") {
|
||||||
REQUIRE(std::get<equipments>(dummy_object.objects.at(equipments::MedicKit)->get_type()) == equipments::MedicKit);
|
REQUIRE(std::get<equipments>(dummy_object.objects.at(equipments::MedicKit)->get_type()) == equipments::MedicKit);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("[E] Pushing popping BillyObjects", "[pushpop][0]") {
|
TEST_CASE("[D] Pushing popping BillyObjects", "[pushpop][0]") {
|
||||||
constexpr std::array<billyEnums, 12> all_objects{
|
constexpr std::array<billyEnums, 12> all_objects{
|
||||||
weapons::Sword,
|
weapons::Sword,
|
||||||
weapons::Lance,
|
weapons::Lance,
|
||||||
|
|
@ -153,7 +153,7 @@ TEST_CASE("[E] Pushing popping BillyObjects", "[pushpop][0]") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("[E] Double erase no throw", "[pushpop][1]") {
|
TEST_CASE("[D] Double erase no throw", "[pushpop][1]") {
|
||||||
BillyObjects gestionnaire{};
|
BillyObjects gestionnaire{};
|
||||||
CharacterSheet sheet;
|
CharacterSheet sheet;
|
||||||
REQUIRE(sheet.get_objects().empty());
|
REQUIRE(sheet.get_objects().empty());
|
||||||
|
|
@ -165,7 +165,7 @@ TEST_CASE("[E] Double erase no throw", "[pushpop][1]") {
|
||||||
REQUIRE_FALSE(gestionnaire.erase_object(sheet, weapons::Bow));
|
REQUIRE_FALSE(gestionnaire.erase_object(sheet, weapons::Bow));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("[E] Insert no more than 3", "[pushpop][2]") {
|
TEST_CASE("[D] Insert no more than 3", "[pushpop][2]") {
|
||||||
BillyObjects gestionnaire{};
|
BillyObjects gestionnaire{};
|
||||||
CharacterSheet sheet;
|
CharacterSheet sheet;
|
||||||
REQUIRE(sheet.get_objects().empty());
|
REQUIRE(sheet.get_objects().empty());
|
||||||
|
|
@ -178,7 +178,7 @@ TEST_CASE("[E] Insert no more than 3", "[pushpop][2]") {
|
||||||
REQUIRE(sheet.get_objects().size() == 3);
|
REQUIRE(sheet.get_objects().size() == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("[F] Printing Billy's objects", "[printing]") {
|
TEST_CASE("[D] Printing Billy's objects", "[printing]") {
|
||||||
for (const auto &object: BillyObjects::all_objects) {
|
for (const auto &object: BillyObjects::all_objects) {
|
||||||
const std::unique_ptr<GenericObject> obj = test::get_obj(object);
|
const std::unique_ptr<GenericObject> obj = test::get_obj(object);
|
||||||
REQUIRE_NOTHROW(BillyObjects::billy_object_to_string(obj));
|
REQUIRE_NOTHROW(BillyObjects::billy_object_to_string(obj));
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ namespace character {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace character::characteristic {
|
namespace character::characteristic {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Different characteristic type
|
* \brief Different characteristic type
|
||||||
*/
|
*/
|
||||||
|
|
@ -40,7 +41,7 @@ namespace character::characteristic {
|
||||||
std::uint32_t carac{ 0 };
|
std::uint32_t carac{ 0 };
|
||||||
|
|
||||||
//! Value changed from a billyObjects (billyEnums) possessed
|
//! Value changed from a billyObjects (billyEnums) possessed
|
||||||
std::int32_t materiel{ 0 };
|
std::uint32_t materiel{ 0 };
|
||||||
|
|
||||||
//! Additional value when creating the character
|
//! Additional value when creating the character
|
||||||
std::uint32_t additional{ 0 };
|
std::uint32_t additional{ 0 };
|
||||||
|
|
@ -69,7 +70,7 @@ namespace character::characteristic {
|
||||||
|
|
||||||
constexpr Characteristic(const characType inType,
|
constexpr Characteristic(const characType inType,
|
||||||
const std::uint32_t carac,
|
const std::uint32_t carac,
|
||||||
const std::int32_t materiel,
|
const std::uint32_t materiel,
|
||||||
const std::uint32_t additional) :
|
const std::uint32_t additional) :
|
||||||
base(get_base(inType)),
|
base(get_base(inType)),
|
||||||
carac(carac),
|
carac(carac),
|
||||||
|
|
@ -97,11 +98,11 @@ namespace character::characteristic {
|
||||||
|
|
||||||
[[nodiscard]] std::uint32_t get_carac() const { return carac; }
|
[[nodiscard]] std::uint32_t get_carac() const { return carac; }
|
||||||
|
|
||||||
[[nodiscard]] std::int32_t get_materiel() const { return materiel; }
|
[[nodiscard]] std::uint32_t get_materiel() const { return materiel; }
|
||||||
|
|
||||||
[[nodiscard]] std::uint32_t get_additional() const { return additional; }
|
[[nodiscard]] std::uint32_t get_additional() const { return additional; }
|
||||||
|
|
||||||
[[nodiscard]] std::int32_t get_total() const noexcept {
|
[[nodiscard]] std::size_t get_total() const noexcept {
|
||||||
if (total == defaultValue::max()) {
|
if (total == defaultValue::max()) {
|
||||||
total = static_cast<std::int32_t>(base + carac + materiel + additional);
|
total = static_cast<std::int32_t>(base + carac + materiel + additional);
|
||||||
total = std::max(total, 0);
|
total = std::max(total, 0);
|
||||||
|
|
@ -113,7 +114,7 @@ namespace character::characteristic {
|
||||||
const_cast<std::uint32_t &>(charac.base) = j.at("base").get<std::uint32_t>();
|
const_cast<std::uint32_t &>(charac.base) = j.at("base").get<std::uint32_t>();
|
||||||
const_cast<characType &>(charac.type) = static_cast<characType>(j.at("type").get<std::uint8_t>());
|
const_cast<characType &>(charac.type) = static_cast<characType>(j.at("type").get<std::uint8_t>());
|
||||||
charac.carac = j.at("carac").get<std::uint32_t>();
|
charac.carac = j.at("carac").get<std::uint32_t>();
|
||||||
charac.materiel = j.at("materiel").get<std::int32_t>();
|
charac.materiel = j.at("materiel").get<std::uint32_t>();
|
||||||
charac.additional = j.at("additional").get<std::uint32_t>();
|
charac.additional = j.at("additional").get<std::uint32_t>();
|
||||||
charac.total = j.at("total").get<std::int32_t>();
|
charac.total = j.at("total").get<std::int32_t>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue