mirror of https://github.com/CGAL/cgal
use CGAL_assertion's
This commit is contained in:
parent
e028035776
commit
c76d58d9d7
|
|
@ -18,12 +18,12 @@ void test(const char* file_name) {
|
|||
Polyhedron oriented_poly; // file should contain oriented poly
|
||||
if ( !input || !(input >> oriented_poly) || oriented_poly.empty() ){
|
||||
std::cerr << "Error: can not read file: " << file_name;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
assert(CGAL::Polygon_mesh_processing::is_oriented(oriented_poly));
|
||||
CGAL_assertion(CGAL::Polygon_mesh_processing::is_oriented(oriented_poly));
|
||||
oriented_poly.inside_out();
|
||||
assert(!CGAL::Polygon_mesh_processing::is_oriented(oriented_poly));
|
||||
CGAL_assertion(!CGAL::Polygon_mesh_processing::is_oriented(oriented_poly));
|
||||
|
||||
std::cerr << file_name << " passed the test." << std::endl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ void test(
|
|||
CGAL::Bounded_side res = inside(points[i]);
|
||||
|
||||
if(!on_boundary.empty()) {
|
||||
assert(on_boundary[i] == (res == CGAL::ON_BOUNDARY));
|
||||
CGAL_assertion(on_boundary[i] == (res == CGAL::ON_BOUNDARY));
|
||||
}
|
||||
|
||||
if(res == CGAL::ON_BOUNDED_SIDE) { ++nb_inside; }
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@ void test(const char* fname)
|
|||
{
|
||||
std::cout << "Testing " << fname << "..." << std::flush;
|
||||
std::ifstream input(fname);
|
||||
assert(input);
|
||||
if (!input)
|
||||
CGAL_assertion(false);
|
||||
Polyhedron P;
|
||||
input >> P;
|
||||
|
||||
assert(P.size_of_vertices()!=0);
|
||||
CGAL_assertion(P.size_of_vertices()!=0);
|
||||
|
||||
CGAL::Polygon_mesh_processing::stitch_borders(P);
|
||||
|
||||
|
|
@ -27,7 +28,7 @@ void test(const char* fname)
|
|||
output.close();
|
||||
|
||||
P.normalize_border();
|
||||
assert(P.is_valid(false, 5));
|
||||
CGAL_assertion(P.is_valid(false, 5));
|
||||
std::cout << "OK\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ void read_poly_with_borders(const char* file_name, Polyhedron& poly, std::vector
|
|||
std::ifstream input(file_name);
|
||||
if ( !input || !(input >> poly) || (num_vertices(poly) == 0)){
|
||||
std::cerr << " Error: can not read file." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
std::set<Halfedge_handle> border_map;
|
||||
|
|
@ -113,10 +113,10 @@ void test_triangulate_hole_weight(const char* file_name, bool use_DT) {
|
|||
|
||||
const double epsilon = 1e-10;
|
||||
if(std::abs(w_algo.w.first - w_test.w.first) > epsilon) {
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
if(std::abs(w_algo.w.second - w_test.w.second) > epsilon) {
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -136,13 +136,13 @@ void test_triangulate_hole(const char* file_name) {
|
|||
CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch));
|
||||
if(patch.empty()) {
|
||||
std::cerr << " Error: empty patch created." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!poly.is_valid() || ! is_closed(poly)) {
|
||||
std::cerr << " Error: patched polyhedron is not valid or closed." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
std::cerr << " Done!" << std::endl;
|
||||
|
|
@ -160,13 +160,13 @@ void test_triangulate_hole_should_be_no_output(const char* file_name) {
|
|||
CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch), false);
|
||||
if(!patch.empty()) {
|
||||
std::cerr << " Error: patch should be empty" << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch), true);
|
||||
if(!patch.empty()) {
|
||||
std::cerr << " Error: patch should be empty" << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -188,13 +188,13 @@ void test_triangulate_and_refine_hole(const char* file_name) {
|
|||
|
||||
if(patch_facets.empty()) {
|
||||
std::cerr << " Error: empty patch created." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!poly.is_valid() || ! is_closed(poly)) {
|
||||
std::cerr << " Error: patched polyhedron is not valid or closed." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
std::cerr << " Done!" << std::endl;
|
||||
|
|
@ -215,13 +215,13 @@ void test_triangulate_refine_and_fair_hole(const char* file_name) {
|
|||
|
||||
if(patch_facets.empty()) {
|
||||
std::cerr << " Error: empty patch created." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!poly.is_valid() || ! is_closed(poly)) {
|
||||
std::cerr << " Error: patched polyhedron is not valid or closed." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
std::cerr << " Done!" << std::endl;
|
||||
|
|
@ -249,7 +249,7 @@ void test_ouput_iterators_triangulate_hole(const char* file_name) {
|
|||
if(patch.size() != (output_it - &*patch_2.begin())) {
|
||||
std::cerr << " Error: returned facet output iterator is not valid!" << std::endl;
|
||||
std::cerr << " " << patch.size() << " vs " << (output_it - &*patch_2.begin()) << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
std::cerr << " Done!" << std::endl;
|
||||
|
|
@ -283,13 +283,13 @@ void test_ouput_iterators_triangulate_and_refine_hole(const char* file_name) {
|
|||
if(patch_facets.size() != (output_its.first - &*patch_facets_2.begin())) {
|
||||
std::cerr << " Error: returned facet output iterator is not valid!" << std::endl;
|
||||
std::cerr << " " << patch_facets.size() << " vs " << (output_its.first - &*patch_facets_2.begin()) << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
if(patch_vertices.size() != (output_its.second - &*patch_vertices_2.begin())) {
|
||||
std::cerr << " Error: returned vertex output iterator is not valid!" << std::endl;
|
||||
std::cerr << " " << patch_vertices.size() << " vs " << (output_its.second - &*patch_vertices_2.begin()) << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
std::cerr << " Done!" << std::endl;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void read_poly_with_borders(const char* file_name, Polyhedron& poly, std::vector
|
|||
std::ifstream input(file_name);
|
||||
if ( !input || !(input >> poly) || (num_vertices(poly) == 0)){
|
||||
std::cerr << " Error: can not read file." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
std::set<Halfedge_handle> border_map;
|
||||
|
|
@ -112,10 +112,10 @@ void test_triangulate_hole_weight(const char* file_name, bool use_DT) {
|
|||
|
||||
const double epsilon = 1e-10;
|
||||
if(std::abs(w_algo.w.first - w_test.w.first) > epsilon) {
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
if(std::abs(w_algo.w.second - w_test.w.second) > epsilon) {
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -135,13 +135,13 @@ void test_triangulate_hole(const char* file_name) {
|
|||
CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch));
|
||||
if(patch.empty()) {
|
||||
std::cerr << " Error: empty patch created." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!poly.is_valid() || ! is_closed(poly)) {
|
||||
std::cerr << " Error: patched polyhedron is not valid or closed." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
std::cerr << " Done!" << std::endl;
|
||||
|
|
@ -159,13 +159,13 @@ void test_triangulate_hole_should_be_no_output(const char* file_name) {
|
|||
CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch), false);
|
||||
if(!patch.empty()) {
|
||||
std::cerr << " Error: patch should be empty" << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch), true);
|
||||
if(!patch.empty()) {
|
||||
std::cerr << " Error: patch should be empty" << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -187,13 +187,13 @@ void test_triangulate_and_refine_hole(const char* file_name) {
|
|||
|
||||
if(patch_facets.empty()) {
|
||||
std::cerr << " Error: empty patch created." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!poly.is_valid() || ! is_closed(poly)) {
|
||||
std::cerr << " Error: patched polyhedron is not valid or closed." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
std::cerr << " Done!" << std::endl;
|
||||
|
|
@ -214,13 +214,13 @@ void test_triangulate_refine_and_fair_hole(const char* file_name) {
|
|||
|
||||
if(patch_facets.empty()) {
|
||||
std::cerr << " Error: empty patch created." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!poly.is_valid() || ! is_closed(poly)) {
|
||||
std::cerr << " Error: patched polyhedron is not valid or closed." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
std::cerr << " Done!" << std::endl;
|
||||
|
|
@ -248,7 +248,7 @@ void test_ouput_iterators_triangulate_hole(const char* file_name) {
|
|||
if(patch.size() != (output_it - &*patch_2.begin())) {
|
||||
std::cerr << " Error: returned facet output iterator is not valid!" << std::endl;
|
||||
std::cerr << " " << patch.size() << " vs " << (output_it - &*patch_2.begin()) << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
std::cerr << " Done!" << std::endl;
|
||||
|
|
@ -282,13 +282,13 @@ void test_ouput_iterators_triangulate_and_refine_hole(const char* file_name) {
|
|||
if(patch_facets.size() != (output_its.first - &*patch_facets_2.begin())) {
|
||||
std::cerr << " Error: returned facet output iterator is not valid!" << std::endl;
|
||||
std::cerr << " " << patch_facets.size() << " vs " << (output_its.first - &*patch_facets_2.begin()) << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
if(patch_vertices.size() != (output_its.second - &*patch_vertices_2.begin())) {
|
||||
std::cerr << " Error: returned vertex output iterator is not valid!" << std::endl;
|
||||
std::cerr << " " << patch_vertices.size() << " vs " << (output_its.second - &*patch_vertices_2.begin()) << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
std::cerr << " Done!" << std::endl;
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@ private:
|
|||
// it reads .polylines.txt (there should be one polyline with last point repeated)
|
||||
void read_polyline_one_line(const char* file_name, std::vector<Point_3>& points) {
|
||||
std::ifstream stream(file_name);
|
||||
if(!stream) { assert(false); }
|
||||
if(!stream) { CGAL_assertion(false); }
|
||||
|
||||
int count;
|
||||
if(!(stream >> count)) { assert(false); }
|
||||
if(!(stream >> count)) { CGAL_assertion(false); }
|
||||
while(count-- > 0) {
|
||||
Point_3 p;
|
||||
if(!(stream >> p)) { assert(false); }
|
||||
if(!(stream >> p)) { CGAL_assertion(false); }
|
||||
points.push_back(p);
|
||||
}
|
||||
}
|
||||
|
|
@ -75,14 +75,14 @@ void read_polyline_with_extra_points(
|
|||
std::vector<Point_3>& extras)
|
||||
{
|
||||
std::ifstream stream(file_name);
|
||||
if(!stream) { assert(false); }
|
||||
if(!stream) { CGAL_assertion(false); }
|
||||
|
||||
for(int i =0; i < 2; ++i) {
|
||||
int count;
|
||||
if(!(stream >> count)) { assert(false); }
|
||||
if(!(stream >> count)) { CGAL_assertion(false); }
|
||||
while(count-- > 0) {
|
||||
Point_3 p;
|
||||
if(!(stream >> p)) { assert(false); }
|
||||
if(!(stream >> p)) { CGAL_assertion(false); }
|
||||
i == 0 ? points.push_back(p) : extras.push_back(p);
|
||||
}
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ void read_polyline_with_extra_points(
|
|||
void check_triangles(std::vector<Point_3>& points, std::vector<boost::tuple<int, int, int> >& tris) {
|
||||
if(points.size() - 3 != tris.size()) {
|
||||
std::cerr << " Error: there should be n-2 triangles in generated patch." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
const int max_index = static_cast<int>(points.size())-1;
|
||||
|
|
@ -101,7 +101,7 @@ void check_triangles(std::vector<Point_3>& points, std::vector<boost::tuple<int,
|
|||
it->get<1>() == it->get<2>() )
|
||||
{
|
||||
std::cerr << "Error: indices of triangles should be all different." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
|
||||
if(it->get<0>() >= max_index ||
|
||||
|
|
@ -109,7 +109,7 @@ void check_triangles(std::vector<Point_3>& points, std::vector<boost::tuple<int,
|
|||
it->get<2>() >= max_index )
|
||||
{
|
||||
std::cerr << " Error: max possible index check failed." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ void check_constructed_polyhedron(const char* file_name,
|
|||
|
||||
if(!poly.is_valid()) {
|
||||
std::cerr << " Error: constructed patch does not constitute a valid polyhedron." << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
std::string out_file_name;
|
||||
out_file_name.append(file_name).append(".off");
|
||||
|
|
@ -177,7 +177,7 @@ void test_should_be_no_output(const char* file_name, bool use_DT) {
|
|||
|
||||
if(!tris.empty()) {
|
||||
std::cerr << " Error: patch should be empty" << std::endl;
|
||||
assert(false);
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
std::cerr << " Done!" << std::endl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue