| 40 | } |
| 41 | |
| 42 | UNIT_TEST(CalculatePolyLineCenter) |
| 43 | { |
| 44 | { |
| 45 | vector<PointD> const points{{0, 0}, {1, 1}, {2, 2}}; |
| 46 | TEST_EQUAL(GetPolyLineCenter(points), PointD(1, 1), ()); |
| 47 | } |
| 48 | { |
| 49 | vector<PointD> const points{{0, 2}, {1, 1}, {2, 2}}; |
| 50 | TEST_EQUAL(GetPolyLineCenter(points), PointD(1, 1), ()); |
| 51 | } |
| 52 | { |
| 53 | vector<PointD> const points{ |
| 54 | {1, 1}, |
| 55 | {2, 2}, |
| 56 | {4, 4}, |
| 57 | }; |
| 58 | TEST_EQUAL(GetPolyLineCenter(points), PointD(2.5, 2.5), ()); |
| 59 | } |
| 60 | { |
| 61 | vector<PointD> const points{{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}; |
| 62 | // Also logs a warning message. |
| 63 | TEST_EQUAL(GetPolyLineCenter(points), PointD(0, 0), ()); |
| 64 | } |
| 65 | { |
| 66 | vector<PointD> const points{{0, 0}, {0, 0}, {0, 0}, {0, 0.000001}, {0, 0.000001}, {0, 0.000001}, {0, 0.000001}}; |
| 67 | // Also logs a warning message. |
| 68 | TEST(GetPolyLineCenter(points).EqualDxDy(PointD(0, .0000005), 1e-7), ()); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | UNIT_TEST(CalculateCenter) |
| 73 | { |
nothing calls this directly
no test coverage detected