|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67225 - sandbox/geometry/libs/geometry/test/geometries
From: barend.gehrels_at_[hidden]
Date: 2010-12-13 16:36:34
Author: barendgehrels
Date: 2010-12-13 16:36:32 EST (Mon, 13 Dec 2010)
New Revision: 67225
URL: http://svn.boost.org/trac/boost/changeset/67225
Log:
Added Boost.Range range adaptors adaptions for Boost.Geometry - testcases
Added:
sandbox/geometry/libs/geometry/test/geometries/boost_range.cpp (contents, props changed)
sandbox/geometry/libs/geometry/test/geometries/boost_range.vcproj (contents, props changed)
Text files modified:
sandbox/geometry/libs/geometry/test/geometries/Jamfile.v2 | 1 +
sandbox/geometry/libs/geometry/test/geometries/geometries_tests.sln | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)
Modified: sandbox/geometry/libs/geometry/test/geometries/Jamfile.v2
==============================================================================
--- sandbox/geometry/libs/geometry/test/geometries/Jamfile.v2 (original)
+++ sandbox/geometry/libs/geometry/test/geometries/Jamfile.v2 2010-12-13 16:36:32 EST (Mon, 13 Dec 2010)
@@ -10,6 +10,7 @@
:
[ run boost_array_as_point.cpp ]
[ run boost_polygon.cpp ]
+ [ run boost_range.cpp ]
[ run box.cpp ]
[ compile-fail custom_linestring.cpp
: # requirements
Added: sandbox/geometry/libs/geometry/test/geometries/boost_range.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/geometries/boost_range.cpp 2010-12-13 16:36:32 EST (Mon, 13 Dec 2010)
@@ -0,0 +1,113 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 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 <geometry_test_common.hpp>
+
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/adjacent_filtered.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/filtered.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/reversed.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/strided.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/sliced.hpp>
+#include <boost/geometry/geometries/adapted/boost_range/uniqued.hpp>
+
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+
+#include <sstream>
+
+struct not_two
+{
+ template <typename P>
+ bool operator()(P const& p) const
+ {
+ return boost::geometry::get<0>(p) != 2.0;
+ }
+};
+
+struct sum_not_five
+{
+ template <typename P>
+ bool operator()(P const& p1, P const& p2) const
+ {
+ return boost::geometry::get<0>(p1) + boost::geometry::get<0>(p2) != 5.0;
+ }
+};
+
+
+template <typename P>
+void test_range_adaptor()
+{
+ bg::model::linestring<P> ls;
+ bg::read_wkt("LINESTRING(1 1,2 2,3 3,4 4)", ls);
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls);
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(1 1,2 2,3 3,4 4)");
+ }
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls | boost::adaptors::reversed);
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(4 4,3 3,2 2,1 1)");
+ }
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls | boost::adaptors::strided(2));
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(1 1,3 3)");
+ }
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls | boost::adaptors::sliced(1,3));
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(2 2,3 3)");
+ }
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls | boost::adaptors::filtered(not_two()));
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(1 1,3 3,4 4)");
+ }
+
+ {
+ std::ostringstream out;
+ out << bg::wkt(ls | boost::adaptors::adjacent_filtered(sum_not_five()));
+ BOOST_CHECK_EQUAL(out.str(), "LINESTRING(1 1,3 3,4 4)");
+ }
+
+ {
+ bg::model::linestring<P> ls2;
+ bg::read_wkt("LINESTRING(1 1,1 1,2 2,3 3,3 3,4 4)", ls2);
+ std::ostringstream out;
+
+
+ // uniqued needs == operator, equals
+ //out << bg::wkt(ls | boost::adaptors::uniqued);
+ //BOOST_CHECK_EQUAL(out.str(), "LINESTRING(1 1,2 2,3 3,4 4)");
+ }
+}
+
+template <typename P>
+void test_all()
+{
+ test_range_adaptor<P>();
+}
+
+
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::d2::point_xy<double> >();
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+
+ return 0;
+ }
+
Added: sandbox/geometry/libs/geometry/test/geometries/boost_range.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/geometries/boost_range.vcproj 2010-12-13 16:36:32 EST (Mon, 13 Dec 2010)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="boost_range"
+ ProjectGUID="{8E719071-B525-4F58-832A-AB75FCA8BEA0}"
+ RootNamespace="boost_range"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_range"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_range"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../..;.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\boost_range.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: sandbox/geometry/libs/geometry/test/geometries/geometries_tests.sln
==============================================================================
--- sandbox/geometry/libs/geometry/test/geometries/geometries_tests.sln (original)
+++ sandbox/geometry/libs/geometry/test/geometries/geometries_tests.sln 2010-12-13 16:36:32 EST (Mon, 13 Dec 2010)
@@ -10,6 +10,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_polygon", "boost_polygon.vcproj", "{6809180F-1E31-42B0-8481-67AC8E9B180B}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_range", "boost_range.vcproj", "{8E719071-B525-4F58-832A-AB75FCA8BEA0}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -36,6 +38,10 @@
{6809180F-1E31-42B0-8481-67AC8E9B180B}.Debug|Win32.Build.0 = Debug|Win32
{6809180F-1E31-42B0-8481-67AC8E9B180B}.Release|Win32.ActiveCfg = Release|Win32
{6809180F-1E31-42B0-8481-67AC8E9B180B}.Release|Win32.Build.0 = Release|Win32
+ {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Debug|Win32.Build.0 = Debug|Win32
+ {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Release|Win32.ActiveCfg = Release|Win32
+ {8E719071-B525-4F58-832A-AB75FCA8BEA0}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk