From 1f4ee1d07aa1a4a8c4c695b1e143ed9f31efb24b Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 19 Jul 2017 10:46:35 +0200 Subject: [PATCH] Reorganize the binary I/O tests Skip the reading of the existing binary file, for - 32bits platforms (actually any non-64bits platform), - and big endian platforms. ... because we know the binary file is incompatible (for the moment). --- Mesh_3/test/Mesh_3/test_c3t3_io.cpp | 45 +++++++++++++++++++---------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/Mesh_3/test/Mesh_3/test_c3t3_io.cpp b/Mesh_3/test/Mesh_3/test_c3t3_io.cpp index a019946c761..7810a8ea419 100644 --- a/Mesh_3/test/Mesh_3/test_c3t3_io.cpp +++ b/Mesh_3/test/Mesh_3/test_c3t3_io.cpp @@ -348,28 +348,17 @@ struct Test_c3t3_io { << c3t3_bis << "\n******end******" << std::endl; assert(stream); + { std::ostringstream ss_c3t3, ss_c3t3_bis; ss_c3t3 << c3t3; ss_c3t3_bis << c3t3_bis; + assert(ss_c3t3); + assert(ss_c3t3_bis); assert(ss_c3t3.str() == ss_c3t3_bis.str()); if(!check_equality(c3t3, c3t3_bis)) return false; } - c3t3_bis.clear(); - { - std::ifstream input(filename.c_str(), - binary ? (std::ios_base::in | std::ios_base::binary) - : std::ios_base::in); - CGAL::Mesh_3::load_binary_file(input, c3t3_bis); - } - if(!check_equality(c3t3, c3t3_bis)) return false; - { - std::ostringstream ss_c3t3, ss_c3t3_bis; - ss_c3t3 << c3t3; - ss_c3t3_bis << c3t3_bis; - assert(ss_c3t3.str() == ss_c3t3_bis.str()); - if(!check_equality(c3t3, c3t3_bis)) return false; - } + c3t3_bis.clear(); { std::stringstream ss(std::ios_base::out | @@ -377,9 +366,33 @@ struct Test_c3t3_io { (std::ios_base::in | std::ios_base::binary) : std::ios_base::in)); CGAL::Mesh_3::save_binary_file(ss, c3t3, binary); + assert(ss); CGAL::Mesh_3::load_binary_file(ss, c3t3_bis); - if(!check_equality(c3t3, c3t3_bis)) return false; + assert(ss); } + if(!check_equality(c3t3, c3t3_bis)) return false; + +#ifndef CGAL_LITTLE_ENDIAN + // skip binary I/O with the existing file for big endian + return true; +#endif + + if (sizeof(void*) != 8) { + // skip 32bits architectures as well + return true; + } + + c3t3_bis.clear(); + { + std::ifstream input(filename.c_str(), + binary ? (std::ios_base::in | std::ios_base::binary) + : std::ios_base::in); + assert(input); + CGAL::Mesh_3::load_binary_file(input, c3t3_bis); + assert(input); + } + if(!check_equality(c3t3, c3t3_bis)) return false; + return true; }