MCPcopy Create free account
hub / github.com/comaps/comaps / UNIT_TEST

Function UNIT_TEST

libs/geometry/geometry_tests/algorithm_test.cpp:42–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42UNIT_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
72UNIT_TEST(CalculateCenter)
73{

Callers

nothing calls this directly

Calls 6

GetPolyLineCenterFunction · 0.85
TESTFunction · 0.85
GetBoundingBoxFunction · 0.85
GetPointOnSurfaceFunction · 0.85
PointsAlmostEqualFunction · 0.85
EqualDxDyMethod · 0.45

Tested by

no test coverage detected