]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/for_each.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / for_each.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5
6 // This file was modified by Oracle on 2020.
7 // Modifications copyright (c) 2020, Oracle and/or its affiliates.
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14
15 #include <algorithms/test_for_each.hpp>
16
17 #include <boost/geometry/geometries/geometries.hpp>
18
19
20
21 template <typename P>
22 void test_all()
23 {
24 test_geometry<P>
25 (
26 "POINT(1 1)"
27
28 // per point
29 , 1
30 , "POINT(101 1)"
31 , "POINT(101 100)"
32 // per segment
33 , ""
34 , 0
35 , "POINT(1 1)"
36 );
37 test_geometry<bg::model::linestring<P> >
38 (
39 "LINESTRING(1 1,2 2)"
40
41 , 3
42 , "LINESTRING(101 1,102 2)"
43 , "LINESTRING(101 100,102 200)"
44
45 , "((1, 1), (2, 2))"
46 , std::sqrt(2.0)
47 , "LINESTRING(10 1,2 2)"
48 );
49 test_geometry<bg::model::linestring<P> >
50 (
51 "LINESTRING(1 1)"
52
53 , 1
54 , "LINESTRING(101 1)"
55 , "LINESTRING(101 100)"
56
57 , "((1, 1), (1, 1))"
58 , 0
59 , "LINESTRING(10 1)"
60 );
61 test_geometry<bg::model::linestring<P> >
62 (
63 "LINESTRING EMPTY"
64
65 , 0
66 , "LINESTRING()"
67 , "LINESTRING()"
68
69 , ""
70 , 0
71 , "LINESTRING()"
72 );
73 test_geometry<bg::model::ring<P> >
74 (
75 "POLYGON((1 1,1 4,4 4,4 1,1 1))"
76
77 , 11
78 , "POLYGON((101 1,101 4,104 4,104 1,101 1))"
79 , "POLYGON((101 100,101 400,104 400,104 100,101 100))"
80
81 , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
82 , 4 * 3.0
83 , "POLYGON((10 1,10 4,4 4,4 1,1 1))"
84 );
85 test_geometry<bg::model::ring<P> >
86 (
87 "POLYGON EMPTY"
88
89 , 0
90 , "POLYGON(())"
91 , "POLYGON(())"
92
93 , ""
94 , 0
95 , "POLYGON(())"
96 );
97 test_geometry<bg::model::ring<P, true, false> > // open ring
98 (
99 "POLYGON((1 1,1 4,4 4,4 1))"
100
101 , 10
102 , "POLYGON((101 1,101 4,104 4,104 1))"
103 , "POLYGON((101 100,101 400,104 400,104 100))"
104
105 , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
106 , 4 * 3.0
107 , "POLYGON((10 1,10 4,4 4,4 1))"
108 );
109 test_geometry<bg::model::polygon<P> >
110 (
111 "POLYGON((1 1,1 4,4 4,4 1,1 1),(2 2,3 2,3 3,2 3,2 2))"
112
113 , 23
114 , "POLYGON((101 1,101 4,104 4,104 1,101 1),(102 2,103 2,103 3,102 3,102 2))"
115 , "POLYGON((101 100,101 400,104 400,104 100,101 100),(102 200,103 200,103 300,102 300,102 200))"
116
117 , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1)) "
118 "((2, 2), (3, 2)) ((3, 2), (3, 3)) ((3, 3), (2, 3)) ((2, 3), (2, 2))"
119 , 4 * 3.0 + 4 * 1.0
120 , "POLYGON((10 1,10 4,4 4,4 1,1 1,10 1),(2 2,3 2,3 3,2 3,2 2))"
121 );
122 test_geometry<bg::model::polygon<P, true, false> > // open polygon
123 (
124 "POLYGON((1 1,1 4,4 4,4 1),(2 2,3 2,3 3,2 3))"
125
126 , 20
127 , "POLYGON((101 1,101 4,104 4,104 1,101 1),(102 2,103 2,103 3,102 3,102 2))"
128 , "POLYGON((101 100,101 400,104 400,104 100,101 100),(102 200,103 200,103 300,102 300,102 200))"
129
130 , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1)) "
131 "((2, 2), (3, 2)) ((3, 2), (3, 3)) ((3, 3), (2, 3)) ((2, 3), (2, 2))"
132 , 4 * 3.0 + 4 * 1.0
133 , "POLYGON((10 1,10 4,4 4,4 1,10 1),(2 2,3 2,3 3,2 3,2 2))"
134 );
135 }
136
137 int test_main(int, char* [])
138 {
139 test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
140
141 return 0;
142 }