MCPcopy Create free account
hub / github.com/Fields2Cover/Fields2Cover / TEST

Function TEST

tests/cpp/types/Robot_test.cpp:14–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13
14TEST(fields2cover_types_robot, init) {
15 F2CRobot robot_def_const(1., 2.);
16 EXPECT_NEAR(robot_def_const.getWidth(), 1., 1e-5);
17 EXPECT_NEAR(robot_def_const.getCovWidth(), 2., 1e-5);
18
19 F2CRobot robot;
20 robot.setName("robot test");
21 EXPECT_EQ(robot.getName(), "robot test");
22 robot.setWidth(5.0);
23 EXPECT_NEAR(robot.getWidth(), 5.0, 1e-5);
24 robot.setCovWidth(10.0);
25 EXPECT_NEAR(robot.getCovWidth(), 10., 1e-5);
26
27 robot.setMinTurningRadius(10.0);
28 EXPECT_NEAR(robot.getMaxCurv(), 0.1, 1e-5);
29 EXPECT_NEAR(robot.getMinTurningRadius(), 10., 1e-5);
30
31 robot.setMaxCurv(0.4);
32 EXPECT_NEAR(robot.getMaxCurv(), 0.4, 1e-5);
33 EXPECT_NEAR(robot.getMinTurningRadius(), 2.5, 1e-5);
34 robot.setMaxDiffCurv(0.3);
35 EXPECT_NEAR(robot.getMaxDiffCurv(), 0.3, 1e-5);
36
37 robot.setCruiseVel(2.0);
38 EXPECT_NEAR(robot.getCruiseVel(), 2.0, 1e-5);
39 EXPECT_NEAR(robot.getTurnVel(), 2.0, 1e-5);
40 robot.setTurnVel(5.0);
41 EXPECT_NEAR(robot.getTurnVel(), 5.0, 1e-5);
42
43
44 EXPECT_THROW(F2CRobot(0), std::out_of_range);
45 EXPECT_THROW(F2CRobot(-3), std::out_of_range);
46
47 F2CRobot r1 = robot;
48 EXPECT_NEAR(r1.getWidth(), 5.0, 1e-5);
49
50 const F2CRobot r2 {robot};
51 EXPECT_EQ(r2.getWidth(), 5.0);
52}
53
54

Callers

nothing calls this directly

Calls 15

getCovWidthMethod · 0.80
setCovWidthMethod · 0.80
setMinTurningRadiusMethod · 0.80
getMaxCurvMethod · 0.80
getMinTurningRadiusMethod · 0.80
setMaxCurvMethod · 0.80
setMaxDiffCurvMethod · 0.80
getMaxDiffCurvMethod · 0.80
setCruiseVelMethod · 0.80
getCruiseVelMethod · 0.80
getTurnVelMethod · 0.80
setTurnVelMethod · 0.80

Tested by

no test coverage detected