mv package from experimental to trunk

will replace currently undocumented stuff in NT package
This commit is contained in:
Michael Hemmer
2010-02-11 13:45:57 +00:00
parent 92398770a5
commit fca24ab9f0
16 changed files with 1242 additions and 0 deletions
@@ -0,0 +1,18 @@
#include <iostream>
#include <CGAL/basic.h>
#include <CGAL/Arithmetic_kernel.h>
#if defined(CGAL_HAVE_DEFAULT_ARITHMETIC_KERNEL)
#include <CGAL/Test/_test_arithmetic_kernel.h>
int main() {
typedef CGAL::Arithmetic_kernel AK;
CGAL::test_arithmetic_kernel<AK>();
return 0;
}
#else
int main() { return 0; }
#endif
@@ -0,0 +1,61 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
project( Arithmetic_kernel_test )
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if ( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
endif()
find_package(CGAL QUIET COMPONENTS Core )
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_VersionUtils )
find_package( MPFI )
IS_VERSION_LESS("${CGAL_GMP_VERSION}" "4.2.0" _IS_GMP_VERSION_TO_LOW)
include_directories(../../include)
include_directories(include)
include_directories($ENV{CGAL}/trunk/Number_types/include/)
include_directories($ENV{CGAL}/trunk/Algebraic_foundations/include/)
include_directories($ENV{CGAL}/trunk/Modular_arithmetic/include/)
include_directories($ENV{CGAL}/trunk/Polynomial/include/)
include_directories($ENV{CGAL}/trunk/Number_types/test/Number_types/include/)
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "Arithmetic_kernel.cpp" )
create_single_source_cgal_program( "CORE_arithmetic_kernel.cpp" )
create_single_source_cgal_program( "LEDA_arithmetic_kernel.cpp" )
if( MPFI_FOUND )
# for the testsuite, the version of MPFI shipped with RS is used; this
# version needs GMP>=4.2, so we require this dependency only here and
# not in FindMPFI.cmake
if( _IS_GMP_VERSION_TO_LOW )
message( STATUS
"MPFI tests need GMP>=4.2, some of the tests will not be compiled" )
else( _IS_GMP_VERSION_TO_LOW )
include( ${MPFI_USE_FILE} )
create_single_source_cgal_program( "GMP_arithmetic_kernel.cpp" )
endif( _IS_GMP_VERSION_TO_LOW )
else( MPFI_FOUND )
message( STATUS
"MPFI is not present, some of the tests will not be compiled." )
endif( MPFI_FOUND )
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
endif()
@@ -0,0 +1,17 @@
#include <iostream>
#include <CGAL/basic.h>
#include <CGAL/CORE_arithmetic_kernel.h>
#ifdef CGAL_HAVE_CORE_ARITHMETIC_KERNEL
#include <CGAL/Test/_test_arithmetic_kernel.h>
int main() {
typedef CGAL::CORE_arithmetic_kernel AK;
CGAL::test_arithmetic_kernel<AK>();
return 0;
}
#else
int main() { return 0; }
#endif
@@ -0,0 +1,18 @@
#include <iostream>
#include <CGAL/basic.h>
#include <CGAL/GMP_arithmetic_kernel.h>
#ifdef CGAL_HAVE_GMP_ARITHMETIC_KERNEL
#include <CGAL/Test/_test_arithmetic_kernel.h>
int main() {
std::cout << "TEST GMP_arithmetic_kernel" << std::endl;
typedef CGAL::GMP_arithmetic_kernel AK;
CGAL::test_arithmetic_kernel<AK>();
return 0;
}
#else
int main() { return 0; }
#endif
@@ -0,0 +1,17 @@
#include <iostream>
#include <CGAL/basic.h>
#include <CGAL/LEDA_arithmetic_kernel.h>
#ifdef CGAL_HAVE_LEDA_ARITHMETIC_KERNEL
#include <CGAL/Test/_test_arithmetic_kernel.h>
int main() {
typedef CGAL::LEDA_arithmetic_kernel AK;
CGAL::test_arithmetic_kernel<AK>();
return 0;
}
#else
int main() { return 0; }
#endif
@@ -0,0 +1,33 @@
#include <iostream>
#include <CGAL/basic.h>
#ifdef CGAL_HAVE_GMP_ARITHMETIC_KERNEL
#include <CGAL/Gmpfr_interval.h>
#include <CGAL/Test/_test_algebraic_structure.h>
#include <CGAL/Test/_test_real_embeddable.h>
#include <CGAL/Test/_test_interval.h>
int main() {
std::cout << "TEST Gmpfr_interval "; std::cout.flush();
typedef CGAL::Gmpfr_interval NT;
typedef CGAL::Field_with_sqrt_tag Tag;
typedef CGAL::Tag_false Is_exact;
CGAL::test_algebraic_structure<NT,Tag, Is_exact>();
CGAL::test_algebraic_structure<NT,Tag, Is_exact>(NT(4),NT(6),NT(15));
CGAL::test_algebraic_structure<NT,Tag, Is_exact>(NT(-4),NT(6),NT(15));
CGAL::test_algebraic_structure<NT,Tag, Is_exact>(NT(4),NT(-6),NT(15));
CGAL::test_algebraic_structure<NT,Tag, Is_exact>(NT(-4),NT(-6),NT(15));
CGAL::test_algebraic_structure<NT,Tag, Is_exact>(NT(4),NT(6),NT(-15));
CGAL::test_algebraic_structure<NT,Tag, Is_exact>(NT(-4),NT(6), NT(15));
CGAL::test_algebraic_structure<NT,Tag, Is_exact>(NT(4),NT(-6),NT(-15));
CGAL::test_algebraic_structure<NT,Tag, Is_exact>(NT(-4),NT(-6),NT(-15));
CGAL::test_real_embeddable<NT>();
CGAL::test_interval<NT>();
std::cout << "OK" << std::endl;
return 0;
}
#else
int main() { return 0; }
#endif
@@ -0,0 +1,126 @@
// Copyright (c) 2006-2009 Max-Planck-Institute Saarbruecken (Germany).
// 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(s) : Michael Hemmer <hemmer@mpi-inf.mpg.de>
//
// ============================================================================
//
// \brief provide test for Arithmetic_kernel
//
#ifndef CGAL_TEST_ARITHMETIC_KERNEL_H
#define CGAL_TEST_ARITHMETIC_KERNEL_H
#include <CGAL/basic.h>
#include <CGAL/Test/_test_coercion_traits.h>
CGAL_BEGIN_NAMESPACE
typedef CGAL::Interval_nt<false> Interval;
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::test_explicit_interoperable_from_to<A,B>();
};
template <class ARK>
void test_coercion_arithmetic_kernel(){
typedef typename ARK::Integer Integer;
typedef typename ARK::Rational Rational;
typedef typename ARK::Field_with_sqrt Field_with_sqrt;
typedef typename ARK::Field_with_kth_root Field_with_kth_root;
typedef typename ARK::Field_with_root_of Field_with_root_of;
typedef typename ARK::Bigfloat Bigfloat;
typedef typename ARK::Bigfloat_interval Bigfloat_interval;
test_coercion_from_to(int(),Integer());
test_coercion_from_to(short(),Integer());
test_coercion_from_to(Integer(),Integer());
test_coercion_from_to(int(),Rational());
test_coercion_from_to(short(),Rational());
test_coercion_from_to(float(),Rational());
test_coercion_from_to(double(),Rational());
test_coercion_from_to(Integer(),Rational());
// This is currently not consistent with LEDA and GMP, for CORE it is not even defined.
// test_coercion_from_to(Bigfloat(),Rational());
test_coercion_from_to(Rational(),Rational());
test_coercion_from_to(int(),Field_with_sqrt());
test_coercion_from_to(short(),Field_with_sqrt());
test_coercion_from_to(float(),Field_with_sqrt());
test_coercion_from_to(double(),Field_with_sqrt());
test_coercion_from_to(Integer(),Field_with_sqrt());
test_coercion_from_to(Bigfloat(),Field_with_sqrt());
test_coercion_from_to(Rational(),Field_with_sqrt());
test_coercion_from_to(Field_with_sqrt(),Field_with_sqrt());
test_coercion_from_to(int(),Field_with_kth_root());
test_coercion_from_to(short(),Field_with_kth_root());
test_coercion_from_to(float(),Field_with_kth_root());
test_coercion_from_to(double(),Field_with_kth_root());
test_coercion_from_to(Integer(),Field_with_kth_root());
test_coercion_from_to(Bigfloat(),Field_with_kth_root());
test_coercion_from_to(Rational(),Field_with_kth_root());
test_coercion_from_to(Field_with_sqrt(),Field_with_kth_root());
test_coercion_from_to(Field_with_kth_root(),Field_with_kth_root());
test_coercion_from_to(int(),Field_with_root_of());
test_coercion_from_to(short(),Field_with_root_of());
test_coercion_from_to(float(),Field_with_root_of());
test_coercion_from_to(double(),Field_with_root_of());
test_coercion_from_to(Integer(),Field_with_root_of());
test_coercion_from_to(Bigfloat(),Field_with_root_of());
test_coercion_from_to(Rational(),Field_with_root_of());
test_coercion_from_to(Field_with_sqrt(),Field_with_root_of());
test_coercion_from_to(Field_with_kth_root(),Field_with_root_of());
test_coercion_from_to(Field_with_root_of(),Field_with_root_of());
test_coercion_from_to(int(),Bigfloat());
test_coercion_from_to(short(),Bigfloat());
test_coercion_from_to(float(),Bigfloat());
test_coercion_from_to(double(),Bigfloat());
test_coercion_from_to(Integer(),Bigfloat());
test_coercion_from_to(Bigfloat(),Bigfloat());
test_coercion_from_to(int(),Bigfloat_interval());
test_coercion_from_to(short(),Bigfloat_interval());
test_coercion_from_to(float(),Bigfloat_interval());
test_coercion_from_to(double(),Bigfloat_interval());
test_coercion_from_to(Integer(),Bigfloat_interval());
test_coercion_from_to(Bigfloat(),Bigfloat_interval());
test_coercion_from_to(Rational(),Bigfloat_interval());
test_coercion_from_to(Field_with_sqrt(),Bigfloat_interval());
test_coercion_from_to(Field_with_kth_root(),Bigfloat_interval());
test_coercion_from_to(Field_with_root_of(),Bigfloat_interval());
test_coercion_from_to(Bigfloat_interval(),Bigfloat_interval());
}
template <typename ARK>
void test_arithmetic_kernel(){
test_coercion_arithmetic_kernel<ARK>();
}
CGAL_END_NAMESPACE
#endif // CGAL_TEST_ARITHMETIC_KERNEL_H