| 10 | #include "fields2cover/types.h" |
| 11 | |
| 12 | TEST(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 | |
| 41 | TEST(fields2cover_obj_field_coverage, computeCost_cost) { |
| 42 | double width {2.0}; |
nothing calls this directly
no test coverage detected