Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/readpoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ namespace {
{
case ' ':
case '\t':
case '\r':
is.get ();
break;
default:
Expand Down
19 changes: 19 additions & 0 deletions test_suite/inputs/cuboid-dos.off
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
OFF
# cuboid.off
# Ein Quader.

8 6 12
1.0 0.0 1.0
0.0 1.0 1.0
-1.0 0.0 1.0
0.0 -1.0 1.0
1.0 0.0 -1.0
0.0 1.0 -1.0
-1.0 0.0 -1.0
0.0 -1.0 -1.0
4 0 1 2 3
4 7 4 0 3
4 4 5 1 0
4 5 6 2 1
4 3 2 6 7
4 6 5 4 7
14 changes: 14 additions & 0 deletions test_suite/test_offreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ TEST_CASE( "parse valid off file without labels" ){
CHECK (surface.label_of_triangle(i) == LABEL_UNASSIGNED);
}

TEST_CASE( "parse valid off file without labels; DOS line endings" ){
Triangulation surface;
std::ifstream is ("inputs/cuboid-dos.off");
ReadIntoTriangulation adap1 (&surface, false);
TriangulatingPolyFileSink adap2 (&adap1);
parse_off_file (&adap2, is);
CHECK (surface.n_triangles () == 6 * 2);
CHECK (surface.n_vertices () == 8);
CHECK_THAT(surface.get_pos_of_vertex (0), IsApprox({1, 0, 1}, 1e-12));
CHECK_THAT(surface.get_pos_of_vertex (7), IsApprox({0, -1, -1}, 1e-12));
for (int i = 0; i != 12; ++i)
CHECK (surface.label_of_triangle(i) == LABEL_UNASSIGNED);
}

TEST_CASE( "parse valid off file without labels, but expecting to find some" ){
Triangulation surface;
std::ifstream is ("inputs/cuboid.off");
Expand Down
Loading