25#include <boost/test/data/test_case.hpp>
64 "Point on the ray start",
70 "Point on the ray end",
76 "Point on the ray, past the end",
82 "Point on the infinite line, but on the wrong side",
98 const bool contains = c.Hl.Contains( c.Point );
112 "Parallel, no intersection",
122 std::optional<VECTOR2I> intersection = c.HlA.Intersect( c.HlB );
124 BOOST_REQUIRE( intersection.has_value() == c.ExpectedIntersection.has_value() );
128 BOOST_TEST( *intersection == *c.ExpectedIntersection );
135 "Center to right edge",
147 "Ray not in the box",
153 "Ray starts outside but crosses box",
170 ( *clipped )( *c.ExpectedClippedSeg ) );
bool SegmentsHaveSameEndPoints(const SEG &aSeg1, const SEG &aSeg2)
Check that two SEGs have the same end points, in either order.
std::optional< SEG > ClipHalfLineToBox(const HALF_LINE &aRay, const BOX2I &aBox)
Get the segment of a half-line that is inside a box, if any.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Utility functions for working with shapes.
std::optional< SEG > ExpectedClippedSeg
std::optional< VECTOR2I > ExpectedIntersection
A named data-driven test case.
BOOST_DATA_TEST_CASE(ConvertToKicadUnit, boost::unit_test::data::make(altium_to_kicad_unit), input_value, expected_result)
Test conversation from Altium internal units into KiCad internal units.
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
const std::vector< HalfLineContainsPointCase > Contains_cases
BOOST_TEST(contains==c.ExpectedContains)
const std::vector< HalfLineHalfLineIntersectionCase > Intersect_cases
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
const std::vector< HalfLineBoxClipCase > ClipToBox_cases
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_PREDICATE(ArePolylineEndPointsNearCircle,(chain)(c.m_geom.m_center_point)(radius)(accuracy+epsilon))
VECTOR2< int32_t > VECTOR2I