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

Function TEST

tests/cpp/route_planning/route_planner_base_test.cpp:14–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12#include "fields2cover.h"
13
14TEST(fields2cover_rp_route_plan_base, simple_example) {
15 f2c::Random rand(4);
16 F2CCells cells {
17 F2CCell(F2CLinearRing({
18 F2CPoint(0,0), F2CPoint(2,0),F2CPoint(2,2),F2CPoint(0,2), F2CPoint(0,0)
19 }))
20 };
21 cells.addRing(0, F2CLinearRing({
22 F2CPoint(.4,.4), F2CPoint(.4,.6),F2CPoint(.6,.6),F2CPoint(.6,.4), F2CPoint(.4,.4)
23 }));
24 cells.addRing(0, F2CLinearRing({
25 F2CPoint(1.2,1.2), F2CPoint(1.2,1.6),F2CPoint(1.6,1.6),F2CPoint(1.6,1.2), F2CPoint(1.2,1.2)
26 }));
27
28 cells *= 3e1;
29
30 f2c::hg::ConstHL const_hl;
31 F2CCells no_hl = const_hl.generateHeadlandArea(cells, 1, 3);
32 auto hl_swaths = const_hl.generateHeadlandSwaths(cells, 1, 3, false);
33
34 f2c::decomp::BoustrophedonDecomp decomp;
35 decomp.setSplitAngle(M_PI/2.0);
36 auto decomp_cells = decomp.decompose(no_hl);
37
38 f2c::sg::BruteForce bf;
39 F2CSwathsByCells swaths = bf.generateSwaths(M_PI/2.0, 5, decomp_cells);
40
41 f2c::rp::RoutePlannerBase route_planner;
42 F2CRoute route = route_planner.genRoute(hl_swaths[1], swaths);
43
44 EXPECT_FALSE(route.isEmpty());
45 EXPECT_GT(route.sizeVectorSwaths(), 1);
46 EXPECT_EQ(route.sizeVectorSwaths(), route.sizeConnections());
47
48 /*
49 f2c::Visualizer::figure();
50 f2c::Visualizer::plot(cells);
51 //f2c::Visualizer::plot(no_hl);
52 //f2c::Visualizer::plot(hl_swaths[1]);
53 //f2c::Visualizer::plot(decomp_cells);
54 //for (auto&& c : route.getConnections())
55 f2c::Visualizer::plot(route);
56 f2c::Visualizer::show();
57 */
58}
59
60TEST(fields2cover_rp_route_plan_base, redirect_flag) {
61 f2c::Random rand(4);

Callers

nothing calls this directly

Calls 15

generateHeadlandAreaMethod · 0.80
setSplitAngleMethod · 0.80
decomposeMethod · 0.80
generateSwathsMethod · 0.80
genRouteMethod · 0.80
sizeVectorSwathsMethod · 0.80
sizeConnectionsMethod · 0.80
flattenMethod · 0.80
hasSameDirMethod · 0.80
addRingMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected