]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/core/coordinate_dimension.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / core / coordinate_dimension.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 // 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 <geometry_test_common.hpp>
12
13
14 #include <boost/geometry/core/coordinate_dimension.hpp>
15
16
17 #include <boost/geometry/geometries/geometries.hpp>
18
19 #include <boost/geometry/geometries/adapted/c_array.hpp>
20 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
21
22 #include <boost/geometry/geometries/register/linestring.hpp>
23
24 #include <vector>
25 #include <deque>
26
27 BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
28 BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
29
30 BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
31 BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
32
33
34 template <typename G, int Expected>
35 void test_geometry()
36 {
37 BOOST_CHECK_EQUAL(bg::dimension<G>::type::value, Expected);
38 }
39
40 template <typename P, size_t D>
41 void test_all()
42 {
43 test_geometry<P, D>();
44 test_geometry<P const, D>();
45 test_geometry<bg::model::linestring<P> , D>();
46 test_geometry<bg::model::ring<P> , D>();
47 test_geometry<bg::model::polygon<P> , D>();
48 test_geometry<bg::model::box<P> , D>();
49 test_geometry<bg::model::segment<P> , D>();
50 test_geometry<bg::model::referring_segment<P const> , D>();
51
52 test_geometry<std::vector<P>, D>();
53 test_geometry<std::deque<P>, D>();
54 }
55
56 int test_main(int, char* [])
57 {
58 test_geometry<int[2], 2>();
59 test_geometry<float[2], 2>();
60 test_geometry<double[2], 2>();
61
62 test_geometry<int[3], 3>();
63 test_geometry<float[3], 3>();
64 test_geometry<double[3], 3>();
65
66 test_geometry<boost::tuple<double, double>, 2>();
67 test_geometry<boost::tuple<double, double, double>, 3>();
68
69 test_all<bg::model::point<int, 2, bg::cs::cartesian>, 2 >();
70 test_all<bg::model::point<float, 2, bg::cs::cartesian>, 2 >();
71 test_all<bg::model::point<double, 2, bg::cs::cartesian>, 2 >();
72
73 return 0;
74 }