#include #include #include #include "inventory.hpp" using namespace fmt; TEST_CASE("base test", "[inventory]") { inventory::Model inv; DinkyECS::Entity test_ent = 1; inv.add("hand_l", test_ent); inv.invariant(); auto& slot = inv.get(test_ent); REQUIRE(slot == "hand_l"); auto ent = inv.get(slot); REQUIRE(ent == test_ent); REQUIRE(inv.has(ent)); REQUIRE(inv.has(slot)); // test base remove inv.remove(slot, ent); REQUIRE(!inv.has(slot)); REQUIRE(!inv.has(ent)); // test remove just by slot inv.add("hand_r", test_ent); REQUIRE(inv.has("hand_r")); REQUIRE(inv.has(test_ent)); inv.invariant(); inv.remove("hand_r"); REQUIRE(!inv.has("hand_r")); REQUIRE(!inv.has(test_ent)); // test remove just by entity inv.add("pocket_l", test_ent); REQUIRE(inv.has("pocket_l")); REQUIRE(inv.has(test_ent)); inv.invariant(); inv.remove(test_ent); REQUIRE(!inv.has("pocket_l")); REQUIRE(!inv.has(test_ent)); }