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

Function testStop

tests/game_character_move.cpp:280–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280static void testStop(bool success, bool jump, int x, int y) {
281 const MockGame mg(MockMap::ePassBlock20x15);
282
283 auto& ch = *MockGame::GetEvent(1);
284 ch.SetX(x);
285 ch.SetY(y);
286 ch.SetStopCount(99);
287 ch.SetMaxStopCount(200);
288
289 if (jump) {
290 REQUIRE_EQ(ch.Jump(x + 1, y + 1), success);
291 } else {
292 REQUIRE_EQ(ch.Move(Up), success);
293 }
294
295 REQUIRE_EQ(ch.GetStopCount(), 99);
296 REQUIRE_EQ(ch.GetMaxStopCount(), 200);
297}
298
299TEST_CASE("StopCountMove") { testStop(true, false, 4, 4); }
300TEST_CASE("StopCountMoveFail") { testStop(false, false, 16, 16); }

Callers 1

Calls 8

SetStopCountMethod · 0.80
SetMaxStopCountMethod · 0.80
JumpMethod · 0.80
GetStopCountMethod · 0.80
GetMaxStopCountMethod · 0.80
SetXMethod · 0.45
SetYMethod · 0.45
MoveMethod · 0.45

Tested by

no test coverage detected