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

Function testSingle

tests/attribute.cpp:85–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85void testSingle(int type) {
86 MakeDBAttribute(1, type, -100, 200, 100, 50, 0);
87 auto as0 = MakeAttributeSet({ true });
88 auto sets = MakeAttributeSetArray(&as0);
89
90 SUBCASE("0") {
91 SetDBActorAttribute(1, 1, 0);
92 const auto& target = MakeActor(1);
93
94 REQUIRE_EQ(Attribute::ApplyAttributeMultiplier(100, target, sets), -100);
95 }
96
97 SUBCASE("1") {
98 SetDBActorAttribute(1, 1, 1);
99 const auto& target = MakeActor(1);
100
101 REQUIRE_EQ(Attribute::ApplyAttributeMultiplier(100, target, sets), 200);
102 }
103
104 SUBCASE("2") {
105 SetDBActorAttribute(1, 1, 2);
106 const auto& target = MakeActor(1);
107
108 REQUIRE_EQ(Attribute::ApplyAttributeMultiplier(100, target, sets), 100);
109 }
110
111 SUBCASE("3") {
112 SetDBActorAttribute(1, 1, 3);
113 const auto& target = MakeActor(1);
114
115 REQUIRE_EQ(Attribute::ApplyAttributeMultiplier(100, target, sets), 50);
116 }
117
118 SUBCASE("4") {
119 SetDBActorAttribute(1, 1, 4);
120 const auto& target = MakeActor(1);
121
122 REQUIRE_EQ(Attribute::ApplyAttributeMultiplier(100, target, sets), 0);
123 }
124}
125
126TEST_CASE("ApplyMultiplerSingle") {
127 const MockActor m;

Callers 1

attribute.cppFile · 0.85

Calls 6

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

Tested by

no test coverage detected