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

Function testLimits

tests/game_actor.cpp:111–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111static void testLimits(int hp, int base, int battle) {
112 SUBCASE("limit values") {
113 auto actor = MakeActor(1, 1, 99, 1, 1, 1, 1, 1, 1);
114
115 REQUIRE_EQ(actor.MaxHpValue(), hp);
116 REQUIRE_EQ(actor.MaxStatBaseValue(), base);
117 REQUIRE_EQ(actor.MaxStatBattleValue(), battle);
118 }
119
120 SUBCASE("base limits") {
121 auto actor = MakeActor(1, 1, 99, hp, base, base, base, base, base);
122
123 testBaseLimits(actor, hp, base, base);
124 testModBaseLimits(actor, 0, 0);
125
126 SUBCASE("weapon up") {
127 MakeDBEquip(1, lcf::rpg::Item::Type_weapon, base, base, base, base);
128 actor.SetEquipment(1, 1);
129 testBaseLimits(actor, hp, base, base);
130 testModBaseLimits(actor, 0, 0);
131 }
132
133 SUBCASE("weapon down") {
134 MakeDBEquip(1, lcf::rpg::Item::Type_weapon, -base, -base, -base, -base);
135 actor.SetEquipment(1, 1);
136 testBaseLimits(actor, hp, base, 1);
137 testModBaseLimits(actor, 0, 0);
138 }
139
140 SUBCASE("mod up") {
141 actor.SetBaseMaxHp(999999);
142 actor.SetBaseMaxSp(999999);
143 actor.SetBaseAtk(999999);
144 actor.SetBaseDef(999999);
145 actor.SetBaseSpi(999999);
146 actor.SetBaseAgi(999999);
147
148 testBaseLimits(actor, hp, base, base);
149 testModBaseLimits(actor, hp, base);
150 }
151
152 SUBCASE("mod down") {
153 actor.SetBaseMaxHp(-999999);
154 actor.SetBaseMaxSp(-999999);
155 actor.SetBaseAtk(-999999);
156 actor.SetBaseDef(-999999);
157 actor.SetBaseSpi(-999999);
158 actor.SetBaseAgi(-999999);
159
160 testBaseLimits(actor, 1, 0, 1);
161 testModBaseLimits(actor, -hp, -base);
162 }
163 }
164
165 SUBCASE("battle limits") {
166 auto actor = MakeActor(1, 1, 99, 1, 1, 1, 1, 1, 1);
167
168 SUBCASE("up") {

Callers 1

game_actor.cppFile · 0.70

Calls 15

testBaseLimitsFunction · 0.85
testModBaseLimitsFunction · 0.85
MakeDBEquipFunction · 0.85
SetEquipmentMethod · 0.80
SetBaseMaxHpMethod · 0.80
SetBaseMaxSpMethod · 0.80
SetBaseAtkMethod · 0.80
SetBaseDefMethod · 0.80
SetBaseSpiMethod · 0.80
SetBaseAgiMethod · 0.80
SetAtkModifierMethod · 0.80
SetDefModifierMethod · 0.80

Tested by

no test coverage detected