Another items read/write test

This commit is contained in:
2015-09-15 12:34:07 -04:00
parent a778d25cdc
commit 2a609adf04
3 changed files with 107 additions and 0 deletions

View File

@@ -57,4 +57,50 @@ TEST_CASE("Saving item types") {
CHECK(scen.scen_items[0].name == "Potion");
CHECK(scen.scen_items[0].full_name == "Test Potion");
}
SECTION("With all information") {
scen.scen_items[0].awkward = 1;
scen.scen_items[0].bonus = 5;
scen.scen_items[0].protection = 4;
scen.scen_items[0].charges = 20;
// So that both weap_type and missile are saved \/
scen.scen_items[0].variety = eItemType::MISSILE_NO_AMMO;
scen.scen_items[0].weap_type = eSkill::DEFENSE;
scen.scen_items[0].missile = 3;
scen.scen_items[0].type_flag = 9;
scen.scen_items[0].special_class = 400;
scen.scen_items[0].treas_class = 2;
scen.scen_items[0].ability = eItemAbil::POISON_AUGMENT;
scen.scen_items[0].abil_data[0] = 6;
scen.scen_items[0].abil_data[1] = 42;
scen.scen_items[0].magic_use_type = eItemUse::HARM_ONE;
scen.scen_items[0].ident = true;
scen.scen_items[0].magic = true;
scen.scen_items[0].cursed = true;
scen.scen_items[0].concealed = true;
scen.scen_items[0].enchanted = true;
scen.scen_items[0].unsellable = true;
scen.scen_items[0].desc = " This is a silly, silly description. ";
in_and_out("full", scen);
REQUIRE(scen.scen_items.size() == 1);
CHECK(scen.scen_items[0].awkward == 1);
CHECK(scen.scen_items[0].bonus == 5);
CHECK(scen.scen_items[0].protection == 4);
CHECK(scen.scen_items[0].charges == 20);
CHECK(scen.scen_items[0].weap_type == eSkill::DEFENSE);
CHECK(scen.scen_items[0].missile == 3);
CHECK(scen.scen_items[0].type_flag == 9);
CHECK(scen.scen_items[0].special_class == 400);
CHECK(scen.scen_items[0].treas_class == 2);
CHECK(scen.scen_items[0].ability == eItemAbil::POISON_AUGMENT);
CHECK(scen.scen_items[0].abil_data[0] == 6);
CHECK(scen.scen_items[0].abil_data[1] == 42);
CHECK(scen.scen_items[0].magic_use_type == eItemUse::HARM_ONE);
CHECK(scen.scen_items[0].ident);
CHECK(scen.scen_items[0].magic);
CHECK(scen.scen_items[0].cursed);
CHECK(scen.scen_items[0].concealed);
CHECK(scen.scen_items[0].enchanted);
CHECK(scen.scen_items[0].unsellable);
CHECK(scen.scen_items[0].desc == " This is a silly, silly description. ");
}
}