Add unit test for parsing 'l'.
This commit is contained in:
16
models/line-prim.obj
Normal file
16
models/line-prim.obj
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
mtllib cube.mtl
|
||||||
|
|
||||||
|
v 0.000000 2.000000 2.000000
|
||||||
|
v 0.000000 0.000000 2.000000
|
||||||
|
v 2.000000 0.000000 2.000000
|
||||||
|
v 2.000000 2.000000 2.000000
|
||||||
|
v 0.000000 2.000000 0.000000
|
||||||
|
v 0.000000 0.000000 0.000000
|
||||||
|
v 2.000000 0.000000 0.000000
|
||||||
|
v 2.000000 2.000000 0.000000
|
||||||
|
# 8 vertices
|
||||||
|
|
||||||
|
g g0
|
||||||
|
usemtl white
|
||||||
|
l 1 2 3 4
|
||||||
|
l 5 6 7
|
||||||
@@ -790,6 +790,23 @@ TEST_CASE("Empty mtl basedir", "[Issue177]") {
|
|||||||
REQUIRE(true == ret);
|
REQUIRE(true == ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("line-primitive", "[line]") {
|
||||||
|
tinyobj::attrib_t attrib;
|
||||||
|
std::vector<tinyobj::shape_t> shapes;
|
||||||
|
std::vector<tinyobj::material_t> materials;
|
||||||
|
|
||||||
|
std::string err;
|
||||||
|
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "../models/line-prim.obj", gMtlBasePath);
|
||||||
|
|
||||||
|
if (!err.empty()) {
|
||||||
|
std::cerr << "[line] " << err << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
REQUIRE(true == ret);
|
||||||
|
REQUIRE(1 == shapes.size());
|
||||||
|
REQUIRE(6 == shapes[0].path.indices.size());
|
||||||
|
}
|
||||||
|
|
||||||
// Fuzzer test.
|
// Fuzzer test.
|
||||||
// Just check if it does not crash.
|
// Just check if it does not crash.
|
||||||
// Disable by default since Windows filesystem can't create filename of afl testdata
|
// Disable by default since Windows filesystem can't create filename of afl testdata
|
||||||
|
|||||||
Reference in New Issue
Block a user