tests: add testcase solid_header_no_facets.le_stlb
This commit is contained in:
parent
47123e2d26
commit
a66112d114
@ -28,8 +28,9 @@ const char* test_stl_infos();
|
|||||||
const char* test_stl_read();
|
const char* test_stl_read();
|
||||||
const char* test_stl_read_multi_solid();
|
const char* test_stl_read_multi_solid();
|
||||||
const char* test_stla_write();
|
const char* test_stla_write();
|
||||||
const char* test_stlb_write_header();
|
const char* test_stlb_read();
|
||||||
const char* test_stlb_write();
|
const char* test_stlb_write();
|
||||||
|
const char* test_stlb_write_header();
|
||||||
|
|
||||||
const char* test_stlb_header_str();
|
const char* test_stlb_header_str();
|
||||||
const char* test_stlb_header_to_printable_str();
|
const char* test_stlb_header_to_printable_str();
|
||||||
@ -60,8 +61,9 @@ const char* all_tests()
|
|||||||
UTEST_RUN(test_stl_read);
|
UTEST_RUN(test_stl_read);
|
||||||
UTEST_RUN(test_stl_read_multi_solid);
|
UTEST_RUN(test_stl_read_multi_solid);
|
||||||
UTEST_RUN(test_stla_write);
|
UTEST_RUN(test_stla_write);
|
||||||
UTEST_RUN(test_stlb_write_header);
|
UTEST_RUN(test_stlb_read);
|
||||||
UTEST_RUN(test_stlb_write);
|
UTEST_RUN(test_stlb_write);
|
||||||
|
UTEST_RUN(test_stlb_write_header);
|
||||||
|
|
||||||
UTEST_RUN(test_stlb_header_str);
|
UTEST_RUN(test_stlb_header_str);
|
||||||
UTEST_RUN(test_stlb_header_to_printable_str);
|
UTEST_RUN(test_stlb_header_to_printable_str);
|
||||||
|
BIN
tests/models/solid_header_no_facets.le_stlb
Normal file
BIN
tests/models/solid_header_no_facets.le_stlb
Normal file
Binary file not shown.
@ -105,6 +105,11 @@ const char* test_stl_read()
|
|||||||
GMIO_STL_FORMAT_BINARY_LE,
|
GMIO_STL_FORMAT_BINARY_LE,
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
|
{ "models/solid_header_no_facets.le_stlb",
|
||||||
|
GMIO_STL_ERROR_UNKNOWN_FORMAT,
|
||||||
|
GMIO_STL_FORMAT_UNKNOWN,
|
||||||
|
NULL
|
||||||
|
},
|
||||||
{ "models/solid_jburkardt_sphere.stla",
|
{ "models/solid_jburkardt_sphere.stla",
|
||||||
GMIO_ERROR_OK,
|
GMIO_ERROR_OK,
|
||||||
GMIO_STL_FORMAT_ASCII,
|
GMIO_STL_FORMAT_ASCII,
|
||||||
@ -193,6 +198,23 @@ const char* test_stl_read()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* test_stlb_read()
|
||||||
|
{
|
||||||
|
/* This file contains only a header and facet count(100) but no triangles */
|
||||||
|
FILE* file = fopen("models/solid_header_no_facets.le_stlb", "rb");
|
||||||
|
if (file != NULL) {
|
||||||
|
struct gmio_stream stream = gmio_stream_stdio(file);
|
||||||
|
const int error =
|
||||||
|
gmio_stlb_read(&stream, NULL, GMIO_ENDIANNESS_LITTLE, NULL);
|
||||||
|
fclose(file);
|
||||||
|
UTEST_COMPARE_INT(GMIO_STL_ERROR_FACET_COUNT, error);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
UTEST_FAIL("file is NULL");
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
const char* test_stlb_write_header()
|
const char* test_stlb_write_header()
|
||||||
{
|
{
|
||||||
const char* filepath = "temp/solid.stlb";
|
const char* filepath = "temp/solid.stlb";
|
||||||
@ -460,4 +482,12 @@ void generate_stlb_tests_models()
|
|||||||
fclose(infile);
|
fclose(infile);
|
||||||
fclose(outfile);
|
fclose(outfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
FILE* outfile = fopen("models/solid_header_no_facets.le_stlb", "wb");
|
||||||
|
struct gmio_stream ostream = gmio_stream_stdio(outfile);
|
||||||
|
const struct gmio_stlb_header header = {0};
|
||||||
|
gmio_stlb_write_header(&ostream, GMIO_ENDIANNESS_LITTLE, &header, 100);
|
||||||
|
fclose(outfile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user