Test correctly inexact coefficient types.

The algebraic structure tests are performed following the exactness of
the coefficient type (it was assumed before that the type was exact). If
it is inexact, the polynomial traits are not tested to avoid wrong
errors.
This commit is contained in:
Luis Peñaranda 2014-01-01 11:40:24 -03:00
parent 352b029aab
commit 77da387fe5
2 changed files with 51 additions and 4 deletions

View File

@ -0,0 +1,44 @@
// Copyright (c) 2006-2013 INRIA Nancy-Grand Est (France). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; version 2.1 of the License.
// See the file LICENSE.LGPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author: Luis Peñaranda <luis.penaranda@gmx.com>
#include <CGAL/Test/_test_polynomial_traits_d.h>
namespace CGAL{
// This structure is empty because it will be partially specialized.
template <class Is_exact,class PT>
struct test_ak_polynomial_traits_d{};
template <class PT>
struct test_ak_polynomial_traits_d<CGAL::Tag_true,PT>{
void operator()(const PT& traits){
return test_polynomial_traits_d(traits);
}
};
template <class PT>
struct test_ak_polynomial_traits_d<CGAL::Tag_false,PT>{
void operator()(const PT& traits){
std::cout<<
"\nATTENTION: not testing inexact polynomial traits"<<
std::endl;
return;
}
};
} // namespace CGAL

View File

@ -25,7 +25,7 @@
#include <CGAL/Test/_test_real_embeddable.h>
#include <CGAL/Test/_test_algebraic_structure.h>
#include <CGAL/Test/_test_coercion_traits.h>
#include <CGAL/Test/_test_polynomial_traits_d.h>
#include "_test_ak_polynomial_traits_d.h"
// Test for the Algebraic_kernel syntax
@ -49,14 +49,17 @@ void test_algebraic_kernel_1(const AlgebraicKernel_d_1& ak_1){
{
// check Coefficient
typedef Algebraic_structure_traits<Coefficient> AST;
typedef typename AST::Is_exact Is_exact;
typedef typename AST::Algebraic_category Algebraic_category;
test_algebraic_structure< Coefficient,Algebraic_category,Tag_true>();
test_algebraic_structure< Coefficient,Algebraic_category,Is_exact>();
test_real_embeddable<Coefficient>();
}
{
// check Polynomial_1
typedef Polynomial_traits_d<Polynomial_1> PT;
test_polynomial_traits_d(PT());
typedef Algebraic_structure_traits<Coefficient> CAST;
typedef typename CAST::Is_exact Is_exact;
typedef typename CAST::Algebraic_category Algebraic_category;
test_ak_polynomial_traits_d<Is_exact,PT>()(PT());
// test not possible due to bug in test_algebraic_structure
// div(3,2)=3/2 != 0 in case of Polynomial<Rational>