mirror of https://github.com/CGAL/cgal
Add a testsuite for Epick
This commit is contained in:
parent
44e6065710
commit
f94122b31b
|
|
@ -27,6 +27,7 @@
|
||||||
#include <CGAL/MP_Float.h>
|
#include <CGAL/MP_Float.h>
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||||
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
|
@ -52,9 +53,12 @@
|
||||||
|
|
||||||
#include "CGAL/_test_mf_plane_3_to_2d.h"
|
#include "CGAL/_test_mf_plane_3_to_2d.h"
|
||||||
|
|
||||||
|
template <typename Cls>
|
||||||
|
void test();
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
CGAL::force_ieee_double_precision();
|
||||||
typedef CGAL::Cartesian<double> Clsdb;
|
typedef CGAL::Cartesian<double> Clsdb;
|
||||||
typedef CGAL::Filtered_kernel<Clsdb> Clsd;
|
typedef CGAL::Filtered_kernel<Clsdb> Clsd;
|
||||||
|
|
||||||
|
|
@ -71,6 +75,13 @@ main()
|
||||||
std::cout << "Testing IO with F_k<Cartesian<double>>:" << std::endl;
|
std::cout << "Testing IO with F_k<Cartesian<double>>:" << std::endl;
|
||||||
_test_io( Clsd() );
|
_test_io( Clsd() );
|
||||||
|
|
||||||
|
std::cout << "Testing with Epick:\n";
|
||||||
|
test<Cls>();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Cls>
|
||||||
|
void test() {
|
||||||
std::cout << "Testing 2d :";
|
std::cout << "Testing 2d :";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
_test_2( Cls() );
|
_test_2( Cls() );
|
||||||
|
|
@ -101,6 +112,4 @@ main()
|
||||||
std::cout << "Testing 3d-2d :";
|
std::cout << "Testing 3d-2d :";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
_test_mf_plane_3_to_2d( Cls() );
|
_test_mf_plane_3_to_2d( Cls() );
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
#ifndef CGAL_TESTSUITE_APPROX_EQUAL_H
|
||||||
|
#define CGAL_TESTSUITE_APPROX_EQUAL_H
|
||||||
|
#include <boost/math/special_functions/next.hpp>
|
||||||
|
|
||||||
|
namespace CGAL {
|
||||||
|
namespace testsuite {
|
||||||
|
|
||||||
|
template <typename FT>
|
||||||
|
bool approx_equal(FT a, FT b) { return a == b; }
|
||||||
|
|
||||||
|
bool approx_equal(double a, double b) {
|
||||||
|
return std::abs(boost::math::float_distance(a, b)) <= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Xyz_tag {};
|
||||||
|
struct Xy_tag {};
|
||||||
|
|
||||||
|
template <typename Object>
|
||||||
|
bool approx_equal(Object a, Object b, CGAL::testsuite::Xyz_tag)
|
||||||
|
{
|
||||||
|
return approx_equal(a.x(), b.x()) &&
|
||||||
|
approx_equal(a.y(), b.y()) &&
|
||||||
|
approx_equal(a.z(), b.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Object>
|
||||||
|
bool approx_equal(Object a, Object b, CGAL::testsuite::Xy_tag)
|
||||||
|
{
|
||||||
|
return approx_equal(a.x(), b.x()) && approx_equal(a.y(), b.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Direction_2_tag {};
|
||||||
|
template <typename Object>
|
||||||
|
bool approx_equal(Object a, Object b, CGAL::testsuite::Direction_2_tag)
|
||||||
|
{
|
||||||
|
return CGAL_NTS sign(a.dx()) == CGAL_NTS sign(a.dx())
|
||||||
|
&& CGAL_NTS sign(a.dy()) == CGAL_NTS sign(b.dy())
|
||||||
|
&& approx_equal(a.dx() * b.dy(), a.dy() * b.dx());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end namespace testsuite
|
||||||
|
} // end namespace CGAL
|
||||||
|
|
||||||
|
#endif // CGAL_TESTSUITE_APPROX_EQUAL_H
|
||||||
|
|
@ -31,6 +31,8 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "_approx_equal.h"
|
||||||
|
|
||||||
template <class R>
|
template <class R>
|
||||||
bool
|
bool
|
||||||
_test_fct_weighted_point_2(const R& )
|
_test_fct_weighted_point_2(const R& )
|
||||||
|
|
@ -158,8 +160,9 @@ _test_fct_weighted_point_2(const R& )
|
||||||
|
|
||||||
std::cout << CGAL::weighted_circumcenter(wp_00, wp_10, wp_01) << std::endl;
|
std::cout << CGAL::weighted_circumcenter(wp_00, wp_10, wp_01) << std::endl;
|
||||||
|
|
||||||
assert( CGAL::squared_radius_smallest_orthogonal_circle(wp1, wp3, wp5)
|
using CGAL::testsuite::approx_equal;
|
||||||
== CGAL::squared_radius(p1, p3, p5));
|
assert( approx_equal(CGAL::squared_radius_smallest_orthogonal_circle(wp1, wp3, wp5),
|
||||||
|
CGAL::squared_radius(p1, p3, p5)) );
|
||||||
assert( CGAL::squared_radius_smallest_orthogonal_circle(wp_00, wp_10, wp_01) == RT(0));
|
assert( CGAL::squared_radius_smallest_orthogonal_circle(wp_00, wp_10, wp_01) == RT(0));
|
||||||
|
|
||||||
std::cout << "done" << std::endl;
|
std::cout << "done" << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
#ifndef CGAL__TEST_FURTHER_FCT_POINT_2_H
|
#ifndef CGAL__TEST_FURTHER_FCT_POINT_2_H
|
||||||
#define CGAL__TEST_FURTHER_FCT_POINT_2_H
|
#define CGAL__TEST_FURTHER_FCT_POINT_2_H
|
||||||
|
|
||||||
|
#include "_approx_equal.h"
|
||||||
|
|
||||||
template <class R>
|
template <class R>
|
||||||
bool
|
bool
|
||||||
_test_further_fct_point_2(const R& )
|
_test_further_fct_point_2(const R& )
|
||||||
|
|
@ -95,8 +97,10 @@ _test_further_fct_point_2(const R& )
|
||||||
p4 = p0.transform(rotate4);
|
p4 = p0.transform(rotate4);
|
||||||
p5 = p0.transform(rotate5);
|
p5 = p0.transform(rotate5);
|
||||||
|
|
||||||
|
using CGAL::testsuite::approx_equal;
|
||||||
|
using CGAL::testsuite::Direction_2_tag;
|
||||||
|
|
||||||
assert( (p5 - CGAL::ORIGIN).direction() == dir5 );
|
assert( approx_equal((p5 - CGAL::ORIGIN).direction(), dir5, Direction_2_tag()) );
|
||||||
|
|
||||||
assert( CGAL::side_of_bounded_circle(p1, p2, p3, CGAL::Point_2<R>(CGAL::ORIGIN))\
|
assert( CGAL::side_of_bounded_circle(p1, p2, p3, CGAL::Point_2<R>(CGAL::ORIGIN))\
|
||||||
== CGAL::ON_BOUNDED_SIDE );
|
== CGAL::ON_BOUNDED_SIDE );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue