// Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test // Copyright (c) 2020 Digvijay Janartha, Hamirpur, India. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include template bg::model::point create_point() { T t1 = 1; T t2 = 2; T t3 = 3; return bg::model::point(t1, t2, t3); } template void check_point(P& to_check, T x, T y, T z) { BOOST_CHECK_EQUAL(bg::get<0>(to_check), x); BOOST_CHECK_EQUAL(bg::get<1>(to_check), y); BOOST_CHECK_EQUAL(bg::get<2>(to_check), z); } template void test_default_constructor() { bg::model::point p(create_point()); check_point(p, 1, 2, 3); } template void test_copy_constructor() { bg::model::point p = create_point(); check_point(p, 1, 2, 3); } template void test_copy_assignment() { bg::model::point p(create_point()); bg::set<0>(p, 4); bg::set<1>(p, 5); bg::set<2>(p, 6); check_point(p, 4, 5, 6); } template void test_concept() { typedef bg::model::point P; // Compilation tests, all things should compile. BOOST_CONCEPT_ASSERT( (bg::concepts::ConstPoint

) ); BOOST_CONCEPT_ASSERT( (bg::concepts::Point

) ); typedef typename bg::coordinate_type

::type T1; boost::ignore_unused(); } template void test_constexpr() { typedef bg::model::point P; constexpr P p1 = P(1, 2, 3); constexpr P p2 = P(4, 5); constexpr T c1 = bg::get<0>(p1); constexpr T c2 = bg::get<2>(p2); BOOST_CHECK_EQUAL(c1, 1); BOOST_CHECK_EQUAL(c2, 0); check_point(p1, 1, 2, 3); check_point(p2, 4, 5, 0); } template void test_all() { test_default_constructor(); test_copy_constructor(); test_copy_assignment(); test_concept(); test_constexpr(); } template void test_cs() { test_all(); test_all(); test_all(); } int test_main(int, char* []) { test_cs(); test_cs >(); test_cs >(); test_cs >(); return 0; }