Skip to content

Commit a473187

Browse files
add CAD parsing geometry to cmake tests
1 parent e2a37b1 commit a473187

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Source/shared/readcad.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,9 @@ int ReadCADGeomToCollection(cadgeom_collection *coll, const char *file,
415415
fprintf(stderr, "CADGeomCollection has exceeded capacity");
416416
return -1;
417417
}
418-
ReadCADGeom(&coll->cadgeominfo[coll->ncadgeom], file, block_shininess);
418+
int res = ReadCADGeom(&coll->cadgeominfo[coll->ncadgeom], file, block_shininess);
419419
coll->ncadgeom++;
420-
return 0;
420+
return res;
421421
}
422422

423423
/* ------------------ InitCADGeomCollection ------------------------ */

Tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ add_test(NAME "Simple PL3d - Complete"
298298
COMMAND parse_simple_pl3d ${FIG_DIR}/smv/Tests/simple_pl3d.q)
299299

300300
add_test(NAME "Parse CAD"
301-
COMMAND parse_cad)
301+
COMMAND parse_cad ${CMAKE_SOURCE_DIR}/Verification/Visualization/cad_test.ge1)
302302

303303
add_test(NAME "Test Object API"
304304
COMMAND test_objects)

Tests/parse_cad.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,17 @@ int show_version;
1212
char append_string[1024];
1313

1414
int main(int argc, char **argv) {
15+
if(argc < 2) {
16+
fprintf(stderr, "error: insufficient arguments");
17+
}
1518
initMALLOC();
19+
char *input_path = argv[1];
1620
cadgeom_collection *coll = CreateCADGeomCollection(20);
1721
assert(NCADGeom(coll) == 0);
22+
int res = ReadCADGeomToCollection(coll, input_path, 100.0);
23+
fprintf(stderr, "#CAD defs: %i\n", NCADGeom(coll));
24+
assert(res == 0);
25+
assert(NCADGeom(coll) == 1);
1826
FreeCADGeomCollection(coll);
1927
return 0;
2028
}

0 commit comments

Comments
 (0)