wrap up Test/_test_coercion_traits.h

move tests for binary functors into test for explicit interoperable 
as they are supposed to
This commit is contained in:
Michael Hemmer 2008-12-09 10:41:01 +00:00
parent 26ce8b5331
commit 959f0738a0
5 changed files with 287 additions and 176 deletions

View File

@ -29,8 +29,121 @@
// These are test functions for the Coercion_traits
CGAL_BEGIN_NAMESPACE
namespace INTERN_COERCION_TRAITS {
// this test implicit interoperable
template< class A, class B, class Type > void test_implicit_interoperable();
template< class FROM, class TO > void test_implicit_interoperable_from_to();
// this is testing explicit interoperability only
template <class A, class B, class Type> void test_explicit_interoperable();
template <class FROM, class TO> void test_explicit_interoperable_from_to();
namespace INTERN_COERCION_TRAITS {
template <typename A, typename B>
void test_implicit_interoperable_for_real_embeddable (CGAL::Tag_false){};
template <typename A, typename B>
void test_implicit_interoperable_for_real_embeddable (CGAL::Tag_true){
// two sided test for interoperability with int
A a;
B b;
a = A(-5);
b = B(-2);
// a < b
assert (!(a == b));
assert ( (a != b));
assert ( (a < b));
assert ( (a <= b));
assert (!(a > b));
assert (!(a >= b));
assert (!(b == a));
assert ( (b != a));
assert (!(b < a));
assert (!(b <= a));
assert ( (b > a));
assert ( (b >= a));
// a > b
a = A(5);
b = B(2);
assert (!(a == b));
assert ( (a != b));
assert (!(a < b));
assert (!(a <= b));
assert ( (a > b));
assert ( (a >= b));
assert (!(b == a));
assert ( (b != a));
assert ( (b < a));
assert ( (b <= a));
assert (!(b > a));
assert (!(b >= a));
// a == b
a = A(3);
b = B(3);
assert ( (a == b));
assert (!(a != b));
assert (!(a < b));
assert ( (a <= b));
assert (!(a > b));
assert ( (a >= b));
assert ( (b == a));
assert (!(b != a));
assert (!(b < a));
assert ( (b <= a));
assert (!(b > a));
assert ( (b >= a));
};
template <typename A, typename B>
void test_implicit_interoperable_for_algebraic_structure
(CGAL::Null_tag){};
template <typename A, typename B>
void test_implicit_interoperable_for_algebraic_structure
(CGAL::Integral_domain_without_division_tag){
typedef CGAL::Coercion_traits<A,B> CT;
typedef typename CT::Type C;
A a(6); B b(2);
assert(a + b == C(8));
assert(a - b == C(4));
assert(a * b == C(12));
assert(b + a == C(8));
assert(b - a == C(-4));
assert(b * a == C(12));
C c;
c = C(4); assert((c+= A(3)) == C(7));
c = C(4); assert((c-= A(3)) == C(1));
c = C(4); assert((c*= A(3)) == C(12));
c = C(4); assert((c+= B(3)) == C(7));
c = C(4); assert((c-= B(3)) == C(1));
c = C(4); assert((c*= B(3)) == C(12));
};
template <typename A, typename B>
void test_implicit_interoperable_for_algebraic_structure
(CGAL::Field_tag){
test_implicit_interoperable_for_algebraic_structure<A,B>
(CGAL::Integral_domain_without_division_tag());
typedef CGAL::Coercion_traits<A,B> CT;
typedef typename CT::Type C;
A a(6); B b(2);
assert(a / b == C(3));
assert(b / a == C(2)/C(6));
C c;
c = C(4); assert((c /= A(2)) == C(2));
c = C(4); assert((c /= B(2)) == C(2));
};
template< class A, class B, class Type, class Compare >
class Test_compare {
@ -163,18 +276,15 @@ class Test_mod< A, B, Type, CGAL::Null_functor > {
};
template< class Type >
void test_implicit_construction( Type a ) {
(void)a;
}
template< class Type > void test_implicit_construction(Type) {}
template< class A, class B, class Type, class Are_implicit_interoperable >
class Implicit_interoperability_test {
class Implicit_test_implicit_interoperable {
public:
void operator()() {
// test implicit construction
// enforce implicit construction from A/B to Type
// Results in 'no matching function for call to...' compile error, if type Type
// is not implicit constructable from A and B (which is part of the concept)
// is not implicit constructable from A and B (which is part of the concept)
test_implicit_construction<Type>(A(1));
test_implicit_construction<Type>(B(2));
@ -185,88 +295,87 @@ class Implicit_interoperability_test {
};
template< class A, class B, class Type >
class Implicit_interoperability_test<A,B,Type, CGAL::Tag_false > {
class Implicit_test_implicit_interoperable<A,B,Type, CGAL::Tag_false > {
public:
void operator()() {}
};
template< class A, class B, class Type >
void interoperability_test_one_way() {
typedef CGAL::Coercion_traits< A, B > CT;
assert((::boost::is_same< typename CT::Are_implicit_interoperable,
CGAL::Tag_true
>::value));
assert((::boost::is_same< typename CT::Type, Type >::value));
void test_implicit_interoperable_one_way() {
// Implicit_interoperability_test
Implicit_interoperability_test< A, B, Type,
typename CT::Are_implicit_interoperable >()();
Test_integral_division< A, B, Type,
typename CGAL::Algebraic_structure_traits<Type>::Integral_division >()();
Test_gcd< A, B, Type,
typename CGAL::Algebraic_structure_traits<Type>::Gcd >()();
typedef CGAL::Coercion_traits<A,B> CT;
typedef typename CT::Type C;
typedef typename CT::Are_implicit_interoperable Are_implicit_interoperable;
Test_div_mod< A, B, Type,
typename CGAL::Algebraic_structure_traits<Type>::Div_mod >()();
Test_div< A, B, Type,
typename CGAL::Algebraic_structure_traits<Type>::Div >()();
Test_mod< A, B, Type,
typename CGAL::Algebraic_structure_traits<Type>::Mod >()();
Test_compare< A, B, Type,
typename CGAL::Real_embeddable_traits<Type>::Compare >()();
BOOST_STATIC_ASSERT(
(::boost::is_same<Are_implicit_interoperable, CGAL::Tag_true>::value));
assert((::boost::is_same<Are_implicit_interoperable, CGAL::Tag_true>::value));
typename CGAL::Real_embeddable_traits<C>::Is_real_embeddable is_real_embeddable;
test_implicit_interoperable_for_real_embeddable<A,B>(is_real_embeddable);
typename CGAL::Algebraic_structure_traits<C>::Algebraic_category category;
test_implicit_interoperable_for_algebraic_structure<A,B>(category);
}
template< class A, class B, class Type >
void interoperability_test() {
interoperability_test_one_way< A, B, Type >();
interoperability_test_one_way< B, A, Type >();
}
template< class FROM, class TO >
void direct_interoperability_from_to_test() {
interoperability_test< FROM, TO, TO >();
}
// test for explicit interoperable types
template <class A, class B, class RT>
void coercion_traits_test_one_way(){
typedef CGAL::Coercion_traits<A,B> CT;
{
typedef typename CT::Type Type;
typename CT::Cast cast;
assert((::boost::is_same<
typename CT::Are_explicit_interoperable,
CGAL::Tag_true
>::value));
assert((::boost::is_same<Type,RT>::value));
A a(3);
B b(3);
RT rt(3);
assert(rt==cast(a));
assert(rt==cast(b));
}
}
template <class A, class B, class Type>
void coercion_traits_test(){
coercion_traits_test_one_way<A,B,Type>();
coercion_traits_test_one_way<B,A,Type>();
// TODO: Is this here OK?
if((::boost::is_same< typename CGAL::Coercion_traits< A, B >::Are_implicit_interoperable,
CGAL::Tag_true
>::value)) {
interoperability_test< A, B, Type >();
}
void test_explicit_interoperable_one_way(){
typedef CGAL::Coercion_traits<A,B> CT;
typedef typename CT::Type Type;
}
template <class FROM, class TO>
void direct_coercion_from_to_test(){
coercion_traits_test<FROM,TO,TO>();
assert(
(::boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value));
assert((::boost::is_same<Type,RT>::value));
typename CT::Cast cast;
A a(3);
B b(3);
RT rt(3);
assert(rt==cast(a));
assert(rt==cast(b));
// Binary Functors should support explicit interoperable types
typedef typename CGAL::Algebraic_structure_traits<Type>::Integral_division Idiv;
Test_integral_division< A, B, Type, Idiv>()();
typedef typename CGAL::Algebraic_structure_traits<Type>::Gcd Gcd;
Test_gcd< A, B, Type, Gcd >()();
typedef typename CGAL::Algebraic_structure_traits<Type>::Div_mod Div_mod;
Test_div_mod< A, B, Type, Div_mod>()();
typedef typename CGAL::Algebraic_structure_traits<Type>::Div Div;
Test_div< A, B, Type, Div >()();
typedef typename CGAL::Algebraic_structure_traits<Type>::Mod Mod;
Test_mod< A, B, Type, Mod >()();
typedef typename CGAL::Real_embeddable_traits<Type>::Compare Compare;
Test_compare< A, B, Type, Compare >()();
}
}// namespace INTERN_COERCION_TRAITS
// this test implicit interoperable
template< class A, class B, class Type >
void test_implicit_interoperable() {
INTERN_COERCION_TRAITS::test_implicit_interoperable_one_way< A, B, Type >();
INTERN_COERCION_TRAITS::test_implicit_interoperable_one_way< B, A, Type >();
INTERN_COERCION_TRAITS::test_explicit_interoperable_one_way<A,B,Type>();
INTERN_COERCION_TRAITS::test_explicit_interoperable_one_way<B,A,Type>();
}
template< class FROM, class TO >
void test_implicit_interoperable_from_to() {
test_implicit_interoperable< FROM, TO, TO >();
}
// this is testing explicit interoperability only
template <class A, class B, class Type>
void test_explicit_interoperable(){
INTERN_COERCION_TRAITS::test_explicit_interoperable_one_way<A,B,Type>();
INTERN_COERCION_TRAITS::test_explicit_interoperable_one_way<B,A,Type>();
}
template <class FROM, class TO>
void test_explicit_interoperable_from_to(){
test_explicit_interoperable<FROM,TO,TO>();
}
CGAL_END_NAMESPACE

View File

@ -36,7 +36,7 @@ void test_coercion_from_to(CGAL::Null_tag, CGAL::Null_tag){};
template<class A> void test_coercion_from_to(A, CGAL::Null_tag){};
template<class B> void test_coercion_from_to(CGAL::Null_tag, B){};
template<class A, class B> void test_coercion_from_to(A, B){
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<A,B>();
CGAL::test_explicit_interoperable_from_to<A,B>();
};
template <class AT>
@ -120,38 +120,38 @@ void check_type_coercion_at(){
template <class AT>
void AT_coercion_test_for_cgal_types_int(){
typedef typename AT::Integer Integer;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Integer>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer,Integer>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer,Interval>();
CGAL::test_explicit_interoperable_from_to<int ,Integer>();
CGAL::test_explicit_interoperable_from_to<Integer,Integer>();
CGAL::test_explicit_interoperable_from_to<Integer,Interval>();
// Quotient
typedef CGAL::Quotient<Integer> Quotient;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Quotient>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<double ,Quotient>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer ,Quotient>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Quotient,Quotient>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Quotient,Interval>();
CGAL::test_explicit_interoperable_from_to<int ,Quotient>();
CGAL::test_explicit_interoperable_from_to<double ,Quotient>();
CGAL::test_explicit_interoperable_from_to<Integer ,Quotient>();
CGAL::test_explicit_interoperable_from_to<Quotient,Quotient>();
CGAL::test_explicit_interoperable_from_to<Quotient,Interval>();
typedef CGAL::Sqrt_extension<Integer, Integer> Extn_1;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Extn_1>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer,Extn_1>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_1 ,Extn_1>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_1,Interval>();
CGAL::test_explicit_interoperable_from_to<int ,Extn_1>();
CGAL::test_explicit_interoperable_from_to<Integer,Extn_1>();
CGAL::test_explicit_interoperable_from_to<Extn_1 ,Extn_1>();
CGAL::test_explicit_interoperable_from_to<Extn_1,Interval>();
typedef CGAL::Sqrt_extension<Extn_1, Extn_1 > Extn_2n;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Extn_2n>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer,Extn_2n>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_1 ,Extn_2n>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_2n,Extn_2n>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_2n,Interval>();
CGAL::test_explicit_interoperable_from_to<int ,Extn_2n>();
CGAL::test_explicit_interoperable_from_to<Integer,Extn_2n>();
CGAL::test_explicit_interoperable_from_to<Extn_1 ,Extn_2n>();
CGAL::test_explicit_interoperable_from_to<Extn_2n,Extn_2n>();
CGAL::test_explicit_interoperable_from_to<Extn_2n,Interval>();
typedef CGAL::Sqrt_extension<Extn_1, Integer> Extn_2d;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Extn_2d>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer,Extn_2d>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_1 ,Extn_2d>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_2d,Extn_2d>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_2d,Interval>();
CGAL::test_explicit_interoperable_from_to<int ,Extn_2d>();
CGAL::test_explicit_interoperable_from_to<Integer,Extn_2d>();
CGAL::test_explicit_interoperable_from_to<Extn_1 ,Extn_2d>();
CGAL::test_explicit_interoperable_from_to<Extn_2d,Extn_2d>();
CGAL::test_explicit_interoperable_from_to<Extn_2d,Interval>();
}
template <class AT>
@ -162,11 +162,11 @@ void AT_coercion_test_for_cgal_types_rat(){
typedef typename AT::Integer Integer;
typedef typename AT::Rational Rational;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Rational>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<double ,Rational>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer ,Rational>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Rational,Rational>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Rational,Interval>();
CGAL::test_explicit_interoperable_from_to<int ,Rational>();
CGAL::test_explicit_interoperable_from_to<double ,Rational>();
CGAL::test_implicit_interoperable_from_to<Integer ,Rational>();
CGAL::test_implicit_interoperable_from_to<Rational,Rational>();
CGAL::test_explicit_interoperable_from_to<Rational,Interval>();
typedef CGAL::Sqrt_extension<Integer , Integer> Extn_1;
@ -174,36 +174,36 @@ void AT_coercion_test_for_cgal_types_rat(){
typedef CGAL::Sqrt_extension<Extn_1 , Integer> Extn_2d;
typedef CGAL::Sqrt_extension<Rational , Integer> Extn_rat_int;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Extn_rat_int>();
// CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<double ,Extn_rat_int>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer ,Extn_rat_int>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Rational ,Extn_rat_int>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_1 ,Extn_rat_int>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_rat_int,Extn_rat_int>();
CGAL::test_explicit_interoperable_from_to<int ,Extn_rat_int>();
// CGAL::test_explicit_interoperable_from_to<double ,Extn_rat_int>();
CGAL::test_explicit_interoperable_from_to<Integer ,Extn_rat_int>();
CGAL::test_explicit_interoperable_from_to<Rational ,Extn_rat_int>();
CGAL::test_explicit_interoperable_from_to<Extn_1 ,Extn_rat_int>();
CGAL::test_explicit_interoperable_from_to<Extn_rat_int,Extn_rat_int>();
typedef CGAL::Sqrt_extension<Rational , Rational> Extn_rat_1;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Extn_rat_1>();
// CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<double ,Extn_rat_1>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer ,Extn_rat_1>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Rational ,Extn_rat_1>();
// CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_1 ,Extn_rat_1>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_rat_1,Extn_rat_1>();
CGAL::test_explicit_interoperable_from_to<int ,Extn_rat_1>();
// CGAL::test_explicit_interoperable_from_to<double ,Extn_rat_1>();
CGAL::test_explicit_interoperable_from_to<Integer ,Extn_rat_1>();
CGAL::test_explicit_interoperable_from_to<Rational ,Extn_rat_1>();
// CGAL::test_explicit_interoperable_from_to<Extn_1 ,Extn_rat_1>();
CGAL::test_explicit_interoperable_from_to<Extn_rat_1,Extn_rat_1>();
typedef CGAL::Sqrt_extension<Extn_rat_1, Extn_rat_1 > Extn_rat_2n;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Extn_rat_2n>();
// CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<double ,Extn_rat_2n>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer ,Extn_rat_2n>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Rational ,Extn_rat_2n>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_rat_1 ,Extn_rat_2n>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_rat_2n ,Extn_rat_2n>();
CGAL::test_explicit_interoperable_from_to<int ,Extn_rat_2n>();
// CGAL::test_explicit_interoperable_from_to<double ,Extn_rat_2n>();
CGAL::test_explicit_interoperable_from_to<Integer ,Extn_rat_2n>();
CGAL::test_explicit_interoperable_from_to<Rational ,Extn_rat_2n>();
CGAL::test_explicit_interoperable_from_to<Extn_rat_1 ,Extn_rat_2n>();
CGAL::test_explicit_interoperable_from_to<Extn_rat_2n ,Extn_rat_2n>();
typedef CGAL::Sqrt_extension<Extn_rat_1, Rational> Extn_rat_2d;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Extn_rat_2d>();
// CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<double ,Extn_rat_2d>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer ,Extn_rat_2d>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Rational ,Extn_rat_2d>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_rat_1 ,Extn_rat_2d>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_rat_2d ,Extn_rat_2d>();
CGAL::test_explicit_interoperable_from_to<int ,Extn_rat_2d>();
// CGAL::test_explicit_interoperable_from_to<double ,Extn_rat_2d>();
CGAL::test_explicit_interoperable_from_to<Integer ,Extn_rat_2d>();
CGAL::test_explicit_interoperable_from_to<Rational ,Extn_rat_2d>();
CGAL::test_explicit_interoperable_from_to<Extn_rat_1 ,Extn_rat_2d>();
CGAL::test_explicit_interoperable_from_to<Extn_rat_2d ,Extn_rat_2d>();
}
@ -224,27 +224,27 @@ void AT_coercion_test_for_cgal_types_fws(){
typedef CGAL::Sqrt_extension<Extn_rat_1, Extn_rat_1 > Extn_rat_2n;
typedef CGAL::Sqrt_extension<Extn_rat_1, Rational> Extn_rat_2d;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int ,Real>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<double ,Real>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer ,Real>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Rational ,Real>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_1 ,Real>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_2n ,Real>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_2d ,Real>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_rat_int,Real>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_rat_1 ,Real>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_rat_2n ,Real>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Extn_rat_2d ,Real>();
CGAL::test_explicit_interoperable_from_to<int ,Real>();
CGAL::test_explicit_interoperable_from_to<double ,Real>();
CGAL::test_explicit_interoperable_from_to<Integer ,Real>();
CGAL::test_explicit_interoperable_from_to<Rational ,Real>();
CGAL::test_explicit_interoperable_from_to<Extn_1 ,Real>();
CGAL::test_explicit_interoperable_from_to<Extn_2n ,Real>();
CGAL::test_explicit_interoperable_from_to<Extn_2d ,Real>();
CGAL::test_explicit_interoperable_from_to<Extn_rat_int,Real>();
CGAL::test_explicit_interoperable_from_to<Extn_rat_1 ,Real>();
CGAL::test_explicit_interoperable_from_to<Extn_rat_2n ,Real>();
CGAL::test_explicit_interoperable_from_to<Extn_rat_2d ,Real>();
// direct casts
// Integer;
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Integer,Interval>();
CGAL::test_explicit_interoperable_from_to<Integer,Interval>();
// Rational
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Rational,Interval>();
CGAL::test_explicit_interoperable_from_to<Rational,Interval>();
// Interval
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<Interval,Interval>();
CGAL::test_explicit_interoperable_from_to<Interval,Interval>();
}
// TODO: We have no NT compactified, Matrix, Vector, etc. yet
@ -389,44 +389,44 @@ void test_vector_d(){
int main(){
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<short,int>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<short,long>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<short,long long>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<short,float>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<short,double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<short,long double>();
CGAL::test_implicit_interoperable_from_to<short,int>();
CGAL::test_implicit_interoperable_from_to<short,long>();
CGAL::test_implicit_interoperable_from_to<short,long long>();
CGAL::test_implicit_interoperable_from_to<short,float>();
CGAL::test_implicit_interoperable_from_to<short,double>();
CGAL::test_implicit_interoperable_from_to<short,long double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int,long>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int,long long>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int,float>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int,double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int,long double>();
CGAL::test_implicit_interoperable_from_to<int,long>();
CGAL::test_implicit_interoperable_from_to<int,long long>();
CGAL::test_implicit_interoperable_from_to<int,float>();
CGAL::test_implicit_interoperable_from_to<int,double>();
CGAL::test_implicit_interoperable_from_to<int,long double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<long,long long>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<long,float>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<long,double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<long,long double>();
CGAL::test_implicit_interoperable_from_to<long,long long>();
CGAL::test_implicit_interoperable_from_to<long,float>();
CGAL::test_implicit_interoperable_from_to<long,double>();
CGAL::test_implicit_interoperable_from_to<long,long double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<long long,float>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<long long,double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<long long,long double>();
CGAL::test_implicit_interoperable_from_to<long long,float>();
CGAL::test_implicit_interoperable_from_to<long long,double>();
CGAL::test_implicit_interoperable_from_to<long long,long double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<float,double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<float,long double>();
CGAL::test_implicit_interoperable_from_to<float,double>();
CGAL::test_implicit_interoperable_from_to<float,long double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<double,long double>();
CGAL::test_implicit_interoperable_from_to<double,long double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<short,short>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<int,int>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<long,long>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<long long,long long>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<float,float>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<double,double>();
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<long double,long double>();
CGAL::test_implicit_interoperable_from_to<short,short>();
CGAL::test_implicit_interoperable_from_to<int,int>();
CGAL::test_implicit_interoperable_from_to<long,long>();
CGAL::test_implicit_interoperable_from_to<long long,long long>();
CGAL::test_implicit_interoperable_from_to<float,float>();
CGAL::test_implicit_interoperable_from_to<double,double>();
CGAL::test_implicit_interoperable_from_to<long double,long double>();
// test_compactified();
// test_tendency();

View File

@ -6,7 +6,7 @@
#include <CGAL/Sqrt_extension.h>
#include <CGAL/Test/_test_algebraic_structure.h>
#include <CGAL/Test/_test_real_embeddable.h>
#include <CGAL/Test/_test_implicit_interoperable.h>
#include <CGAL/Test/_test_coercion_traits.h>
#include <CGAL/convert_to_bfi.h>
#include <cstdlib>
@ -372,7 +372,8 @@ void general_test(){
EXT1 c1((NT)7 ,(NT)-11,(ROOT)17);
CGAL::test_algebraic_structure<EXT1,Algebraic_type,Is_exact>(a1,b1,c1);
CGAL::test_real_embeddable<EXT1>();
CGAL::test_implicit_interoperable<EXT1,int>();
CGAL::test_implicit_interoperable<int,EXT1,EXT1>();
CGAL::test_implicit_interoperable<NT ,EXT1,EXT1>();
typedef CGAL::Sqrt_extension<EXT1,ROOT> EXT2;
EXT2 a2(b1 ,a1 ,(ROOT)19);
@ -720,7 +721,7 @@ void sqrt_extension_test(){
int main(){
#ifdef CGAL_USE_CORE
sqrt_extension_test<CGAL::CORE_arithmetic_kernel>();
#endif // CGAL_USE_CORE
#endif // CGAL_USE_CORE
return 0;
}

View File

@ -6,7 +6,7 @@
#include <CGAL/Sqrt_extension.h>
#include <CGAL/Test/_test_algebraic_structure.h>
#include <CGAL/Test/_test_real_embeddable.h>
#include <CGAL/Test/_test_implicit_interoperable.h>
#include <CGAL/Test/_test_coercion_traits.h>
#include <CGAL/convert_to_bfi.h>
#include <cstdlib>
@ -372,7 +372,8 @@ void general_test(){
EXT1 c1((NT)7 ,(NT)-11,(ROOT)17);
CGAL::test_algebraic_structure<EXT1,Algebraic_type,Is_exact>(a1,b1,c1);
CGAL::test_real_embeddable<EXT1>();
CGAL::test_implicit_interoperable<EXT1,int>();
CGAL::test_implicit_interoperable<int,EXT1,EXT1>();
CGAL::test_implicit_interoperable<NT ,EXT1,EXT1>();
typedef CGAL::Sqrt_extension<EXT1,ROOT> EXT2;
EXT2 a2(b1 ,a1 ,(ROOT)19);

View File

@ -12,7 +12,7 @@
#include <CGAL/Test/_test_coercion_traits.h>
template<class A, class B> void test_coercion_from_to(A, B){
CGAL::INTERN_COERCION_TRAITS::direct_coercion_from_to_test<A,B>();
CGAL::test_explicit_interoperable<A,B,B>();
};
template <typename AK>