// Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. // 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 template void test_linestring() { BOOST_CONCEPT_ASSERT( (bg::concepts::Linestring) ); BOOST_CONCEPT_ASSERT( (bg::concepts::ConstLinestring) ); Geometry geometry; typedef typename bg::point_type::type P; bg::clear(geometry); BOOST_CHECK_EQUAL(boost::size(geometry), 0u); bg::append(geometry, bg::make

(1, 2)); BOOST_CHECK_EQUAL(boost::size(geometry), 1u); bg::append(geometry, bg::make

(3, 4)); BOOST_CHECK_EQUAL(boost::size(geometry), 2u); bg::traits::resize::apply(geometry, 1); BOOST_CHECK_EQUAL(boost::size(geometry), 1u); //std::cout << bg::dsv(geometry) << std::endl; P p = *boost::begin(geometry); //std::cout << bg::dsv(p) << std::endl; BOOST_CHECK_EQUAL(bg::get<0>(p), 1); BOOST_CHECK_EQUAL(bg::get<1>(p), 2); bg::clear(geometry); BOOST_CHECK_EQUAL(boost::size(geometry), 0u); } template void test_all() { test_linestring >(); test_linestring >(); test_linestring >(); } int test_main(int, char* []) { test_all >(); test_all >(); test_all >(); return 0; }