Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60550 - sandbox/geometry/libs/geometry/test/algorithms
From: barend.gehrels_at_[hidden]
Date: 2010-03-13 06:44:10


Author: barendgehrels
Date: 2010-03-13 06:44:08 EST (Sat, 13 Mar 2010)
New Revision: 60550
URL: http://svn.boost.org/trac/boost/changeset/60550

Log:
Added tests for reverse/unique
Added:
   sandbox/geometry/libs/geometry/test/algorithms/reverse.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/algorithms/reverse.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/test/algorithms/test_reverse.hpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/algorithms/test_unique.hpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/algorithms/unique.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/algorithms/unique.vcproj (contents, props changed)
Text files modified:
   sandbox/geometry/libs/geometry/test/algorithms/Jamfile.v2 | 2 ++
   sandbox/geometry/libs/geometry/test/algorithms/algorithms_tests.sln | 12 ++++++++++++
   2 files changed, 14 insertions(+), 0 deletions(-)

Modified: sandbox/geometry/libs/geometry/test/algorithms/Jamfile.v2
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/Jamfile.v2 (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/Jamfile.v2 2010-03-13 06:44:08 EST (Sat, 13 Mar 2010)
@@ -27,9 +27,11 @@
     [ run make.cpp ]
     [ run overlaps.cpp ]
     [ run perimeter.cpp ]
+ [ run reverse.cpp ]
     [ run sectionalize.cpp ]
     [ run simplify.cpp ]
     [ run transform.cpp ]
     [ run union.cpp ]
+ [ run unique.cpp ]
     [ run within.cpp ]
     ;

Modified: sandbox/geometry/libs/geometry/test/algorithms/algorithms_tests.sln
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/algorithms_tests.sln (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/algorithms_tests.sln 2010-03-13 06:44:08 EST (Sat, 13 Mar 2010)
@@ -52,6 +52,10 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "difference", "difference.vcproj", "{4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unique", "unique.vcproj", "{104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reverse", "reverse.vcproj", "{14B5DFC5-D511-4D8C-A231-EE90A05687E1}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -162,6 +166,14 @@
                 {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Debug|Win32.Build.0 = Debug|Win32
                 {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Release|Win32.ActiveCfg = Release|Win32
                 {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Release|Win32.Build.0 = Release|Win32
+ {104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}.Debug|Win32.Build.0 = Debug|Win32
+ {104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}.Release|Win32.ActiveCfg = Release|Win32
+ {104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}.Release|Win32.Build.0 = Release|Win32
+ {14B5DFC5-D511-4D8C-A231-EE90A05687E1}.Debug|Win32.ActiveCfg = Debug|Win32
+ {14B5DFC5-D511-4D8C-A231-EE90A05687E1}.Debug|Win32.Build.0 = Debug|Win32
+ {14B5DFC5-D511-4D8C-A231-EE90A05687E1}.Release|Win32.ActiveCfg = Release|Win32
+ {14B5DFC5-D511-4D8C-A231-EE90A05687E1}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Added: sandbox/geometry/libs/geometry/test/algorithms/reverse.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/algorithms/reverse.cpp 2010-03-13 06:44:08 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,52 @@
+// 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 <algorithms/test_reverse.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <test_common/test_point.hpp>
+
+
+template <typename Point>
+void test_all()
+{
+ // Simplex
+ test_geometry<boost::geometry::linestring<Point> >(
+ "LINESTRING(0 0,1 1)",
+ "LINESTRING(1 1,0 0)");
+
+ // Three points, middle should stay the same
+ test_geometry<boost::geometry::linestring<Point> >(
+ "LINESTRING(0 0,1 1,2 2)",
+ "LINESTRING(2 2,1 1,0 0)");
+
+ // Four points
+ test_geometry<boost::geometry::linestring<Point> >(
+ "LINESTRING(0 0,1 1,2 2,3 3)",
+ "LINESTRING(3 3,2 2,1 1,0 0)");
+
+ // Polygon with holes
+ test_geometry<boost::geometry::polygon<Point> >(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0),(7 3,7 6,1 6,1 3,4 3,7 3))",
+ "POLYGON((4 0,2 1,0 2,0 7,4 9,8 7,8 2,4 0),(7 3,4 3,1 3,1 6,7 6,7 3))");
+
+ // Check compilation
+ test_geometry<Point>("POINT(0 0)", "POINT(0 0)");
+
+ test_geometry<boost::geometry::linear_ring<Point> >(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
+ "POLYGON((4 0,2 1,0 2,0 7,4 9,8 7,8 2,4 0))");
+}
+
+int test_main(int, char* [])
+{
+ test_all<boost::geometry::point_xy<int> >();
+ test_all<boost::geometry::point_xy<double> >();
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/test/algorithms/reverse.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/algorithms/reverse.vcproj 2010-03-13 06:44:08 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="reverse"
+ ProjectGUID="{14B5DFC5-D511-4D8C-A231-EE90A05687E1}"
+ RootNamespace="reverse"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\reverse"
+ 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"
+ MinimalRebuild="true"
+ ExceptionHandling="2"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="2"
+ 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)\reverse"
+ 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"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\reverse.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/geometry/libs/geometry/test/algorithms/test_reverse.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/algorithms/test_reverse.hpp 2010-03-13 06:44:08 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,37 @@
+// 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)
+
+#ifndef BOOST_GEOMETRY_TEST_REVERSE_HPP
+#define BOOST_GEOMETRY_TEST_REVERSE_HPP
+
+// Test-functionality, shared between single and multi tests
+
+#include <geometry_test_common.hpp>
+#include <boost/geometry/algorithms/reverse.hpp>
+
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, std::string const& expected)
+{
+ Geometry geometry;
+
+ boost::geometry::read_wkt(wkt, geometry);
+ boost::geometry::reverse(geometry);
+
+ std::ostringstream out;
+ out << boost::geometry::wkt(geometry);
+
+ BOOST_CHECK_MESSAGE(out.str() == expected,
+ "reverse: " << wkt
+ << " expected " << expected
+ << " got " << out.str());
+}
+
+
+#endif

Added: sandbox/geometry/libs/geometry/test/algorithms/test_unique.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/algorithms/test_unique.hpp 2010-03-13 06:44:08 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,37 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2007-2009, 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)
+
+#ifndef BOOST_GEOMETRY_TEST_UNIQUE_HPP
+#define BOOST_GEOMETRY_TEST_UNIQUE_HPP
+
+// Test-functionality, shared between single and multi tests
+
+#include <geometry_test_common.hpp>
+#include <boost/geometry/algorithms/unique.hpp>
+
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, std::string const& expected)
+{
+ Geometry geometry;
+
+ boost::geometry::read_wkt(wkt, geometry);
+ boost::geometry::unique(geometry);
+
+ std::ostringstream out;
+ out << boost::geometry::wkt(geometry);
+
+ BOOST_CHECK_MESSAGE(out.str() == expected,
+ "unique: " << wkt
+ << " expected " << expected
+ << " got " << out.str());
+}
+
+
+#endif

Added: sandbox/geometry/libs/geometry/test/algorithms/unique.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/algorithms/unique.cpp 2010-03-13 06:44:08 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,52 @@
+// 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 <algorithms/test_unique.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+
+
+
+template <typename Point>
+void test_all()
+{
+ test_geometry<boost::geometry::linestring<Point> >(
+ "LINESTRING(0 0,1 1)",
+ "LINESTRING(0 0,1 1)");
+
+ test_geometry<boost::geometry::linestring<Point> >(
+ "LINESTRING(0 0,1 1,1 1)",
+ "LINESTRING(0 0,1 1)");
+
+ test_geometry<boost::geometry::linestring<Point> >(
+ "LINESTRING(0 0,0 0,1 1)",
+ "LINESTRING(0 0,1 1)");
+
+ // Consecutive points
+ test_geometry<boost::geometry::linestring<Point> >(
+ "LINESTRING(0 0,0 0,0 0,0 0,1 1,1 1,1 1)",
+ "LINESTRING(0 0,1 1)");
+
+ // Other types
+ test_geometry<boost::geometry::linear_ring<Point> >(
+ "POLYGON((0 0,0 1,1 1,1 1,1 1,1 0,0 0,0 0))",
+ "POLYGON((0 0,0 1,1 1,1 0,0 0))");
+
+ test_geometry<boost::geometry::polygon<Point> >(
+ "POLYGON((0 0,0 1,1 1,1 1,1 1,1 0,0 0,0 0))",
+ "POLYGON((0 0,0 1,1 1,1 0,0 0))");
+}
+
+
+
+int test_main(int, char* [])
+{
+ test_all<boost::geometry::point_xy<int> >();
+ test_all<boost::geometry::point_xy<double> >();
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/test/algorithms/unique.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/algorithms/unique.vcproj 2010-03-13 06:44:08 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="unique"
+ ProjectGUID="{104D31F9-49BA-4A1A-B84F-0A3AEE3C4DB2}"
+ RootNamespace="unique"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\unique"
+ 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"
+ MinimalRebuild="true"
+ ExceptionHandling="2"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="2"
+ 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)\unique"
+ 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"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\unique.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>


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