From 77da387fe56352ece9b5af7f5f4360983550034e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pe=C3=B1aranda?= Date: Wed, 1 Jan 2014 11:40:24 -0300 Subject: [PATCH] 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. --- .../CGAL/_test_ak_polynomial_traits_d.h | 44 +++++++++++++++++++ .../include/CGAL/_test_algebraic_kernel_1.h | 11 +++-- 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_ak_polynomial_traits_d.h diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_ak_polynomial_traits_d.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_ak_polynomial_traits_d.h new file mode 100644 index 00000000000..a854deb4142 --- /dev/null +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_ak_polynomial_traits_d.h @@ -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 + +#include + +namespace CGAL{ + +// This structure is empty because it will be partially specialized. +template +struct test_ak_polynomial_traits_d{}; + +template +struct test_ak_polynomial_traits_d{ + void operator()(const PT& traits){ + return test_polynomial_traits_d(traits); + } +}; + +template +struct test_ak_polynomial_traits_d{ + void operator()(const PT& traits){ + std::cout<< + "\nATTENTION: not testing inexact polynomial traits"<< + std::endl; + return; + } +}; + +} // namespace CGAL diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h index 0c000c9f9ce..b75580f4447 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h @@ -25,7 +25,7 @@ #include #include #include -#include +#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 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(); } { // check Polynomial_1 - typedef Polynomial_traits_d PT; - test_polynomial_traits_d(PT()); + typedef Algebraic_structure_traits CAST; + typedef typename CAST::Is_exact Is_exact; + typedef typename CAST::Algebraic_category Algebraic_category; + test_ak_polynomial_traits_d()(PT()); // test not possible due to bug in test_algebraic_structure // div(3,2)=3/2 != 0 in case of Polynomial