Revision: 78000
http://sourceforge.net/p/brlcad/code/78000
Author: starseeker
Date: 2020-12-18 15:38:07 +0000 (Fri, 18 Dec 2020)
Log Message:
-----------
Enable the bn_plot3 tests. These simply check the ability to detect valid and
invalid plot3 files successfully, but that's a foundation for being able to
detect invalid plot3 output from other routines down the road...
Modified Paths:
--------------
brlcad/trunk/src/libbn/tests/CMakeLists.txt
brlcad/trunk/src/libbn/tests/plot3.c
Modified: brlcad/trunk/src/libbn/tests/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libbn/tests/CMakeLists.txt 2020-12-18 15:17:34 UTC (rev
77999)
+++ brlcad/trunk/src/libbn/tests/CMakeLists.txt 2020-12-18 15:38:07 UTC (rev
78000)
@@ -1143,6 +1143,14 @@
BRLCAD_ADD_TEST(NAME bn_vlist_cmd_cnt_45 COMMAND bn_test vlist 45)
BRLCAD_ADD_TEST(NAME bn_vlist_cmd_cnt_500 COMMAND bn_test vlist 500)
+#
+# *************** plot3.c ***************
+#
+# Tests to detect validity/invalidity of plot3 files
+#
+BRLCAD_ADD_TEST(NAME bn_plot3_valid COMMAND bn_plot3 -b
"${CMAKE_CURRENT_SOURCE_DIR}/valid.plot3")
+BRLCAD_ADD_TEST(NAME bn_plot3_invalid COMMAND bn_plot3 -i -b
"${CMAKE_CURRENT_SOURCE_DIR}/invalid.plot3")
+
CMAKEFILES(
CMakeLists.txt
bntester.dat
Modified: brlcad/trunk/src/libbn/tests/plot3.c
===================================================================
--- brlcad/trunk/src/libbn/tests/plot3.c 2020-12-18 15:17:34 UTC (rev
77999)
+++ brlcad/trunk/src/libbn/tests/plot3.c 2020-12-18 15:38:07 UTC (rev
78000)
@@ -37,12 +37,14 @@
int print_help = 0;
int binary_mode = 0;
int text_mode = 0;
+ int expect_invalid = 0;
int mode = -1;
- struct bu_opt_desc d[4];
- BU_OPT(d[0], "h", "help", "", NULL, &print_help, "Print help and
exit");
- BU_OPT(d[1], "b", "binary", "", NULL, &binary_mode, "Process plot file as
binary plot data (default)");
- BU_OPT(d[2], "t", "text", "", NULL, &text_mode, "Process plot file as
text plot data");
- BU_OPT_NULL(d[3]);
+ struct bu_opt_desc d[5];
+ BU_OPT(d[0], "h", "help", "", NULL, &print_help, "Print help and
exit");
+ BU_OPT(d[1], "b", "binary", "", NULL, &binary_mode, "Process plot
file as binary plot data (default)");
+ BU_OPT(d[2], "t", "text", "", NULL, &text_mode, "Process plot
file as text plot data");
+ BU_OPT(d[3], "i", "invalid", "", NULL, &expect_invalid, "Expect to detect
an invalid file");
+ BU_OPT_NULL(d[4]);
bu_setprogname(argv[0]);
@@ -75,10 +77,19 @@
ret = plot3_invalid(fp, mode);
- if (ret) {
- bu_log("INVALID: %s\n", argv[0]);
+ if (expect_invalid) {
+ if (ret) {
+ bu_log("INVALID (expected): %s\n", argv[0]);
+ } else {
+ bu_log("VALID (unexpected): %s\n", argv[0]);
+ }
+ ret = (ret) ? 0 : 1;
} else {
- bu_log("VALID: %s\n", argv[0]);
+ if (ret) {
+ bu_log("INVALID: %s\n", argv[0]);
+ } else {
+ bu_log("VALID: %s\n", argv[0]);
+ }
}
return ret;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits