From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/geometry/test/concepts/Jamfile.v2 | 30 ++++++++ .../test/concepts/function_asserting_a_point.hpp | 30 ++++++++ .../test/concepts/function_requiring_a_point.hpp | 29 +++++++ .../geometry/test/concepts/linestring_concept.cpp | 77 +++++++++++++++++++ .../libs/geometry/test/concepts/point_array.cpp | 29 +++++++ .../test/concepts/point_concept_checker.cpp | 76 +++++++++++++++++++ .../point_geographic_custom_with_wrong_units.cpp | 29 +++++++ .../concepts/point_geographic_with_wrong_units.cpp | 29 +++++++ .../point_spherical_custom_with_wrong_units.cpp | 28 +++++++ .../concepts/point_spherical_with_wrong_units.cpp | 26 +++++++ .../geometry/test/concepts/point_well_formed.cpp | 34 +++++++++ .../concepts/point_well_formed_non_cartesian.cpp | 64 ++++++++++++++++ .../test/concepts/point_well_formed_traits.cpp | 88 ++++++++++++++++++++++ .../concepts/point_with_incorrect_dimension.cpp | 59 +++++++++++++++ .../concepts/point_without_coordinate_type.cpp | 54 +++++++++++++ .../test/concepts/point_without_dimension.cpp | 56 ++++++++++++++ .../test/concepts/point_without_getter.cpp | 52 +++++++++++++ .../test/concepts/point_without_setter.cpp | 52 +++++++++++++ 18 files changed, 842 insertions(+) create mode 100644 src/boost/libs/geometry/test/concepts/Jamfile.v2 create mode 100644 src/boost/libs/geometry/test/concepts/function_asserting_a_point.hpp create mode 100644 src/boost/libs/geometry/test/concepts/function_requiring_a_point.hpp create mode 100644 src/boost/libs/geometry/test/concepts/linestring_concept.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_array.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_concept_checker.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_geographic_custom_with_wrong_units.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_geographic_with_wrong_units.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_spherical_custom_with_wrong_units.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_spherical_with_wrong_units.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_well_formed.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_well_formed_non_cartesian.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_well_formed_traits.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_with_incorrect_dimension.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_without_coordinate_type.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_without_dimension.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_without_getter.cpp create mode 100644 src/boost/libs/geometry/test/concepts/point_without_setter.cpp (limited to 'src/boost/libs/geometry/test/concepts') diff --git a/src/boost/libs/geometry/test/concepts/Jamfile.v2 b/src/boost/libs/geometry/test/concepts/Jamfile.v2 new file mode 100644 index 00000000..dd1ad4eb --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/Jamfile.v2 @@ -0,0 +1,30 @@ +# Boost.Geometry (aka GGL, Generic Geometry Library) +# +# Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. +# Copyright (c) 2008-2015 Bruno Lalande, Paris, France. +# Copyright (c) 2009-2015 Mateusz Loskot, London, UK. +# Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. +# +# 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) + +test-suite boost-geometry-concepts + : + [ run linestring_concept.cpp : : : : concepts_linestring_concept ] + [ compile point_array.cpp : : concepts_point_array ] + [ compile point_concept_checker.cpp : : concepts_point_concept_checker ] + [ compile point_well_formed.cpp : : concepts_point_well_formed ] + [ compile point_well_formed_non_cartesian.cpp : : concepts_point_well_formed_non_cartesian ] + [ compile point_well_formed_traits.cpp : : concepts_point_well_formed_traits ] + [ compile-fail point_geographic_custom_with_wrong_units.cpp : : concepts_point_geographic_custom_with_wrong_units ] + [ compile-fail point_geographic_with_wrong_units.cpp : : concepts_point_geographic_with_wrong_units ] + [ compile-fail point_spherical_custom_with_wrong_units.cpp : : concepts_point_spherical_custom_with_wrong_units ] + [ compile-fail point_spherical_with_wrong_units.cpp : : concepts_point_spherical_with_wrong_units ] + [ compile-fail point_with_incorrect_dimension.cpp : : concepts_point_with_incorrect_dimension ] + [ compile-fail point_without_coordinate_type.cpp : : concepts_point_without_coordinate_type ] + [ compile-fail point_without_dimension.cpp : : concepts_point_without_dimension ] + [ compile-fail point_without_getter.cpp : : concepts_point_without_getter ] + [ compile-fail point_without_setter.cpp : : concepts_point_without_setter ] +# [ run polygon_concept.cpp : : : : concepts_polygon_concept ] + ; diff --git a/src/boost/libs/geometry/test/concepts/function_asserting_a_point.hpp b/src/boost/libs/geometry/test/concepts/function_asserting_a_point.hpp new file mode 100644 index 00000000..802d1985 --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/function_asserting_a_point.hpp @@ -0,0 +1,30 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) Point concept unit tests +// +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2007-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) + +#ifndef GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_ASSERTING_A_POINT_HPP +#define GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_ASSERTING_A_POINT_HPP + +#include + +#include + +namespace bg = boost::geometry; + +namespace test +{ + template + void function_asserting_a_point(P& p1, const CP& p2) + { + BOOST_CONCEPT_ASSERT((bg::concepts::Point

)); + BOOST_CONCEPT_ASSERT((bg::concepts::ConstPoint

)); + + bg::get<0>(p1) = bg::get<0>(p2); + } +} + +#endif // GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_ASSERTING_A_POINT_HPP diff --git a/src/boost/libs/geometry/test/concepts/function_requiring_a_point.hpp b/src/boost/libs/geometry/test/concepts/function_requiring_a_point.hpp new file mode 100644 index 00000000..d8628e94 --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/function_requiring_a_point.hpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) Point concept unit tests +// +// Copyright (c) 2008-2016 Bruno Lalande, Paris, France. +// Copyright (c) 2007-2016 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2016 Adam Wulkiewicz, Lodz, Poland. +// 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) + +#ifndef GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_REQUIRING_A_POINT_HPP +#define GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_REQUIRING_A_POINT_HPP + +#include + +namespace bg = boost::geometry; + +namespace test +{ + template + inline void function_requiring_a_point(P& p1, const C& p2) + { + BOOST_CONCEPT_ASSERT((bg::concepts::Point

)); + BOOST_CONCEPT_ASSERT((bg::concepts::ConstPoint)); + + bg::set<0>(p1, bg::get<0>(p2)); + } +} + +#endif // GEOMETRY_TEST_POINT_CONCEPT_FUNCTION_REQUIRING_A_POINT_HPP diff --git a/src/boost/libs/geometry/test/concepts/linestring_concept.cpp b/src/boost/libs/geometry/test/concepts/linestring_concept.cpp new file mode 100644 index 00000000..06f3dfcf --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/linestring_concept.cpp @@ -0,0 +1,77 @@ +// 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; +} diff --git a/src/boost/libs/geometry/test/concepts/point_array.cpp b/src/boost/libs/geometry/test/concepts/point_array.cpp new file mode 100644 index 00000000..000deadc --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_array.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, 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 "function_requiring_a_point.hpp" + +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) + + +int main() +{ + float p1[3] = { 0, 0, 0 }; + const float p2[3] = { 0, 0, 0 }; + test::function_requiring_a_point(p1, p2); + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_concept_checker.cpp b/src/boost/libs/geometry/test/concepts/point_concept_checker.cpp new file mode 100644 index 00000000..ea51a2e9 --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_concept_checker.cpp @@ -0,0 +1,76 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, 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 + +struct ro_point +{ + float x, y; +}; + + +struct rw_point +{ + float x, y; +}; + + +namespace boost { namespace geometry { namespace traits { + +template <> struct tag { typedef point_tag type; }; +template <> struct coordinate_type { typedef float type; }; +template <> struct coordinate_system { typedef cs::cartesian type; }; +template <> struct dimension { enum { value = 2 }; }; + +template <> struct access +{ + static float get(ro_point const& p) { return p.x; } +}; + +template <> struct access +{ + static float get(ro_point const& p) { return p.y; } +}; + + + + +template <> struct tag { typedef point_tag type; }; +template <> struct coordinate_type { typedef float type; }; +template <> struct coordinate_system { typedef cs::cartesian type; }; +template <> struct dimension { enum { value = 2 }; }; + +template <> struct access +{ + static float get(rw_point const& p) { return p.x; } + static void set(rw_point& p, float value) { p.x = value; } +}; + +template <> struct access +{ + static float get(rw_point const& p) { return p.y; } + static void set(rw_point& p, float value) { p.y = value; } +}; + + +}}} // namespace bg::traits + + +int main() +{ + boost::geometry::concepts::check(); + boost::geometry::concepts::check(); +} diff --git a/src/boost/libs/geometry/test/concepts/point_geographic_custom_with_wrong_units.cpp b/src/boost/libs/geometry/test/concepts/point_geographic_custom_with_wrong_units.cpp new file mode 100644 index 00000000..5ac6e03e --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_geographic_custom_with_wrong_units.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include + +#include +#include + + +namespace bg = boost::geometry; + +struct dummy {}; + +int main() +{ + bg::concepts::check + < + ro_lon_lat_point > const + >(); + + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_geographic_with_wrong_units.cpp b/src/boost/libs/geometry/test/concepts/point_geographic_with_wrong_units.cpp new file mode 100644 index 00000000..9ea42318 --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_geographic_with_wrong_units.cpp @@ -0,0 +1,29 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include + +#include +#include +#include + + +namespace bg = boost::geometry; + + +int main() +{ + bg::concepts::check + < + bg::model::point > + >(); + + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_spherical_custom_with_wrong_units.cpp b/src/boost/libs/geometry/test/concepts/point_spherical_custom_with_wrong_units.cpp new file mode 100644 index 00000000..4a44f323 --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_spherical_custom_with_wrong_units.cpp @@ -0,0 +1,28 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include + +#include +#include + + +namespace bg = boost::geometry; + + +int main() +{ + bg::concepts::check + < + rw_lon_lat_point > + >(); + + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_spherical_with_wrong_units.cpp b/src/boost/libs/geometry/test/concepts/point_spherical_with_wrong_units.cpp new file mode 100644 index 00000000..960db4a4 --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_spherical_with_wrong_units.cpp @@ -0,0 +1,26 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include + +#include +#include +#include + + +namespace bg = boost::geometry; + + +int main() +{ + bg::model::point > p; + + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_well_formed.cpp b/src/boost/libs/geometry/test/concepts/point_well_formed.cpp new file mode 100644 index 00000000..20ae39c6 --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_well_formed.cpp @@ -0,0 +1,34 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, 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 "function_requiring_a_point.hpp" + +struct point: public boost::tuple +{ +}; + +BOOST_GEOMETRY_REGISTER_POINT_2D(point, float, cs::cartesian, get<0>(), get<1>()) + +int main() +{ + point p1; + point const p2 = point(); + test::function_requiring_a_point(p1, p2); + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_well_formed_non_cartesian.cpp b/src/boost/libs/geometry/test/concepts/point_well_formed_non_cartesian.cpp new file mode 100644 index 00000000..adbc14ce --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_well_formed_non_cartesian.cpp @@ -0,0 +1,64 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include + +#include +#include +#include + + +namespace bg = boost::geometry; + + +template +inline void test_coordinate_system() +{ + typedef bg::model::point bg_double_point; + typedef bg::model::point bg_int_point; + + typedef rw_lon_lat_point rw_double_point; + typedef ro_lon_lat_point ro_double_point; + + typedef rw_lon_lat_point rw_int_point; + typedef ro_lon_lat_point ro_int_point; + + bg::concepts::check(); + bg::concepts::check(); + + bg::concepts::check(); + bg::concepts::check(); + + bg::concepts::check(); + bg::concepts::check(); + bg::concepts::check(); + + bg::concepts::check(); + bg::concepts::check(); + bg::concepts::check(); +} + + +int main() +{ + test_coordinate_system >(); + test_coordinate_system >(); + + test_coordinate_system >(); + test_coordinate_system >(); + + test_coordinate_system >(); + test_coordinate_system >(); + + test_coordinate_system >(); + test_coordinate_system >(); + + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_well_formed_traits.cpp b/src/boost/libs/geometry/test/concepts/point_well_formed_traits.cpp new file mode 100644 index 00000000..fc4ab82f --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_well_formed_traits.cpp @@ -0,0 +1,88 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, 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 "function_requiring_a_point.hpp" + +struct point +{ + point(): x(), y() {} + float x, y; +}; + +namespace boost { namespace geometry { namespace traits { + +template <> +struct tag +{ + typedef point_tag type; +}; + +template <> +struct coordinate_type +{ + typedef float type; +}; + +template <> +struct coordinate_system +{ + typedef bg::cs::cartesian type; +}; + +template <> +struct dimension +{ + enum { value = 2 }; +}; + +template <> +struct access +{ + static float get(point const& p) + { + return p.x; + } + + static void set(point& p, float value) + { + p.x = value; + } +}; + +template <> +struct access +{ + static float get(point const& p) + { + return p.y; + } + + static void set(point& p, float value) + { + p.y = value; + } +}; + + +}}} // namespace bg::traits + +int main() +{ + point p1; + const point p2; + test::function_requiring_a_point(p1, p2); + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_with_incorrect_dimension.cpp b/src/boost/libs/geometry/test/concepts/point_with_incorrect_dimension.cpp new file mode 100644 index 00000000..79ffc8be --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_with_incorrect_dimension.cpp @@ -0,0 +1,59 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, 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 "function_asserting_a_point.hpp" +#include "function_requiring_a_point.hpp" + +#include + +struct point +{ + point() : x(0), y(0) {} // initialize to suppress warnings + float x, y; +}; + +namespace boost { namespace geometry { namespace traits { + +template <> struct tag { typedef point_tag type; }; +template <> struct coordinate_type { typedef float type; }; +template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct dimension { enum { value = 3 }; }; + +template <> struct access +{ + static float get(point const& p) { return p.x; } + static void set(point& p, float value) { p.x = value; } +}; + +template <> struct access +{ + static float get(point const& p) { return p.y; } + static void set(point& p, float value) { p.y = value; } +}; + + +}}} // namespace bg::traits + + +int main() +{ + point p1; + const point p2; + test::function_requiring_a_point(p1, p2); + test::function_asserting_a_point(p1, p2); + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_without_coordinate_type.cpp b/src/boost/libs/geometry/test/concepts/point_without_coordinate_type.cpp new file mode 100644 index 00000000..3896e469 --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_without_coordinate_type.cpp @@ -0,0 +1,54 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, 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 "function_requiring_a_point.hpp" + +#include + +struct point +{ + point() : x(0), y(0) {} // initialize to suppress warnings + float x, y; +}; + +namespace boost { namespace geometry { namespace traits { + +template <> struct tag { typedef point_tag type; }; +//template <> struct coordinate_type { typedef float type; }; +template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct dimension { enum { value = 2 }; }; + +template <> struct access +{ + static float get(point const& p) { return p.x; } + static void set(point& p, float value) { p.x = value; } +}; + +template <> struct access +{ + static float get(point const& p) { return p.y; } + static void set(point& p, float value) { p.y = value; } +}; + + +}}} // namespace bg::traits + +int main() +{ + point p1; + const point p2; + test::function_requiring_a_point(p1, p2); + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_without_dimension.cpp b/src/boost/libs/geometry/test/concepts/point_without_dimension.cpp new file mode 100644 index 00000000..11182ed2 --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_without_dimension.cpp @@ -0,0 +1,56 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, 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 "function_requiring_a_point.hpp" + +#include + +struct point +{ + point() : x(0), y(0) {} // initialize to suppress warnings + float x, y; +}; + + +namespace boost { namespace geometry { namespace traits { + +template <> struct tag { typedef point_tag type; }; +template <> struct coordinate_type { typedef float type; }; +template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +//template <> struct dimension { enum { value = 2 }; }; + +template <> struct access +{ + static float get(point const& p) { return p.x; } + static void set(point& p, float value) { p.x = value; } +}; + +template <> struct access +{ + static float get(point const& p) { return p.y; } + static void set(point& p, float value) { p.y = value; } +}; + + +}}} // namespace bg::traits + + +int main() +{ + point p1; + const point p2; + test::function_requiring_a_point(p1, p2); + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_without_getter.cpp b/src/boost/libs/geometry/test/concepts/point_without_getter.cpp new file mode 100644 index 00000000..5d19924e --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_without_getter.cpp @@ -0,0 +1,52 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, 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 "function_requiring_a_point.hpp" + +#include + +struct point +{ + point() : x(0), y(0) {} // initialize to suppress warnings + float x, y; +}; + +namespace boost { namespace geometry { namespace traits { + +template <> struct tag { typedef point_tag type; }; +template <> struct coordinate_type { typedef float type; }; +template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct dimension { enum { value = 2 }; }; + +template <> struct access +{ + static void set(point& p, float value) { p.x = value; } +}; + +template <> struct access +{ + static void set(point& p, float value) { p.y = value; } +}; + + +}}} // namespace bg::traits + +int main() +{ + point p1; + const point p2; + test::function_requiring_a_point(p1, p2); + return 0; +} diff --git a/src/boost/libs/geometry/test/concepts/point_without_setter.cpp b/src/boost/libs/geometry/test/concepts/point_without_setter.cpp new file mode 100644 index 00000000..78be8399 --- /dev/null +++ b/src/boost/libs/geometry/test/concepts/point_without_setter.cpp @@ -0,0 +1,52 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, 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 "function_requiring_a_point.hpp" + +#include + +struct point +{ + point() : x(0), y(0) {} // initialize to suppress warnings + float x, y; +}; + +namespace boost { namespace geometry { namespace traits { + +template <> struct tag { typedef point_tag type; }; +template <> struct coordinate_type { typedef float type; }; +template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct dimension { enum { value = 2 }; }; + +template <> struct access +{ + static float get(point const& p) { return p.x; } +}; + +template <> struct access +{ + static float get(point const& p) { return p.y; } +}; + + +}}} // namespace bg::traits + +int main() +{ + point p1; + const point p2; + test::function_requiring_a_point(p1, p2); + return 0; +} -- cgit v1.2.3