geometry/test/algorithms/append.cpp
Barend Gehrels e4f47a7a25 Major update:
Adaptions to test with respect to new namespace model
Removed GMP/CLN and, where it was present, replaced by TTMATH
Small fix in comparable_distance test
All testfiles use bg as alias now

[SVN r66811]
2010-11-28 13:28:09 +00:00

65 lines
1.9 KiB
C++

// Boost.Geometry (aka GGL, Generic Geometry Library) test file
//
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
// Copyright Bruno Lalande 2008, 2009
// 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 <deque>
#include <vector>
#include <boost/concept/requires.hpp>
#include <geometry_test_common.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/adapted/std_as_linestring.hpp>
#include <boost/geometry/geometries/adapted/boost_array_as_linestring.hpp>
#include <test_common/test_point.hpp>
#include <test_geometries/wrapped_boost_array.hpp>
template <typename G>
void test_geometry()
{
G geometry;
typedef typename bg::point_type<G>::type P;
bg::append(geometry, bg::make_zero<P>());
BOOST_CHECK_EQUAL(bg::num_points(geometry), 1u);
bg::clear(geometry);
BOOST_CHECK_EQUAL(bg::num_points(geometry), 0u);
//P p = boost::range::front(geometry);
}
template <typename P>
void test_all()
{
test_geometry<bg::model::linestring<P> >();
test_geometry<bg::model::linear_ring<P> >();
test_geometry<bg::model::polygon<P> >();
test_geometry<std::vector<P> >();
test_geometry<std::deque<P> >();
//test_geometry<std::list<P> >();
test_geometry<test::wrapped_boost_array<P, 2> >();
}
int test_main(int, char* [])
{
test_all<test::test_point>();
test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
return 0;
}