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

Function TEST

tests/cpp/objectives/sg_obj/field_coverage_test.cpp:12–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "fields2cover/types.h"
11
12TEST(fields2cover_obj_field_coverage, get_best_value) {
13 double width {2.0};
14
15 F2CSwath swath1(F2CLineString({F2CPoint(0.0, 1.0), F2CPoint(4.0, 1.0)}), width);
16 F2CSwath swath2(F2CLineString({F2CPoint(0.0, 3.0), F2CPoint(4.0, 3.0)}), width);
17 F2CSwath swath3(F2CLineString({F2CPoint(0.0, 2.0), F2CPoint(4.0, 2.0)}), width);
18 F2CSwaths swaths {swath1};
19
20 F2CCell field;
21 F2CLinearRing line;
22 line.addPoint(0, 0);
23 line.addPoint(4, 0);
24 line.addPoint(4, 4);
25 line.addPoint(0, 4);
26 line.addPoint(0, 0);
27 field.addRing(line);
28 F2CCells fields{field};
29
30 f2c::obj::FieldCoverage obj;
31 EXPECT_NEAR(obj.computeCost(field, swaths), 0.5, 1e-5);
32 EXPECT_NEAR(obj.computeCost(fields, swaths), 0.5, 1e-5);
33
34 swaths.emplace_back(swath3);
35 EXPECT_NEAR(obj.computeCost(fields, swaths), 0.75, 1e-5);
36
37 swaths.emplace_back(swath2);
38 EXPECT_NEAR(obj.computeCost(fields, swaths), 1.0, 1e-5);
39}
40
41TEST(fields2cover_obj_field_coverage, computeCost_cost) {
42 double width {2.0};

Callers

nothing calls this directly

Calls 9

isMaximizingMethod · 0.80
addPointMethod · 0.45
addRingMethod · 0.45
computeCostMethod · 0.45
emplace_backMethod · 0.45
addGeometryMethod · 0.45
isMinimizingMethod · 0.45
isFastCompAvailableMethod · 0.45

Tested by

no test coverage detected