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