Merge pull request #1364 from sloriot/CGAL-replace_assert

Replace assert by CGAL_assertion in CGAL code
This commit is contained in:
Laurent Rineau 2016-08-29 12:32:01 +02:00 committed by GitHub
commit a3ffae35bd
9 changed files with 58 additions and 58 deletions

View File

@ -572,13 +572,13 @@ typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descripto
add_face(InputIterator begin, InputIterator end, OpenMesh::TriMesh_ArrayKernelT<K>& sm)
{
typedef typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_descriptor vertex_descriptor;
assert(begin!= end);
CGAL_assertion(begin!= end);
vertex_descriptor u = *begin;
++begin;
assert(begin!= end);
CGAL_assertion(begin!= end);
vertex_descriptor v = *begin;
++begin;
assert(begin!= end);
CGAL_assertion(begin!= end);
vertex_descriptor w = *begin;
return sm.add_face(u,v,w);

View File

@ -137,7 +137,7 @@ BigFloatRep::BigFloatRep(double d) : m(0), err(0), exp(0) {
stop++;
}
#ifdef CORE_DEBUG
assert (s >= 0);
CGAL_assertion (s >= 0);
#endif
if (s)
@ -277,7 +277,7 @@ void BigFloatRep::normal() {
long f = chunkFloor(--le); // f is roughly equal to floor(le/CHUNK_BIT)
long bits_f = bits(f); // f chunks will have bits_f many bits
#ifdef CORE_DEBUG
assert (bits_f >= 0);
CGAL_assertion (bits_f >= 0);
#endif
m >>= bits_f; // reduce mantissa by bits_f many bits
@ -305,7 +305,7 @@ void BigFloatRep::bigNormal(BigInt& bigErr) {
long f = chunkFloor(--le);
long bits_f = bits(f);
#ifdef CORE_DEBUG
assert(bits_f >= 0);
CGAL_assertion(bits_f >= 0);
#endif
m >>= bits_f;
@ -684,7 +684,7 @@ void BigFloatRep::sqrt(const BigFloatRep& x, const extLong& a, const BigFloat& A
m = chunkShift(z.m, chunkCeil(p));
long r = CHUNK_BIT - 1 - (p + CHUNK_BIT - 1) % CHUNK_BIT;
#ifdef CORE_DEBUG
assert(r >= 0);
CGAL_assertion(r >= 0);
#endif
err = 1 >> r;
@ -727,7 +727,7 @@ void BigFloatRep::sqrt(const BigFloatRep& x, const extLong& a, const BigFloat& A
m = chunkShift(z.m, chunkCeil(q));
long r = CHUNK_BIT - 1 - (q + CHUNK_BIT - 1) % CHUNK_BIT;
#ifdef CORE_DEBUG
assert(r >= 0);
CGAL_assertion(r >= 0);
#endif
err = 1 >> r;
@ -961,7 +961,7 @@ BigFloatRep::toDecimal(unsigned int width, bool Scientific) const {
decOut.isScientific = false;
}
#ifdef CORE_DEBUG
assert(decOut.noSignificant >= 0);
CGAL_assertion(decOut.noSignificant >= 0);
#endif
decOut.rep = decRep;
@ -1025,7 +1025,7 @@ void BigFloatRep :: fromString(const char *str, const extLong & prec ) {
else {
e = str + strlen(str);
#ifdef CORE_DEBUG
assert(*e == '\0');
CGAL_assertion(*e == '\0');
#endif
}
@ -1116,7 +1116,7 @@ std::istream& BigFloatRep :: operator >>(std::istream& i) {
size *= 2;
}
#ifdef CORE_DEBUG
assert((p-str) < size);
CGAL_assertion((p-str) < size);
#endif
*p++ = c;
@ -1142,7 +1142,7 @@ std::istream& BigFloatRep :: operator >>(std::istream& i) {
}
#ifdef CORE_DEBUG
assert(p - str < size);
CGAL_assertion(p - str < size);
#endif
*p = '\0';
@ -1229,7 +1229,7 @@ BigInt BigFloatRep::toBigInt() const {
if (le == -1)
le = 0;
#ifdef CORE_DEBUG
assert (le >= 0);
CGAL_assertion (le >= 0);
#endif
BigInt M = m >> static_cast<unsigned long>(le); // discard the contaminated bits.
@ -1249,7 +1249,7 @@ long BigFloatRep :: toLong() const {
long e2 = bits(exp);
long le = clLg(err);
#ifdef CORE_DEBUG
assert (le >= 0);
CGAL_assertion (le >= 0);
#endif
BigInt M = m >> static_cast<unsigned long>(le); // discard the contaminated bits.

View File

@ -130,7 +130,7 @@ BigInt floor(const Expr& e, Expr &sub) {
++sub, --f;
if (sub>=1)
--sub, ++f;
assert(sub >=0 && sub<1); // got an assertion error? (Chee 3/24/04)
CGAL_assertion(sub >=0 && sub<1); // got an assertion error? (Chee 3/24/04)
return f;
}
@ -241,7 +241,7 @@ extLong ExprRep::computeBound() {
std::cerr << " ourBd is the winner " << std::endl;
}
assert(number_of_winners >= 1);
CGAL_assertion(number_of_winners >= 1);
if (number_of_winners == 1) {
if (bd == bfmsskBd) {

View File

@ -126,7 +126,7 @@ void MemoryPool< T, nObjects >::free(void* t) {
if(blocks.empty()){
std::cerr << typeid(T).name() << std::endl;
}
assert (! blocks.empty());
CGAL_assertion (! blocks.empty());
// recycle the object memory, by putting it back into the chain
reinterpret_cast<Thunk*>(t)->next = head;

View File

@ -65,7 +65,7 @@ BigInt floor(const Real& r, Real &sub) {
++sub, --f;
if (sub>=1)
--sub, ++f;
assert(sub >=0 && sub<1);
CGAL_assertion(sub >=0 && sub<1);
return f;
}
@ -145,7 +145,7 @@ void Real::constructFromString(const char *str, const extLong& prec )
else {
e = str + std::strlen(str);
#ifdef CORE_DEBUG
assert(*e == '\0');
CGAL_assertion(*e == '\0');
#endif
}
@ -246,7 +246,7 @@ std::istream& operator >>(std::istream& i, Real& x) {
size *= 2;
}
#ifdef CORE_DEBUG
assert((p-str) < size);
CGAL_assertion((p-str) < size);
#endif
*p++ = c;
@ -276,7 +276,7 @@ std::istream& operator >>(std::istream& i, Real& x) {
}
#ifdef CORE_DEBUG
assert(p - str < size);
CGAL_assertion(p - str < size);
#endif
*p = '\0';

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

@ -244,12 +244,12 @@ polylines_to_protect(const CGAL::Image_3& cgal_image,
//
switch(pixel_values_set.size()) {
case 4: {
assert(get<2>(square[0][0]) != get<2>(square[0][1]));
assert(get<2>(square[0][0]) != get<2>(square[1][0]));
assert(get<2>(square[0][0]) != get<2>(square[1][1]));
assert(get<2>(square[1][0]) != get<2>(square[1][1]));
assert(get<2>(square[0][1]) != get<2>(square[1][1]));
assert(get<2>(square[0][1]) != get<2>(square[1][0]));
CGAL_assertion(get<2>(square[0][0]) != get<2>(square[0][1]));
CGAL_assertion(get<2>(square[0][0]) != get<2>(square[1][0]));
CGAL_assertion(get<2>(square[0][0]) != get<2>(square[1][1]));
CGAL_assertion(get<2>(square[1][0]) != get<2>(square[1][1]));
CGAL_assertion(get<2>(square[0][1]) != get<2>(square[1][1]));
CGAL_assertion(get<2>(square[0][1]) != get<2>(square[1][0]));
case_4:
// case 4 or case 2-2
++case4;
@ -273,10 +273,10 @@ case_4:
}
if(get<2>(square[0][1]) == get<2>(square[1][0])) {
// diagonal case 1-2-1
assert(get<2>(square[0][1]) == get<2>(square[1][0]));
assert(get<2>(square[1][1]) != get<2>(square[0][0]));
assert(get<2>(square[0][1]) != get<2>(square[0][0]));
assert(get<2>(square[0][1]) != get<2>(square[1][1]));
CGAL_assertion(get<2>(square[0][1]) == get<2>(square[1][0]));
CGAL_assertion(get<2>(square[1][1]) != get<2>(square[0][0]));
CGAL_assertion(get<2>(square[0][1]) != get<2>(square[0][0]));
CGAL_assertion(get<2>(square[0][1]) != get<2>(square[1][1]));
++case121;
vertex_descriptor left = g_manip.split(p00, p01, out00, out01);
vertex_descriptor right = g_manip.split(p10, p11, out10, out11);
@ -323,10 +323,10 @@ case_4:
std::swap(square[0][0], square[1][0]); std::swap(out00, out10);
std::swap(square[0][1], square[1][1]); std::swap(out01, out11);
}
assert(get<2>(square[0][0]) == get<2>(square[0][1]));
assert(get<2>(square[0][0]) != get<2>(square[1][0]));
assert(get<2>(square[0][0]) != get<2>(square[1][1]));
assert(get<2>(square[1][0]) != get<2>(square[1][1]));
CGAL_assertion(get<2>(square[0][0]) == get<2>(square[0][1]));
CGAL_assertion(get<2>(square[0][0]) != get<2>(square[1][0]));
CGAL_assertion(get<2>(square[0][0]) != get<2>(square[1][1]));
CGAL_assertion(get<2>(square[1][0]) != get<2>(square[1][1]));
++case211;
Point_3 midleft = midpoint(p00, p01);
Point_3 midright = midpoint(p10, p11);
@ -375,34 +375,34 @@ case_4:
if(get<2>(square[0][0])==get<2>(square[1][0])) {
// case 2-2, diagonal swap
std::swap(square[0][1], square[1][0]); std::swap(out01, out10);
assert(get<2>(square[0][0])==get<2>(square[0][1]));
CGAL_assertion(get<2>(square[0][0])==get<2>(square[0][1]));
}
if(get<2>(square[1][0])==get<2>(square[1][1])) {
// case 2-2, vertical swap
std::swap(square[0][1], square[1][1]); std::swap(out01, out11);
std::swap(square[0][0], square[1][0]); std::swap(out00, out10);
assert(get<2>(square[0][0])==get<2>(square[0][1]));
CGAL_assertion(get<2>(square[0][0])==get<2>(square[0][1]));
}
if(get<2>(square[0][1])==get<2>(square[1][1])) {
// case 2-2, diagonal swap
std::swap(square[0][0], square[1][1]); std::swap(out00, out11);
assert(get<2>(square[0][0])==get<2>(square[0][1]));
CGAL_assertion(get<2>(square[0][0])==get<2>(square[0][1]));
}
if(get<2>(square[0][0])==get<2>(square[0][1])) {
// vertical case 2-2
++case22;
assert(get<2>(square[1][0])==get<2>(square[1][1]));
assert(get<2>(square[1][0])!=get<2>(square[0][1]));
CGAL_assertion(get<2>(square[1][0])==get<2>(square[1][1]));
CGAL_assertion(get<2>(square[1][0])!=get<2>(square[0][1]));
vertex_descriptor top = g_manip.split(p01, p11, out01, out11);
vertex_descriptor bottom = g_manip.split(p00, p10, out00, out10);
g_manip.try_add_edge(top, bottom);
} else {
// Else diagonal case case 2-2
// Same as the case with 4 colors
assert(get<2>(square[0][0])==get<2>(square[1][1]));
assert(get<2>(square[1][0])==get<2>(square[0][1]));
assert(get<2>(square[0][0])!=get<2>(square[0][1]));
CGAL_assertion(get<2>(square[0][0])==get<2>(square[1][1]));
CGAL_assertion(get<2>(square[1][0])==get<2>(square[0][1]));
CGAL_assertion(get<2>(square[0][0])!=get<2>(square[0][1]));
goto case_4;
}
}
@ -412,33 +412,33 @@ case_4:
if(pixel_values_set.begin()->second == 1) {
value_alone = pixel_values_set.begin()->first;
} else {
assert(pixel_values_set.begin()->second == 3);
assert(pixel_values_set.rbegin()->second ==1);
CGAL_assertion(pixel_values_set.begin()->second == 3);
CGAL_assertion(pixel_values_set.rbegin()->second ==1);
value_alone = pixel_values_set.rbegin()->first;
}
if(get<2>(square[0][1]) == value_alone) {
// central symmetry
std::swap(square[0][1], square[1][0]); std::swap(out01, out10);
std::swap(square[0][0], square[1][1]); std::swap(out00, out11);
assert(get<2>(square[1][0]) == value_alone);
CGAL_assertion(get<2>(square[1][0]) == value_alone);
}
if(get<2>(square[1][1]) == value_alone) {
// vertical swap
std::swap(square[0][0], square[0][1]); std::swap(out00, out01);
std::swap(square[1][0], square[1][1]); std::swap(out10, out11);
assert(get<2>(square[1][0]) == value_alone);
CGAL_assertion(get<2>(square[1][0]) == value_alone);
}
if(get<2>(square[0][0]) == value_alone) {
// horizontal swap
std::swap(square[0][1], square[1][1]); std::swap(out01, out11);
std::swap(square[0][0], square[1][0]); std::swap(out00, out10);
assert(get<2>(square[1][0]) == value_alone);
CGAL_assertion(get<2>(square[1][0]) == value_alone);
}
++case31;
assert(get<2>(square[1][0]) == value_alone);
assert(get<2>(square[1][0]) != get<2>(square[0][0]));
assert(get<2>(square[1][1]) == get<2>(square[0][0]));
assert(get<2>(square[0][1]) == get<2>(square[0][0]));
CGAL_assertion(get<2>(square[1][0]) == value_alone);
CGAL_assertion(get<2>(square[1][0]) != get<2>(square[0][0]));
CGAL_assertion(get<2>(square[1][1]) == get<2>(square[0][0]));
CGAL_assertion(get<2>(square[0][1]) == get<2>(square[0][0]));
vertex_descriptor bottom = g_manip.split(p00, p10, out00, out10);
vertex_descriptor old = bottom;

View File

@ -351,7 +351,7 @@ public:
{
internal::Ply_read_typed_number<Type>*
reader = dynamic_cast<internal::Ply_read_typed_number<Type>*>(m_readers[i]);
assert (reader != NULL);
CGAL_assertion (reader != NULL);
t = reader->buffer();
return;
}
@ -389,7 +389,7 @@ public:
{
internal::Ply_read_typed_number<float>*
reader_float = dynamic_cast<internal::Ply_read_typed_number<float>*>(m_readers[i]);
assert (reader_float != NULL);
CGAL_assertion (reader_float != NULL);
t = reader_float->buffer();
}
else

View File

@ -2534,7 +2534,7 @@ private: //------------------------------------------------------- private data
std::string off;
is >> sm_skip_comments;
is >> off;
assert( (off == "OFF") || (off == "COFF") || (off == "NOFF") || (off == "CNOFF"));
CGAL_assertion( (off == "OFF") || (off == "COFF") || (off == "NOFF") || (off == "CNOFF"));
is >> n >> f >> e;