| 4 | #include "fields2cover/route_planning/custom_order.h" |
| 5 | |
| 6 | TEST(fields2cover_route_custom_order, defined_order) { |
| 7 | const int n = 11; |
| 8 | F2CSwaths swaths; |
| 9 | for (int i = 1; i < n; ++i) { |
| 10 | swaths.emplace_back(F2CLineString({F2CPoint(0, i), F2CPoint(1, i)}), i, i-1); |
| 11 | } |
| 12 | |
| 13 | f2c::rp::CustomOrder swath_sorter; |
| 14 | swath_sorter.setCustomOrder({1,0,3,2,5,4,7,6,8,9}); |
| 15 | |
| 16 | swaths = swath_sorter.genSortedSwaths(swaths, 0); |
| 17 | |
| 18 | EXPECT_EQ(swaths[0].getId(), 1); |
| 19 | EXPECT_EQ(swaths[1].getId(), 0); |
| 20 | EXPECT_EQ(swaths[2].getId(), 3); |
| 21 | EXPECT_EQ(swaths[3].getId(), 2); |
| 22 | EXPECT_EQ(swaths[4].getId(), 5); |
| 23 | EXPECT_EQ(swaths[5].getId(), 4); |
| 24 | EXPECT_EQ(swaths[6].getId(), 7); |
| 25 | EXPECT_EQ(swaths[7].getId(), 6); |
| 26 | EXPECT_EQ(swaths[8].getId(), 8); |
| 27 | EXPECT_EQ(swaths[9].getId(), 9); |
| 28 | } |
| 29 | |
| 30 | TEST(fields2cover_route_custom_order, constructor_order) { |
| 31 | const int n = 11; |
nothing calls this directly
no test coverage detected