- Replacement of assert() by CGAL_assertion()
This commit is contained in:
Maxime Gimeno 2015-10-29 10:39:53 +01:00
parent bed84e6234
commit 864c95ae08
4 changed files with 31 additions and 30 deletions

View File

@ -25,6 +25,7 @@
#endif
#include <CGAL/gl.h>
#include <CGAL/basic.h>
namespace CGAL {
@ -221,7 +222,7 @@ Image_3::read_vtk_image_data(vtkImageData* vtk_image)
std::cerr << "GetNumberOfTuples()=" << vtk_image->GetPointData()->GetScalars()->GetNumberOfTuples()
<< "\nimage->size()=" << dims[0]*dims[1]*dims[2]
<< "\nwdim=" << image->wdim << '\n';
assert(vtk_image->GetPointData()->GetScalars()->GetNumberOfTuples() == dims[0]*dims[1]*dims[2]);
CGAL_assertion(vtk_image->GetPointData()->GetScalars()->GetNumberOfTuples() == dims[0]*dims[1]*dims[2]);
vtk_image->GetPointData()->GetScalars()->ExportToVoidPointer(image->data);
return this->private_read(image);

View File

@ -57,11 +57,11 @@
#include <cassert>
#define CGAL_Polynomial_assertion(x) assert(x)
#define CGAL_Polynomial_assertion(x) CGAL_assertion(x)
// This does not work
#define CGAL_Polynomial_assertion_code(x) x
#define CGAL_Polynomial_precondition(x) assert(x)
#define CGAL_Polynomial_postcondition(x) assert(x)
#define CGAL_Polynomial_precondition(x) CGAL_assertion(x)
#define CGAL_Polynomial_postcondition(x) CGAL_assertion(x)
#define CGAL_Polynomial_expensive_precondition(x)
#define CGAL_Polynomial_expensive_assertion(x)
#define CGAL_Polynomial_expensive_postcondition(x)

View File

@ -59,83 +59,83 @@ void test_root_of_traits(){
Root_of_2 r = ftd(make_root_of_2(T(0),T(-1),T(2))); //-sqrt(2)
Root_of_2 rl = ftd(make_root_of_2(T(1),T(0),T(-2),true)); //-sqrt(2);
Root_of_2 rr = ftd(make_root_of_2(T(1),T(0),T(-2),false)); //+sqrt(2)
assert(r == rl);
assert(rl != rr);
CGAL_assertion(r == rl);
CGAL_assertion(rl != rr);
assert( ftd(r * Root_of_1(2)) == ftd(make_root_of_2(T(0),T(-2),T(2))));
assert( ftd(r * T(2)) == ftd(make_root_of_2(T(0),T(-2),T(2))));
CGAL_assertion( ftd(r * Root_of_1(2)) == ftd(make_root_of_2(T(0),T(-2),T(2))));
CGAL_assertion( ftd(r * T(2)) == ftd(make_root_of_2(T(0),T(-2),T(2))));
}{
Root_of_2 r = ftd(CGAL::make_root_of_2(T(0),T(-1),T(2))); //-sqrt(2)
Root_of_2 rl = ftd(CGAL::make_root_of_2(T(1),T(0),T(-2),true)); //-sqrt(2);
Root_of_2 rr = ftd(CGAL::make_root_of_2(T(1),T(0),T(-2),false)); //+sqrt(2)
assert(r == rl);
assert(rl != rr);
assert( ftd(r * Root_of_1(2)) == ftd(CGAL::make_root_of_2(T(0),T(-2),T(2))));
assert( ftd(r * T(2)) == ftd(CGAL::make_root_of_2(T(0),T(-2),T(2))));
CGAL_assertion(r == rl);
CGAL_assertion(rl != rr);
CGAL_assertion( ftd(r * Root_of_1(2)) == ftd(CGAL::make_root_of_2(T(0),T(-2),T(2))));
CGAL_assertion( ftd(r * T(2)) == ftd(CGAL::make_root_of_2(T(0),T(-2),T(2))));
}
{
Root_of_2 r = ftd(make_sqrt(T(2))); //sqrt(2)
Root_of_2 rr = ftd(make_root_of_2(T(1),T(0),T(-2),false)); //+sqrt(2)
assert(r == rr);
CGAL_assertion(r == rr);
}{
Root_of_2 r = ftd(CGAL::make_sqrt(T(2))); //sqrt(2)
Root_of_2 rr = ftd(CGAL::make_root_of_2(T(1),T(0),T(-2),false)); //+sqrt(2)
assert(r == rr);
CGAL_assertion(r == rr);
}
{
Root_of_2 r = ftd(inverse(ftd(CGAL::make_sqrt(T(2)))));
Root_of_2 rr = ftd(1/ftd(CGAL::make_sqrt(T(2))));
assert(r == rr);
CGAL_assertion(r == rr);
}{
Root_of_2 r = ftd(CGAL::inverse(ftd(CGAL::make_sqrt(T(2)))));
Root_of_2 rr = ftd(1/ftd(CGAL::make_sqrt(T(2))));
assert(r == rr);
CGAL_assertion(r == rr);
}
{
Root_of_2 r = ftd(square(ftd(CGAL::make_sqrt(T(2)))));
Root_of_2 rr = ftd(ftd(CGAL::make_sqrt(T(2)))*ftd(CGAL::make_sqrt(T(2))));
assert(r == rr);
CGAL_assertion(r == rr);
}{
Root_of_2 r = ftd(CGAL::square(ftd(CGAL::make_sqrt(T(2)))));
Root_of_2 rr = ftd(ftd(CGAL::make_sqrt(T(2)))*ftd(CGAL::make_sqrt(T(2))));
assert(r == rr);
CGAL_assertion(r == rr);
}
bool is_not_exact = !CGAL::Algebraic_structure_traits<T>::Is_exact::value;
{
std::vector<Root_of_2> roots;
CGAL::compute_roots_of_2(T(1),T(0),T(-2),std::back_inserter(roots));
assert(roots.size()==2);
assert(roots[0]==-CGAL::make_sqrt(T(2)) || is_not_exact );
assert(roots[1]== CGAL::make_sqrt(T(2)) || is_not_exact );
CGAL_assertion(roots.size()==2);
CGAL_assertion(roots[0]==-CGAL::make_sqrt(T(2)) || is_not_exact );
CGAL_assertion(roots[1]== CGAL::make_sqrt(T(2)) || is_not_exact );
}
{
Root_of_2 roots[2]= {Root_of_2(1),Root_of_2(1)};
CGAL::compute_roots_of_2(T(13),T(4),T(-23),roots);
assert(roots[0]==CGAL::make_root_of_2(T(13),T(4),T(-23),true) || is_not_exact );
assert(roots[1]==CGAL::make_root_of_2(T(13),T(4),T(-23),false) || is_not_exact );
CGAL_assertion(roots[0]==CGAL::make_root_of_2(T(13),T(4),T(-23),true) || is_not_exact );
CGAL_assertion(roots[1]==CGAL::make_root_of_2(T(13),T(4),T(-23),false) || is_not_exact );
}
{
std::vector<Root_of_2> roots;
CGAL::compute_roots_of_2(T(1),T(-6),T(9),std::back_inserter(roots));
assert(roots.size()==1);
assert(roots[0]==Root_of_2(3) || is_not_exact );
CGAL_assertion(roots.size()==1);
CGAL_assertion(roots[0]==Root_of_2(3) || is_not_exact );
}
{
std::vector<Root_of_2> roots;
CGAL::compute_roots_of_2(T(1),T(0),T(2),std::back_inserter(roots));
assert(roots.size()==0);
CGAL_assertion(roots.size()==0);
}
{
std::vector<Root_of_2> roots;
CGAL::compute_roots_of_2(T(0),T(2),T(3),std::back_inserter(roots));
assert(roots.size()==1);
assert(roots[0]==-Root_of_2(3)/Root_of_2(2) || is_not_exact );
CGAL_assertion(roots.size()==1);
CGAL_assertion(roots[0]==-Root_of_2(3)/Root_of_2(2) || is_not_exact );
}
}

View File

@ -712,7 +712,7 @@ detect_bubbles(FT border_angle) {
{
unsigned int i0 = (i + j + 1)%4;
unsigned int i1 = (i + (j+1)%3 + 1)%4;
assert (i0 != i && i1 != i);
CGAL_assertion (i0 != i && i1 != i);
Edge edge (c, i0, i1);
if (_shape->classify (edge) != Shape::REGULAR)