PageRenderTime 35ms CodeModel.GetById 23ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/geometry/test/core/tag.cpp

http://hadesmem.googlecode.com/
C++ | 74 lines | 47 code | 21 blank | 6 comment | 0 complexity | 373478e8ad28d7fc7b76f5317bd2fb87 MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2// Unit Test
 3
 4// Copyright (c) 2007-2011 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#include <boost/geometry/core/tag.hpp>
14
15#include <boost/geometry/geometries/geometries.hpp>
16
17#include <boost/geometry/geometries/adapted/c_array.hpp>
18#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
19
20#include <boost/geometry/geometries/register/linestring.hpp>
21
22#include <vector>
23#include <deque>
24
25BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
26BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
27
28BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
29BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque)
30
31
32template <typename G, typename Expected>
33void test_geometry()
34{
35    BOOST_CHECK_EQUAL(typeid(typename bg::tag<G>::type).name(),
36        typeid(Expected).name());
37}
38
39template <typename P, size_t D>
40void test_all()
41{
42    test_geometry<P, bg::point_tag>();
43    test_geometry<P const, bg::point_tag>();
44    test_geometry<bg::model::linestring<P> , bg::linestring_tag>();
45    test_geometry<bg::model::ring<P> , bg::ring_tag>();
46    test_geometry<bg::model::polygon<P> , bg::polygon_tag>();
47    test_geometry<bg::model::box<P> , bg::box_tag>();
48    test_geometry<bg::model::segment<P> , bg::segment_tag>();
49    test_geometry<bg::model::referring_segment<P const> , bg::segment_tag>();
50
51    test_geometry<std::vector<P>, bg::linestring_tag>();
52    test_geometry<std::deque<P>, bg::linestring_tag>();
53
54}
55
56int test_main(int, char* [])
57{
58    test_geometry<int[2], bg::point_tag>();
59    test_geometry<float[2], bg::point_tag>();
60    test_geometry<double[2], bg::point_tag>();
61
62    test_geometry<int[3], bg::point_tag>();
63    test_geometry<float[3], bg::point_tag>();
64    test_geometry<double[3], bg::point_tag>();
65
66    test_geometry<boost::tuple<double, double>, bg::point_tag>();
67    test_geometry<boost::tuple<double, double, double>, bg::point_tag>();
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}