• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3 
4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
6 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
7 
8 // This file was modified by Oracle on 2014.
9 // Modifications copyright (c) 2014 Oracle and/or its affiliates.
10 
11 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
12 
13 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
14 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
15 
16 // Use, modification and distribution is subject to the Boost Software License,
17 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
18 // http://www.boost.org/LICENSE_1_0.txt)
19 
20 
21 #include <geometry_test_common.hpp>
22 
23 #include <boost/geometry/core/cs.hpp>
24 #include <boost/geometry/core/radius.hpp>
25 
26 #include <boost/geometry/srs/sphere.hpp>
27 #include <boost/geometry/srs/spheroid.hpp>
28 
29 #include <boost/geometry/algorithms/make.hpp>
30 
31 
32 template <std::size_t I, typename G>
test_get_set()33 void test_get_set()
34 {
35     typedef typename bg::radius_type<G>::type radius_type;
36 
37     G g;
38     bg::set_radius<I>(g, radius_type(5));
39 
40     radius_type x = bg::get_radius<I>(g);
41 
42     BOOST_CHECK_CLOSE(double(x), 5.0, 0.0001);
43 }
44 
45 template <typename T>
test_all()46 void test_all()
47 {
48     typedef bg::srs::spheroid<T> Sd;
49     test_get_set<0, Sd>();
50     test_get_set<2, Sd>();
51 
52     typedef bg::srs::sphere<T> Se;
53     test_get_set<0, Se>();
54 }
55 
56 
test_main(int,char * [])57 int test_main(int, char* [])
58 {
59     test_all<int>();
60     test_all<float>();
61     test_all<double>();
62 
63     return 0;
64 }
65