// Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test // Copyright (c) 2020 Digvijay Janartha, Hamirpur, India. // 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 #include #include #include #include #include #include #include BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) #ifdef BOOST_NO_CXX11_HDR_INITIALIZER_LIST #include #endif//BOOST_NO_CXX11_HDR_INITIALIZER_LIST template bg::model::multi_point

create_multi_point() { bg::model::multi_point

mp1; P p1; bg::assign_values(p1, 1, 2, 3); bg::append(mp1, p1); return mp1; } template void check_multi_point(L& to_check, T x, T y, T z) { BOOST_CHECK_EQUAL(bg::get<0>(to_check[0]), x); BOOST_CHECK_EQUAL(bg::get<1>(to_check[0]), y); BOOST_CHECK_EQUAL(bg::get<2>(to_check[0]), z); } template void test_default_constructor() { bg::model::multi_point

mp1(create_multi_point

()); check_multi_point(mp1, 1, 2, 3); } template void test_copy_constructor() { bg::model::multi_point

mp1 = create_multi_point

(); check_multi_point(mp1, 1, 2, 3); } template void test_copy_assignment() { bg::model::multi_point

mp1(create_multi_point

()), mp2; mp2 = mp1; check_multi_point(mp2, 1, 2, 3); } template void test_concept() { typedef bg::model::multi_point

MP; BOOST_CONCEPT_ASSERT( (bg::concepts::ConstMultiPoint) ); BOOST_CONCEPT_ASSERT( (bg::concepts::MultiPoint) ); typedef typename bg::coordinate_type::type T; typedef typename bg::point_type::type MPP; boost::ignore_unused(); } template void test_all() { test_default_constructor

(); test_copy_constructor

(); test_copy_assignment

(); test_concept

(); } template void test_custom_multi_point(std::initializer_list

IL) { bg::model::multi_point

mp1(IL); std::ostringstream out; out << bg::dsv(mp1); BOOST_CHECK_EQUAL(out.str(), "((0, 0), (1, 2), (2, 0))"); } template void test_custom() { #ifdef BOOST_NO_CXX11_HDR_INITIALIZER_LIST std::initializer_list

IL = {P(0, 0), P(1, 2), P(2, 0)}; test_custom_multi_point

(IL); #endif//BOOST_NO_CXX11_HDR_INITIALIZER_LIST } template void test_cs() { test_all >(); test_all >(); test_all >(); test_custom >(); } int test_main(int, char* []) { test_cs(); test_cs >(); test_cs >(); test_cs >(); test_custom >(); return 0; }