1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-22 02:35:23 +03:00
aports/testing/sfcgal/10-remove_cgal_unit_tests.patch
Holger Jaekel 8c84aa4795 testing/sfcgal: new aport
Library for ISO 19107:2013 and OGC SFA 1.2 for 3D operations
https://oslandia.gitlab.io/SFCGAL/index.html
2023-02-09 02:34:20 +01:00

457 lines
14 KiB
Diff

From 74858e42fb91192769d87d6cfb01bce0621b60bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Bartoletti?= <loic.bartoletti@oslandia.com>
Date: Fri, 17 Jun 2022 10:07:34 +0200
Subject: [PATCH] [TEST] Remove CGAL unit test
These tests should be upstream. Fixes #257
---
test/unit/CGAL/AffineTransform3Test.cpp | 87 ------------------
test/unit/CGAL/GmpqTest.cpp | 94 -------------------
test/unit/CGAL/KernelTest.cpp | 67 --------------
test/unit/CGAL/Plane3Test.cpp | 52 -----------
test/unit/CGAL/WorkWithPoint3AsPoint2.cpp | 105 ----------------------
5 files changed, 405 deletions(-)
delete mode 100644 test/unit/CGAL/AffineTransform3Test.cpp
delete mode 100644 test/unit/CGAL/GmpqTest.cpp
delete mode 100644 test/unit/CGAL/KernelTest.cpp
delete mode 100644 test/unit/CGAL/Plane3Test.cpp
delete mode 100644 test/unit/CGAL/WorkWithPoint3AsPoint2.cpp
diff --git a/test/unit/CGAL/AffineTransform3Test.cpp b/test/unit/CGAL/AffineTransform3Test.cpp
deleted file mode 100644
index 56f6c4cd..00000000
--- a/test/unit/CGAL/AffineTransform3Test.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * SFCGAL
- *
- * Copyright (C) 2012-2013 Oslandia <infos@oslandia.com>
- * Copyright (C) 2012-2013 IGN (http://www.ign.fr)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
-
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-#include <boost/test/unit_test.hpp>
-
-#include <CGAL/Cartesian.h>
-#include <CGAL/Point_2.h>
-#include <CGAL/Point_3.h>
-
-#include <cmath>
-
-#include <CGAL/Aff_transformation_3.h>
-
-typedef CGAL::Cartesian< double > Kernel ;
-typedef Kernel::Vector_2 Vector_2 ;
-typedef Kernel::Vector_3 Vector_3 ;
-typedef Kernel::Point_2 Point_2 ;
-typedef Kernel::Point_3 Point_3 ;
-
-
-// always after CGAL
-using namespace boost::unit_test ;
-
-BOOST_AUTO_TEST_SUITE( CGAL_AffineTransform3Test )
-
-/*
- * simple translate
- */
-BOOST_AUTO_TEST_CASE( testTranslate )
-{
- Vector_3 translate( 4.0,5.0,6.0 );
- CGAL::Aff_transformation_3< Kernel > affine( CGAL::TRANSLATION, translate );
-
- /*
- * @warning : translate is not applied on Vector_3!
- */
- Point_3 in( 1.0,2.0,3.0 );
- Point_3 out = affine( in ) ;
- BOOST_CHECK_EQUAL( out.x(), 5.0 );
- BOOST_CHECK_EQUAL( out.y(), 7.0 );
- BOOST_CHECK_EQUAL( out.z(), 9.0 );
-}
-
-/*
- * rotate around Z (PI/2), translate( 3.0, 4.0, 5.0 )
- */
-BOOST_AUTO_TEST_CASE( testRotateAndTranslate )
-{
- /*
- * @warning : translate is not applied on Vector_3!
- */
-
- CGAL::Aff_transformation_3< Kernel > affine(
- 0.0, -1.0, 0.0, 3.0,
- 1.0, 0.0, 0.0, 4.0,
- 0.0, 0.0, 1.0, 5.0/*,
- 0.0, 0.0, 0.0, 1.0*/
- );
- Point_3 in( 1.0,1.0,3.0 );
- Point_3 out = affine( in ) ;
-
- BOOST_CHECK_EQUAL( out.x(), 2.0 ); //-1.0 + 3.0
- BOOST_CHECK_EQUAL( out.y(), 5.0 ); //1.0 + 4.0
- BOOST_CHECK_EQUAL( out.z(), 8.0 ); //3.0 + 5.0
-}
-
-
-
-
-BOOST_AUTO_TEST_SUITE_END()
-
diff --git a/test/unit/CGAL/GmpqTest.cpp b/test/unit/CGAL/GmpqTest.cpp
deleted file mode 100644
index 8016c2be..00000000
--- a/test/unit/CGAL/GmpqTest.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * SFCGAL
- *
- * Copyright (C) 2012-2013 Oslandia <infos@oslandia.com>
- * Copyright (C) 2012-2013 IGN (http://www.ign.fr)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
-
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-#include <iostream>
-
-#include <boost/test/unit_test.hpp>
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Point_2.h>
-#include <CGAL/Point_3.h>
-#include <CGAL/Plane_3.h>
-
-#include <cmath>
-
-
-// always after CGAL
-using namespace boost::unit_test ;
-
-BOOST_AUTO_TEST_SUITE( CGAL_GmpqTest )
-
-/*
- * check that CGAL::Gmpq is flooring results
- */
-BOOST_AUTO_TEST_CASE( testPositiveRationalFloor )
-{
- // 1 / 3 => 0
- {
- CGAL::Gmpq q( 1,3 );
- BOOST_CHECK_EQUAL( q.numerator() / q.denominator(), 0 );
- }
- // 2 / 3 => 0
- {
- CGAL::Gmpq q( 2,3 );
- BOOST_CHECK_EQUAL( q.numerator() / q.denominator(), 0 );
- }
- // 2 / 2 => 1
- {
- CGAL::Gmpq q( 2,2 );
- BOOST_CHECK_EQUAL( q.numerator() / q.denominator(), 1 );
- }
- // 3 / 2 => 1
- {
- CGAL::Gmpq q( 3,2 );
- BOOST_CHECK_EQUAL( q.numerator() / q.denominator(), 1 );
- }
-}
-
-/*
- * check that CGAL::Gmpq is flooring results
- */
-BOOST_AUTO_TEST_CASE( testNegativeRationalFloor )
-{
- // - 1 / 3 => 0
- {
- CGAL::Gmpq q( -1,3 );
- BOOST_CHECK_EQUAL( q.numerator() / q.denominator(), 0 );
- }
- // - 2 / 3 => 0
- {
- CGAL::Gmpq q( -2,3 );
- BOOST_CHECK_EQUAL( q.numerator() / q.denominator(), 0 );
- }
- // - 2 / 2 => 1
- {
- CGAL::Gmpq q( -2,2 );
- BOOST_CHECK_EQUAL( q.numerator() / q.denominator(), -1 );
- }
- // - 3 / 2 => 1
- {
- CGAL::Gmpq q( -3,2 );
- BOOST_CHECK_EQUAL( q.numerator() / q.denominator(), -1 );
- }
-}
-
-
-BOOST_AUTO_TEST_SUITE_END()
-
diff --git a/test/unit/CGAL/KernelTest.cpp b/test/unit/CGAL/KernelTest.cpp
deleted file mode 100644
index dabde245..00000000
--- a/test/unit/CGAL/KernelTest.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * SFCGAL
- *
- * Copyright (C) 2012-2013 Oslandia <infos@oslandia.com>
- * Copyright (C) 2012-2013 IGN (http://www.ign.fr)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
-
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-#include <iostream>
-
-#include <boost/test/unit_test.hpp>
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <CGAL/Point_2.h>
-#include <CGAL/Point_3.h>
-#include <CGAL/Plane_3.h>
-
-#include <cmath>
-
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel ;
-typedef Kernel::Vector_2 Vector_2 ;
-typedef Kernel::Vector_3 Vector_3 ;
-typedef Kernel::Point_2 Point_2 ;
-typedef Kernel::Point_3 Point_3 ;
-typedef Kernel::Segment_2 Segment_2 ;
-typedef Kernel::Segment_3 Segment_3 ;
-
-// always after CGAL
-using namespace boost::unit_test ;
-
-BOOST_AUTO_TEST_SUITE( CGAL_KernelTest )
-
-BOOST_AUTO_TEST_CASE( testIntersectsRobutness )
-{
- Segment_2 ab( Point_2( 0.0,0.0 ) , Point_2( 1.0,3.0 ) );
- Segment_2 cd( Point_2( 0.0,1.0 ) , Point_2( 1.0,1.0 ) );
- Segment_2 ef( Point_2( -1.0,3.0 ), Point_2( 1.0,0.0 ) );
-
- CGAL::Object abIcd_ = CGAL::intersection( ab, cd );
- const Point_2* abIcd = CGAL::object_cast<Point_2>( &abIcd_ ) ;
- BOOST_REQUIRE( abIcd != NULL );
-
- CGAL::Object abIef_ = CGAL::intersection( ab, ef );
- const Point_2* abIef = CGAL::object_cast<Point_2>( &abIef_ ) ;
- BOOST_REQUIRE( abIef != NULL );
-
-// std::cout << (*abIcd) << std::endl;
-// std::cout << (*abIef) << std::endl;
- BOOST_CHECK( ( *abIcd ) == ( *abIef ) ) ;
-}
-
-
-
-BOOST_AUTO_TEST_SUITE_END()
-
diff --git a/test/unit/CGAL/Plane3Test.cpp b/test/unit/CGAL/Plane3Test.cpp
deleted file mode 100644
index 1a4d0688..00000000
--- a/test/unit/CGAL/Plane3Test.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * SFCGAL
- *
- * Copyright (C) 2012-2013 Oslandia <infos@oslandia.com>
- * Copyright (C) 2012-2013 IGN (http://www.ign.fr)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
-
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-#include <boost/test/unit_test.hpp>
-
-#include <CGAL/Cartesian.h>
-#include <CGAL/Point_2.h>
-#include <CGAL/Point_3.h>
-#include <CGAL/Plane_3.h>
-
-#include <cmath>
-
-typedef CGAL::Cartesian< double > Kernel ;
-typedef Kernel::Vector_2 Vector_2 ;
-typedef Kernel::Vector_3 Vector_3 ;
-typedef Kernel::Point_2 Point_2 ;
-typedef Kernel::Point_3 Point_3 ;
-typedef CGAL::Plane_3< Kernel > Plane_3 ;
-
-// always after CGAL
-using namespace boost::unit_test ;
-
-BOOST_AUTO_TEST_SUITE( CGAL_Plane3Test )
-
-BOOST_AUTO_TEST_CASE( testTo2D_UnitNormalForPlane )
-{
- Plane_3 plane( 1.0,0.0,0.0,0.0 );
- BOOST_CHECK_EQUAL( plane.to_2d( Point_3( 1.0,0.0,0.0 ) ), Point_2( 0.0,0.0 ) );
- BOOST_CHECK_EQUAL( plane.to_2d( Point_3( 1.0,0.0,1.0 ) ), Point_2( 0.0,1.0 ) );
- BOOST_CHECK_EQUAL( plane.to_2d( Point_3( 1.0,1.0,1.0 ) ), Point_2( 1.0,1.0 ) );
- BOOST_CHECK_EQUAL( plane.to_2d( Point_3( 1.0,1.0,0.0 ) ), Point_2( 1.0,0.0 ) );
-}
-
-
-BOOST_AUTO_TEST_SUITE_END()
-
diff --git a/test/unit/CGAL/WorkWithPoint3AsPoint2.cpp b/test/unit/CGAL/WorkWithPoint3AsPoint2.cpp
deleted file mode 100644
index 6348a054..00000000
--- a/test/unit/CGAL/WorkWithPoint3AsPoint2.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * SFCGAL
- *
- * Copyright (C) 2012-2013 Oslandia <infos@oslandia.com>
- * Copyright (C) 2012-2013 IGN (http://www.ign.fr)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
-
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-#include <boost/test/unit_test.hpp>
-
-#include <cmath>
-
-#include <CGAL/Cartesian.h>
-
-
-typedef CGAL::Cartesian< double > Kernel ;
-typedef Kernel::Vector_2 Vector_2 ;
-typedef Kernel::Vector_3 Vector_3 ;
-typedef Kernel::Point_2 Point_2 ;
-typedef Kernel::Point_3 Point_3 ;
-typedef CGAL::Segment_2< Kernel > Segment_2 ;
-typedef CGAL::Segment_3< Kernel > Segment_3 ;
-
-// always after CGAL
-using namespace boost::unit_test ;
-
-BOOST_AUTO_TEST_SUITE( CGAL_WorkWithPoint3AsPoint2 )
-
-BOOST_AUTO_TEST_CASE( testIntersect2dSegmentsIn2d )
-{
- Point_2 a( 0.0, 0.0 );
- Point_2 b( 1.0, 1.0 );
- Point_2 c( 1.0, 0.0 );
- Point_2 d( 0.0, 1.0 );
-
- Segment_2 ab( a, b );
- Segment_2 cd( c, d );
-
- CGAL::Object obj = CGAL::intersection( ab, cd );
- const Point_2* p = CGAL::object_cast< Point_2 >( &obj ) ;
- BOOST_REQUIRE( p != NULL );
- BOOST_CHECK_EQUAL( p->x(), 0.5 );
- BOOST_CHECK_EQUAL( p->y(), 0.5 );
-}
-
-BOOST_AUTO_TEST_CASE( testIntersect3dSegmentsIn3d )
-{
- Point_3 a( 0.0, 0.0, 0.0 );
- Point_3 b( 1.0, 1.0, 1.0 );
- Point_3 c( 1.0, 0.0, 0.0 );
- Point_3 d( 0.0, 1.0, 1.0 );
-
- Segment_3 ab( a, b );
- Segment_3 cd( c, d );
-
- CGAL::Object obj = CGAL::intersection( ab, cd );
- const Point_3* p = CGAL::object_cast< Point_3 >( &obj ) ;
- BOOST_REQUIRE( p != NULL );
- BOOST_CHECK_EQUAL( p->x(), 0.5 );
- BOOST_CHECK_EQUAL( p->y(), 0.5 );
- BOOST_CHECK_EQUAL( p->z(), 0.5 );
-}
-
-
-/**
- *
- */
-BOOST_AUTO_TEST_CASE( testIntersect3dSegmentsIn2d )
-{
- Point_3 a( 0.0, 0.0, 0.0 );
- Point_3 b( 1.0, 1.0, 1.0 );
- Point_3 c( 1.0, 0.0, 0.0 );
- Point_3 d( 0.0, 1.0, 1.0 );
-
- Segment_3 ab( a, b );
- Segment_3 cd( c, d );
-
- //TODO : Find the best way to do 2D intersection on 3D segments
-
- /*
- CGAL::Object obj = CGAL::intersection(
-
- );
- const Point_2 *p = CGAL::object_cast< Point_2 >(&obj) ;
- BOOST_REQUIRE( p != NULL );
- BOOST_CHECK_EQUAL( p->x(), 0.5 );
- BOOST_CHECK_EQUAL( p->y(), 0.5 );
- */
-}
-
-
-
-BOOST_AUTO_TEST_SUITE_END()
-
--
GitLab