MCPcopy Create free account
hub / github.com/EasyRPG/Player / testWeapon2

Function testWeapon2

tests/game_actor.cpp:395–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395static void testWeapon2(Game_Actor* a, int id1, int id2, int id3, int id4, int id5) {
396 CAPTURE(a->GetId());
397 CAPTURE(a->HasTwoWeapons());
398 CAPTURE(id1);
399 CAPTURE(id2);
400 CAPTURE(id3);
401 CAPTURE(id4);
402 CAPTURE(id5);
403
404 auto* i1 = id1 ? &lcf::Data::items[id1 - 1] : nullptr;
405 auto* i2 = id2 ? &lcf::Data::items[id2 - 1] : nullptr;
406 auto* i3 = id3 ? &lcf::Data::items[id3 - 1] : nullptr;
407 auto* i4 = id4 ? &lcf::Data::items[id4 - 1] : nullptr;
408 auto* i5 = id5 ? &lcf::Data::items[id5 - 1] : nullptr;
409
410 a->SetEquipment(1, id1);
411 a->SetEquipment(2, id2);
412 a->SetEquipment(3, id3);
413 a->SetEquipment(4, id4);
414 a->SetEquipment(5, id5);
415
416 REQUIRE_EQ(a->GetWeaponId(), id1);
417 REQUIRE_EQ(a->GetShieldId(), id2);
418 REQUIRE_EQ(a->GetArmorId(), id3);
419 REQUIRE_EQ(a->GetHelmetId(), id4);
420 REQUIRE_EQ(a->GetAccessoryId(), id5);
421
422 testWeapon3(a, i1, i2, i3, i4, i5, Game_Battler::WeaponAll);
423 testWeapon3(a, i1, i2, i3, i4, i5, Game_Battler::WeaponNone);
424 testWeapon3(a, i1, i2, i3, i4, i5, Game_Battler::WeaponPrimary);
425 testWeapon3(a, i1, i2, i3, i4, i5, Game_Battler::WeaponSecondary);
426}
427
428static void testWeapon(Game_Actor* a, int id1, int id2, int armor = 0, int helmet = 0, int acc = 0) {
429 testWeapon2(a, id1, id2, armor, helmet, acc);

Callers 1

testWeaponFunction · 0.85

Calls 9

testWeapon3Function · 0.85
HasTwoWeaponsMethod · 0.80
SetEquipmentMethod · 0.80
GetWeaponIdMethod · 0.80
GetShieldIdMethod · 0.80
GetArmorIdMethod · 0.80
GetHelmetIdMethod · 0.80
GetAccessoryIdMethod · 0.80
GetIdMethod · 0.45

Tested by

no test coverage detected