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

Function testMaxMulti

tests/attribute.cpp:138–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138void testMaxMulti(int type) {
139 for (int i = 0; i < 5; ++i) {
140 MakeDBAttribute(i + 1, type, -100, 200, 100, 50, 0);
141 }
142
143
144 SUBCASE("all") {
145 SetDBActorAttribute(1, 1, 0);
146 SetDBActorAttribute(1, 2, 1);
147 SetDBActorAttribute(1, 3, 2);
148 SetDBActorAttribute(1, 4, 3);
149 SetDBActorAttribute(1, 5, 4);
150
151 auto as0 = MakeAttributeSet({ true, true, true, true, true });
152 auto sets = MakeAttributeSetArray(&as0);
153 const auto& target = MakeActor(1);
154
155 REQUIRE_EQ(Attribute::ApplyAttributeMultiplier(100, target, sets), 200);
156 }
157
158 SUBCASE("0") {
159 SetDBActorAttribute(1, 1, 0);
160 SetDBActorAttribute(1, 2, 4);
161
162 auto as0 = MakeAttributeSet({ true, true });
163 auto sets = MakeAttributeSetArray(&as0);
164 const auto& target = MakeActor(1);
165
166 REQUIRE_EQ(Attribute::ApplyAttributeMultiplier(100, target, sets), 0);
167 }
168
169 SUBCASE("neg") {
170 SetDBActorAttribute(1, 3, 0);
171
172 auto as0 = MakeAttributeSet({ false, false, true });
173 auto sets = MakeAttributeSetArray(&as0);
174 const auto& target = MakeActor(1);
175
176 REQUIRE_EQ(Attribute::ApplyAttributeMultiplier(100, target, sets), -100);
177 }
178}
179
180TEST_CASE("ApplyMultiplerMaxMulti") {
181 const MockActor m;

Callers 1

attribute.cppFile · 0.85

Calls 6

MakeDBAttributeFunction · 0.85
SetDBActorAttributeFunction · 0.85
MakeAttributeSetFunction · 0.85
MakeAttributeSetArrayFunction · 0.85
ApplyAttributeMultiplierFunction · 0.85
MakeActorFunction · 0.70

Tested by

no test coverage detected