From c5a688590a16d6862d098abed7fe0a6556b325de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 10 Jun 2024 14:00:28 +0200 Subject: [PATCH] Test the write output --- .../test/Stream_support/issue_7874.cpp | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Stream_support/test/Stream_support/issue_7874.cpp b/Stream_support/test/Stream_support/issue_7874.cpp index a84168d9bd3..e2691ee1238 100644 --- a/Stream_support/test/Stream_support/issue_7874.cpp +++ b/Stream_support/test/Stream_support/issue_7874.cpp @@ -23,25 +23,52 @@ int main() CGAL::IO::write_polygon_mesh("write_polygon_mesh_sm.ply", sm, CGAL::parameters::stream_precision(17).use_binary_mode(true)); + Surface_mesh osm; + if(!CGAL::IO::read_polygon_mesh("write_polygon_mesh_sm.ply", osm)) + { + std::cerr << "Error: failed to read 'write_polygon_mesh_sm.ply'" << std::endl; + return EXIT_FAILURE; + } + // ERROR this produces an invalid plyfile CGAL::IO::write_polygon_mesh("write_polygon_mesh_po.ply", po, CGAL::parameters::stream_precision(17).use_binary_mode(true)); + if(!CGAL::IO::read_polygon_mesh("write_polygon_mesh_po.ply", osm)) + { + std::cerr << "Error: failed to read 'write_polygon_mesh_po.ply'" << std::endl; + return EXIT_FAILURE; + } // OK // from #include // https://doc.cgal.org/latest/BGL/group__PkgBGLIoFuncsPLY.html#ga959dcd88ca979d3b6b0806d883a0247f CGAL::IO::write_PLY("generic_write_PLY_sm.ply", sm, "generic write_PLY(Surface_mesh)", CGAL::parameters::stream_precision(17).use_binary_mode(true)); + if(!CGAL::IO::read_polygon_mesh("generic_write_PLY_sm.ply", osm)) + { + std::cerr << "Error: failed to read 'generic_write_PLY_sm.ply'" << std::endl; + return EXIT_FAILURE; + } // ERROR this produces an invalid plyfile CGAL::IO::write_PLY("generic_write_PLY_po.ply", po, "generic write_PLY(Polyhedron)", CGAL::parameters::stream_precision(17).use_binary_mode(true)); + if(!CGAL::IO::read_polygon_mesh("generic_write_PLY_po.ply", osm)) + { + std::cerr << "Error: failed to read 'generic_write_PLY_po.ply'" << std::endl; + return EXIT_FAILURE; + } // OK // from #include // https://doc.cgal.org/latest/Surface_mesh/group__PkgSurfaceMeshIOFuncPLY.html#ga50f0e9f2b293855d2c7f1a62939cbe8d std::ofstream out("overloaded_write_PLY_sm.ply", std::ios::binary); - CGAL::IO::write_PLY(out, sm, "overloaded_write_PLY)Surface_mesh)"); + CGAL::IO::write_PLY(out, sm, "overloaded_write_PLY(Surface_mesh)"); + if(!CGAL::IO::read_polygon_mesh("overloaded_write_PLY_sm.ply", osm)) + { + std::cerr << "Error: failed to read 'overloaded_write_PLY_sm.ply'" << std::endl; + return EXIT_FAILURE; + } return 0; }