]>
Commit | Line | Data |
---|---|---|
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 | #include <algorithms/test_length.hpp> | |
11 | ||
12 | #include <boost/geometry/geometries/geometries.hpp> | |
13 | #include <boost/geometry/geometries/point_xy.hpp> | |
14 | #include <boost/geometry/geometries/adapted/std_pair_as_segment.hpp> | |
15 | ||
16 | #include <test_geometries/all_custom_linestring.hpp> | |
17 | #include <test_geometries/wrapped_boost_array.hpp> | |
18 | ||
19 | ||
20 | template <typename P> | |
21 | void test_all() | |
22 | { | |
23 | // 3-4-5 triangle | |
24 | test_geometry<std::pair<P, P> >("LINESTRING(0 0,3 4)", 5); | |
25 | ||
26 | // 3-4-5 plus 1-1 | |
27 | test_geometry<bg::model::linestring<P> >("LINESTRING(0 0,3 4,4 3)", 5 + sqrt(2.0)); | |
28 | test_geometry<all_custom_linestring<P> >("LINESTRING(0 0,3 4,4 3)", 5 + sqrt(2.0)); | |
29 | test_geometry<test::wrapped_boost_array<P, 3> >("LINESTRING(0 0,3 4,4 3)", 5 + sqrt(2.0)); | |
30 | ||
31 | // Geometries with length zero | |
32 | test_geometry<P>("POINT(0 0)", 0); | |
33 | test_geometry<bg::model::polygon<P> >("POLYGON((0 0,0 1,1 1,1 0,0 0))", 0); | |
34 | } | |
35 | ||
36 | template <typename P> | |
37 | void test_empty_input() | |
38 | { | |
39 | test_empty_input(bg::model::linestring<P>()); | |
40 | } | |
41 | ||
42 | int test_main(int, char* []) | |
43 | { | |
44 | test_all<bg::model::d2::point_xy<int> >(); | |
45 | test_all<bg::model::d2::point_xy<float> >(); | |
46 | test_all<bg::model::d2::point_xy<double> >(); | |
47 | ||
48 | #if defined(HAVE_TTMATH) | |
49 | test_all<bg::model::d2::point_xy<ttmath_big> >(); | |
50 | #endif | |
51 | ||
52 | // test_empty_input<bg::model::d2::point_xy<int> >(); | |
53 | ||
54 | return 0; | |
55 | } |