]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/test/algorithms/for_each.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / for_each.cpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2// Unit Test
3
4// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5
6// Use, modification and distribution is subject to the Boost Software License,
7// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt)
9
10
11#include <algorithms/test_for_each.hpp>
12
13#include <boost/geometry/geometries/geometries.hpp>
14
15
16
17template <typename P>
18void test_all()
19{
20 test_geometry<P>
21 (
22 "POINT(1 1)"
23
24 // per point
25 , 1
26 , "POINT(101 1)"
27 , "POINT(101 100)"
28 // per segment
29 , ""
30 , 0
31 , "POINT(1 1)"
32 );
33 test_geometry<bg::model::linestring<P> >
34 (
35 "LINESTRING(1 1,2 2)"
36
37 , 3
38 , "LINESTRING(101 1,102 2)"
39 , "LINESTRING(101 100,102 200)"
40
41 , "((1, 1), (2, 2))"
42 , std::sqrt(2.0)
43 , "LINESTRING(10 1,2 2)"
44 );
45 test_geometry<bg::model::ring<P> >
46 (
47 "POLYGON((1 1,1 4,4 4,4 1,1 1))"
48
49 , 11
50 , "POLYGON((101 1,101 4,104 4,104 1,101 1))"
51 , "POLYGON((101 100,101 400,104 400,104 100,101 100))"
52
53 , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
54 , 4 * 3.0
55 , "POLYGON((10 1,10 4,4 4,4 1,1 1))"
56 );
57 test_geometry<bg::model::ring<P, true, false> > // open ring
58 (
59 "POLYGON((1 1,1 4,4 4,4 1))"
60
61 , 10
62 , "POLYGON((101 1,101 4,104 4,104 1))"
63 , "POLYGON((101 100,101 400,104 400,104 100))"
64
65 , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
66 , 4 * 3.0
67 , "POLYGON((10 1,10 4,4 4,4 1))"
68 );
69 test_geometry<bg::model::polygon<P> >
70 (
71 "POLYGON((1 1,1 4,4 4,4 1,1 1),(2 2,3 2,3 3,2 3,2 2))"
72
73 , 23
74 , "POLYGON((101 1,101 4,104 4,104 1,101 1),(102 2,103 2,103 3,102 3,102 2))"
75 , "POLYGON((101 100,101 400,104 400,104 100,101 100),(102 200,103 200,103 300,102 300,102 200))"
76
77 , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1)) "
78 "((2, 2), (3, 2)) ((3, 2), (3, 3)) ((3, 3), (2, 3)) ((2, 3), (2, 2))"
79 , 4 * 3.0 + 4 * 1.0
80 , "POLYGON((10 1,10 4,4 4,4 1,1 1,10 1),(2 2,3 2,3 3,2 3,2 2))"
81 );
82 test_geometry<bg::model::polygon<P, true, false> > // open polygon
83 (
84 "POLYGON((1 1,1 4,4 4,4 1),(2 2,3 2,3 3,2 3))"
85
86 , 20
87 , "POLYGON((101 1,101 4,104 4,104 1,101 1),(102 2,103 2,103 3,102 3,102 2))"
88 , "POLYGON((101 100,101 400,104 400,104 100,101 100),(102 200,103 200,103 300,102 300,102 200))"
89
90 , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1)) "
91 "((2, 2), (3, 2)) ((3, 2), (3, 3)) ((3, 3), (2, 3)) ((2, 3), (2, 2))"
92 , 4 * 3.0 + 4 * 1.0
93 , "POLYGON((10 1,10 4,4 4,4 1,10 1),(2 2,3 2,3 3,2 3,2 2))"
94 );
95}
96
97int test_main(int, char* [])
98{
99 test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
100
101#if defined(HAVE_TTMATH)
102 test_all<bg::model::point<ttmath_big, 2, bg::cs::cartesian> >();
103#endif
104
105 return 0;
106}