PageRenderTime 23ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://hadesmem.googlecode.com/
C++ | 73 lines | 46 code | 21 blank | 6 comment | 0 complexity | cad41a2d62c6f446f0cdc817e233ad8e 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/topological_dimension.hpp>
14
15#include <boost/geometry/geometries/geometries.hpp>
16
17#include <boost/geometry/geometries/register/linestring.hpp>
18#include <boost/geometry/geometries/adapted/c_array.hpp>
19#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
20
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, int Expected>
33void test_geometry()
34{
35    BOOST_CHECK_EQUAL(bg::topological_dimension<G>::type::value, Expected);
36}
37
38template <typename P>
39void test_all()
40{
41    test_geometry<P, 0>();
42    test_geometry<P const, 0>();
43    test_geometry<bg::model::linestring<P> , 1>();
44    test_geometry<bg::model::ring<P> , 2>(); // being discussed
45    test_geometry<bg::model::polygon<P> , 2>();
46    test_geometry<bg::model::box<P> , 2>();
47    test_geometry<bg::model::segment<P> , 1>();
48    test_geometry<bg::model::referring_segment<P const> , 1>();
49
50    test_geometry<std::vector<P>, 1>();
51    test_geometry<std::deque<P>, 1>();
52
53}
54
55int test_main(int, char* [])
56{
57    test_geometry<int[2], 0>();
58    test_geometry<float[2], 0>();
59    test_geometry<double[2], 0>();
60
61    test_geometry<int[3], 0>();
62    test_geometry<float[3], 0>();
63    test_geometry<double[3], 0>();
64
65    test_geometry<boost::tuple<double, double>, 0>();
66    test_geometry<boost::tuple<double, double, double>, 0>();
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}