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

Function UNIT_TEST

libs/geometry/geometry_tests/line2d_tests.cpp:21–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21UNIT_TEST(LineIntersection_Smoke)
22{
23 {
24 Line2D const line(Segment2D(PointD(0, 0), PointD(1, 0)));
25 TEST_EQUAL(Intersect(line, line).m_type, Type::Infinity, ());
26 }
27
28 {
29 Line2D const lhs(Segment2D(PointD(0, 0), PointD(1, 1)));
30 Line2D const rhs(Segment2D(PointD(-10, -10), PointD(-100, -100)));
31 TEST_EQUAL(Intersect(lhs, rhs).m_type, Type::Infinity, ());
32 }
33
34 {
35 Line2D const lhs(Segment2D(PointD(0, 0), PointD(10, 10)));
36 Line2D const rhs(Segment2D(PointD(10, 11), PointD(0, 1)));
37 TEST_EQUAL(Intersect(lhs, rhs).m_type, Type::Zero, ());
38 }
39
40 {
41 Line2D const lhs(Segment2D(PointD(10, 0), PointD(9, 10)));
42 Line2D const rhs(Segment2D(PointD(-10, 0), PointD(-9, 10)));
43 auto const result = Intersect(lhs, rhs);
44 TEST_EQUAL(result.m_type, Type::One, ());
45 TEST(AlmostEqualAbs(result.m_point, PointD(0, 100), kEps), (result.m_point));
46 }
47}
48} // namespace line2d_tests

Callers

nothing calls this directly

Calls 4

Segment2DClass · 0.85
TESTFunction · 0.85
IntersectFunction · 0.70
AlmostEqualAbsFunction · 0.50

Tested by

no test coverage detected