From ed5bcfffb4adf6dbeb1da35fd4100d49ef2e7362 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 13 Jul 2011 19:09:11 +0000 Subject: [PATCH] Added mixed-types test for within [SVN r73063] --- test/algorithms/within.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/algorithms/within.cpp b/test/algorithms/within.cpp index c02068187..e67cd7a57 100644 --- a/test/algorithms/within.cpp +++ b/test/algorithms/within.cpp @@ -121,9 +121,39 @@ void test_spherical() BOOST_CHECK_EQUAL(bg::within(Point(6.0, 51.0), triangle), false); } +void test_mixed() +{ + typedef boost::geometry::model::d2::point_xy point_type1; + typedef boost::geometry::model::point point_type2; + + typedef boost::geometry::model::polygon polygon_type1; + typedef boost::geometry::model::polygon polygon_type2; + typedef boost::geometry::model::box box_type1; + typedef boost::geometry::model::box box_type2; + + polygon_type1 poly1; + boost::geometry::read_wkt("POLYGON((0 0,0 5,5 5,5 0,0 0))", poly1); + polygon_type2 poly2; + boost::geometry::read_wkt("POLYGON((0 0,0 5,5 5,5 0,0 0))", poly2); + + box_type1 box1(point_type1(1, 1), point_type1(4, 4)); + box_type2 box2(point_type2(0, 0), point_type2(5, 5)); + + point_type1 p1(3, 3); + point_type2 p2(3, 3); + + BOOST_CHECK_EQUAL(bg::within(p1, poly2), true); + BOOST_CHECK_EQUAL(bg::within(p2, poly1), true); + BOOST_CHECK_EQUAL(bg::within(p2, box1), true); + BOOST_CHECK_EQUAL(bg::within(p1, box2), true); + BOOST_CHECK_EQUAL(bg::within(box1, box2), true); +} + int test_main( int , char* [] ) { + test_mixed(); + test_all >(); test_all >();