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

Function testChar

tests/game_character_move.cpp:15–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13TEST_SUITE_BEGIN("Game_Character_Move");
14
15static void testChar(
16 const Game_Character& ch,
17 int x, int y,
18 int dir, int face,
19 int remaining_step,
20 bool is_jumping,
21 int begin_jump_x, int begin_jump_y,
22 int frequency, int speed,
23 int stop_count, int max_stop_count)
24{
25 CAPTURE(x);
26 CAPTURE(y);
27 CAPTURE(dir);
28 CAPTURE(face);
29 CAPTURE(remaining_step);
30 CAPTURE(is_jumping);
31 CAPTURE(begin_jump_x);
32 CAPTURE(begin_jump_y);
33 CAPTURE(frequency);
34 CAPTURE(speed);
35 CAPTURE(stop_count);
36 CAPTURE(max_stop_count);
37
38 REQUIRE_EQ(ch.GetX(), x);
39 REQUIRE_EQ(ch.GetY(), y);
40 REQUIRE_EQ(ch.GetDirection(), dir);
41 REQUIRE_EQ(ch.GetFacing(), face);
42 REQUIRE_EQ(ch.GetRemainingStep(), remaining_step);
43 REQUIRE_EQ(ch.IsJumping(), is_jumping);
44 REQUIRE_EQ(ch.GetBeginJumpX(), begin_jump_x);
45 REQUIRE_EQ(ch.GetBeginJumpY(), begin_jump_y);
46 REQUIRE_EQ(ch.GetRemainingStep(), remaining_step);
47 REQUIRE_EQ(ch.GetMoveFrequency(), frequency);
48 REQUIRE_EQ(ch.GetMoveSpeed(), speed);
49 REQUIRE_EQ(ch.GetStopCount(), stop_count);
50 REQUIRE_EQ(ch.GetMaxStopCount(), max_stop_count);
51 REQUIRE_EQ(ch.GetMoveRouteIndex(), 0);
52 REQUIRE_EQ(ch.IsMoveRouteOverwritten(), false);
53 REQUIRE_EQ(ch.IsMoveRouteFinished(), false);
54 REQUIRE_EQ(ch.GetMoveRoute(), lcf::rpg::MoveRoute());
55
56 REQUIRE_EQ(ch.IsStopCountActive(), stop_count < max_stop_count);
57
58 if (remaining_step > 0) {
59 REQUIRE(!ch.IsStopping());
60 REQUIRE_EQ(ch.IsJumping(), is_jumping);
61 REQUIRE_EQ(ch.IsMoving(), !is_jumping);
62 } else {
63 REQUIRE(ch.IsStopping());
64 REQUIRE(!ch.IsJumping());
65 REQUIRE(!ch.IsMoving());
66 }
67}
68
69template <bool success>
70static void testMove(int move_dir, int x, int y, int dir, int face,

Callers 2

testMoveFunction · 0.70
testJumpFunction · 0.70

Calls 15

GetFacingMethod · 0.80
GetRemainingStepMethod · 0.80
IsJumpingMethod · 0.80
GetBeginJumpXMethod · 0.80
GetBeginJumpYMethod · 0.80
GetMoveFrequencyMethod · 0.80
GetMoveSpeedMethod · 0.80
GetStopCountMethod · 0.80
GetMaxStopCountMethod · 0.80
GetMoveRouteIndexMethod · 0.80
IsMoveRouteFinishedMethod · 0.80

Tested by

no test coverage detected