1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
5 // This file was modified by Oracle on 2013, 2014, 2015.
6 // Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
12 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
14 #include "test_relate.hpp"
15 #include "../nan_cases.hpp"
18 //#include <to_svg.hpp>
21 void test_point_point()
23 test_geometry
<P
, P
>("POINT(0 0)", "POINT(0 0)", "0FFFFFFF2");
24 test_geometry
<P
, P
>("POINT(1 0)", "POINT(0 0)", "FF0FFF0F2");
28 void test_point_multipoint()
30 typedef bg::model::multi_point
<P
> mpt
;
32 test_geometry
<P
, mpt
>("POINT(0 0)", "MULTIPOINT(0 0)", "0FFFFFFF2");
33 test_geometry
<P
, mpt
>("POINT(1 0)", "MULTIPOINT(0 0)", "FF0FFF0F2");
34 test_geometry
<P
, mpt
>("POINT(0 0)", "MULTIPOINT(0 0, 1 0)", "0FFFFF0F2");
38 void test_multipoint_multipoint()
40 typedef bg::model::multi_point
<P
> mpt
;
42 test_geometry
<mpt
, mpt
>("MULTIPOINT(0 0)", "MULTIPOINT(0 0)", "0FFFFFFF2");
43 test_geometry
<mpt
, mpt
>("MULTIPOINT(1 0)", "MULTIPOINT(0 0)", "FF0FFF0F2");
44 test_geometry
<mpt
, mpt
>("MULTIPOINT(0 0)", "MULTIPOINT(0 0, 1 0)", "0FFFFF0F2");
45 test_geometry
<mpt
, mpt
>("MULTIPOINT(0 0, 1 0)", "MULTIPOINT(0 0)", "0F0FFFFF2");
46 test_geometry
<mpt
, mpt
>("MULTIPOINT(0 0, 1 1)", "MULTIPOINT(0 0, 1 0)", "0F0FFF0F2");
48 //typedef bg::model::d2::point_xy<float> ptf;
49 //typedef bg::model::multi_point<ptf> mptf;
50 //test_geometry<mptf, mpt>("MULTIPOINT(0 0)", "MULTIPOINT(0 0)", "0FFFFFFF2");
52 // assertion failure in relate->boundary_checker->std::equal_range with msvc
53 if (BOOST_GEOMETRY_CONDITION(is_nan_case_supported
<mpt
>::value
))
59 check_geometry(g
, g
, wkt
, wkt
, "*********");
64 void test_point_linestring()
66 typedef bg::model::linestring
<P
> ls
;
68 test_geometry
<P
, ls
>("POINT(0 0)", "LINESTRING(0 0, 2 2, 3 2)", "F0FFFF102");
69 test_geometry
<P
, ls
>("POINT(1 1)", "LINESTRING(0 0, 2 2, 3 2)", "0FFFFF102");
70 test_geometry
<P
, ls
>("POINT(3 2)", "LINESTRING(0 0, 2 2, 3 2)", "F0FFFF102");
71 test_geometry
<P
, ls
>("POINT(1 0)", "LINESTRING(0 0, 2 2, 3 2)", "FF0FFF102");
73 test_geometry
<P
, ls
>("POINT(0 0)", "LINESTRING(0 0, 2 2, 3 2, 0 0)", "0FFFFF1F2");
74 test_geometry
<P
, ls
>("POINT(1 1)", "LINESTRING(0 0, 2 2, 3 2, 0 0)", "0FFFFF1F2");
75 test_geometry
<P
, ls
>("POINT(3 2)", "LINESTRING(0 0, 2 2, 3 2, 0 0)", "0FFFFF1F2");
76 test_geometry
<P
, ls
>("POINT(1 0)", "LINESTRING(0 0, 2 2, 3 2, 0 0)", "FF0FFF1F2");
80 void test_point_multilinestring()
82 typedef bg::model::linestring
<P
> ls
;
83 typedef bg::model::multi_linestring
<ls
> mls
;
85 test_geometry
<P
, mls
>("POINT(0 0)", "MULTILINESTRING((0 0, 2 0, 2 2),(0 0, 0 2))", "0FFFFF102");
86 test_geometry
<P
, mls
>("POINT(0 0)", "MULTILINESTRING((0 0, 2 0, 2 2),(0 0, 0 2, 2 2))", "0FFFFF1F2");
87 test_geometry
<P
, mls
>("POINT(0 0)", "MULTILINESTRING((0 0, 2 0, 2 2),(0 0, 0 2, 2 2),(0 0, 1 1))", "F0FFFF102");
89 test_geometry
<P
, mls
>("POINT(0 0)", "MULTILINESTRING((0 0,5 0),(0 0,0 5,5 0),(0 0,-5 0),(0 0,0 -5,-5 0))", "0FFFFF1F2");
90 test_geometry
<P
, mls
>("POINT(5 0)", "MULTILINESTRING((0 0,5 0),(0 0,0 5,5 0),(0 0,-5 0),(0 0,0 -5,-5 0))", "0FFFFF1F2");
91 test_geometry
<P
, mls
>("POINT(1 0)", "MULTILINESTRING((0 0,5 0),(0 0,0 5,5 0),(0 0,-5 0),(0 0,0 -5,-5 0))", "0FFFFF1F2");
93 // assertion failure in relate->boundary_checker->std::equal_range with msvc
94 if (BOOST_GEOMETRY_CONDITION(is_nan_case_supported
<mls
>::value
))
97 std::string wkt0
= "POINT(3.1e+307 1)";
99 bg::read_wkt(wkt0
, g0
);
102 std::string wkt1
= "POINT(1.1e+308 1.2e+308)";
104 bg::read_wkt(wkt1
, g1
);
110 check_geometry(g0
, g2
, wkt0
, wkt2
, "*********");
111 check_geometry(g1
, g2
, wkt1
, wkt2
, "*********");
115 template <typename P
>
118 test_point_point
<P
>();
119 test_point_multipoint
<P
>();
120 test_multipoint_multipoint
<P
>();
121 test_point_linestring
<P
>();
122 test_point_multilinestring
<P
>();
125 int test_main( int , char* [] )
129 test_all
<bg::model::d2::point_xy
<int> >();
130 test_all
<bg::model::d2::point_xy
<double> >();
132 #if defined(HAVE_TTMATH)
133 test_all
<bg::model::d2::point_xy
<ttmath_big
> >();