From e4889ceb4c9f6e2fbabd88c4ee28e3c205489f5e Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Fri, 28 Oct 2016 15:06:07 -0400 Subject: [PATCH] UPdate LCC test to add tests for close and insert_cell_2_in_cell_3. --- .../Linear_cell_complex_2_test.h | 14 ++++++++++++++ .../Linear_cell_complex_3_test.h | 18 +++++++++++++----- .../Linear_cell_complex_4_test.h | 10 +++++++--- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h index 54c2c863b4e..ee80ff964ab 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h @@ -56,6 +56,20 @@ void trace_display_msg(const char* #endif } +template +struct Alpha1 +{ + static typename LCC::Dart_handle run(LCC&, typename LCC::Dart_handle dh) + { return dh; } +}; +template +struct Alpha1 +{ + static typename LCC::Dart_handle run(LCC& lcc, typename LCC::Dart_handle dh) + { return lcc.template alpha<1>(dh); } +}; + // Test orientation specialized below only for CMap. For GMap return true. template struct Test_change_orientation_LCC_2 diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.h b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.h index e2c9273d363..8f15693c827 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.h +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.h @@ -881,9 +881,13 @@ bool test_LCC_3() lcc.template sew<3>(dh1,lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2))))); lcc.template sew<3>(lcc.template opposite<2>(lcc.next(dh1)), lcc.template opposite<2>(lcc.previous(dh3))); - lcc.insert_cell_1_in_cell_2(lcc.next(dh1), lcc.previous(dh1)); + lcc.template close<3>(); + if ( !check_number_of_cells_3(lcc, 16, 28, 16, 4, 1) ) + return false; + + lcc.insert_cell_1_in_cell_2(lcc.next(dh1), Alpha1::run(lcc, lcc.previous(dh1))); dh2=lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh1)))); - lcc.insert_cell_1_in_cell_2(dh2, lcc.next(lcc.next(dh2))); + lcc.insert_cell_1_in_cell_2(dh2, Alpha1::run(lcc, lcc.next(lcc.next(dh2)))); std::vector path; path.push_back(lcc.next(dh1)); @@ -891,12 +895,13 @@ bool test_LCC_3() path.push_back(lcc.previous(dh2)); path.push_back(lcc.next(lcc.template opposite<2>(dh2))); lcc.insert_cell_2_in_cell_3(path.begin(),path.end()); - if ( !check_number_of_cells_3(lcc, 16, 30, 19, 4, 1) ) + if ( !check_number_of_cells_3(lcc, 16, 30, 19, 5, 1) ) return false; // Construction from Polyhedron_3 { trace_test_begin(); + lcc.clear(); CGAL::Polyhedron_3 P; std::ifstream in("data/head.off"); if ( in.fail() ) @@ -905,6 +910,7 @@ bool test_LCC_3() return false; } in >> P; + CGAL::import_from_polyhedron_3(lcc,P); if ( !check_number_of_cells_3(lcc, 1539, 4434, 2894, 2, 2) ) return false; @@ -912,7 +918,6 @@ bool test_LCC_3() CGAL::write_off(lcc, "copy-head.off"); LCC lcc2; CGAL::load_off(lcc2, "copy-head.off"); - // LCC lcc2; CGAL::load_off(lcc2, "data/head.off"); if ( !check_number_of_cells_3(lcc2, 1539, 4434, 2894, 2, 2) ) return false; @@ -955,7 +960,10 @@ bool test_LCC_3() assert(is.is_open()); is>>lcc2; - if (!lcc.is_isomorphic_to(lcc2)) + if ( !check_number_of_cells_3(lcc2, 286, 1490, 2408, 1204, 1) ) + return false; + + if (!lcc.is_isomorphic_to(lcc2, false, true, true)) { assert(false); return false; diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.h b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.h index 33a5bee291a..1f97cba8dd5 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.h +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.h @@ -379,11 +379,15 @@ bool test_LCC_4() lcc.template sew<3>(dh1,lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2))))); lcc.template sew<3>(lcc.template opposite<2>(lcc.next(dh1)), lcc.template opposite<2>(lcc.previous(dh3))); + lcc.template close<3>(); lcc.template close<4>(); - lcc.insert_cell_1_in_cell_2(lcc.next(dh1), lcc.previous(dh1)); + if ( !check_number_of_cells_4(lcc, 16, 28, 16, 4, 2, 1) ) + return false; + + lcc.insert_cell_1_in_cell_2(lcc.next(dh1), Alpha1::run(lcc, lcc.previous(dh1))); dh2=lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh1)))); - lcc.insert_cell_1_in_cell_2(dh2, lcc.next(lcc.next(dh2))); + lcc.insert_cell_1_in_cell_2(dh2, Alpha1::run(lcc, lcc.next(lcc.next(dh2)))); std::vector path; path.push_back(lcc.next(dh1)); @@ -391,7 +395,7 @@ bool test_LCC_4() path.push_back(lcc.previous(dh2)); path.push_back(lcc.next(lcc.template opposite<2>(dh2))); lcc.insert_cell_2_in_cell_3(path.begin(),path.end()); - if ( !check_number_of_cells_4(lcc, 16, 30, 19, 4, 2, 1) ) + if ( !check_number_of_cells_4(lcc, 16, 30, 19, 5, 2, 1) ) return false; if ( !Test_change_orientation_LCC_4::run() )