]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/arithmetic/dot_product.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / arithmetic / dot_product.cpp
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 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
10
11 // Use, modification and distribution is subject to the Boost Software License,
12 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
14
15
16 #include <geometry_test_common.hpp>
17
18 #include <boost/geometry/arithmetic/dot_product.hpp>
19
20
21 #include <boost/geometry/algorithms/assign.hpp>
22
23 #include <boost/geometry/geometries/point.hpp>
24 #include <boost/geometry/geometries/adapted/c_array.hpp>
25 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
26 #include <test_common/test_point.hpp>
27
28 BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
29 BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
30
31
32 template <typename P>
33 void test_all()
34 {
35 P p1;
36 bg::assign_values(p1, 1, 2, 3);
37 P p2;
38 bg::assign_values(p2, 4, 5, 6);
39 BOOST_CHECK(bg::dot_product(p1, p2) == 1*4 + 2*5 + 3*6);
40 }
41
42 int test_main(int, char* [])
43 {
44 test_all<int[3]>();
45 test_all<float[3]>();
46 test_all<double[3]>();
47 test_all<test::test_point>();
48 test_all<bg::model::point<int, 3, bg::cs::cartesian> >();
49 test_all<bg::model::point<float, 3, bg::cs::cartesian> >();
50 test_all<bg::model::point<double, 3, bg::cs::cartesian> >();
51
52 return 0;
53 }