[cgma-dev] r2195 - cgm/trunk/test

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Mon Nov 3 08:28:19 CST 2008


Author: kraftche
Date: 2008-11-03 08:28:19 -0600 (Mon, 03 Nov 2008)
New Revision: 2195

Modified:
   cgm/trunk/test/test_occ.cpp
Log:
Fix test:
 o Look in corret place for input file when compiling in separate 
   directory tree.
 o If test fails, exit with non-zero exit code.
 


Modified: cgm/trunk/test/test_occ.cpp
===================================================================
--- cgm/trunk/test/test_occ.cpp	2008-11-03 14:22:10 UTC (rev 2194)
+++ cgm/trunk/test/test_occ.cpp	2008-11-03 14:28:19 UTC (rev 2195)
@@ -20,6 +20,12 @@
 #include "RefFace.hpp"
 #include "RefVolume.hpp"
 
+#define STRINGIFY(S) XSTRINGIFY(S)
+#define XSTRINGIFY(S) #S
+#ifndef SRCDIR
+#  define SRCDIR "."
+#endif
+
 using std::list;
 using std::pair;
 using std::set;
@@ -37,14 +43,15 @@
   OCCModifyEngine::instance();
   GeometryQueryTool *gti = GeometryQueryTool::instance();
   GeometryModifyTool *gmti = GeometryModifyTool::instance();
+  assert(gti);
   
   // Read in the geometry from files specified on the command line
-  std::string filename("./LeverArm.brep");
-  assert(gti);
-
-  CubitStatus status = gti->import_solid_model(filename.c_str(), "OCC");
-  if (status != CUBIT_SUCCESS)
-    PRINT_ERROR("Problems reading geometry file %s.\n", filename.c_str());
+  const char* filename = STRINGIFY(SRCDIR) "/LeverArm.brep";
+  CubitStatus status = gti->import_solid_model(filename, "OCC");
+  if (status != CUBIT_SUCCESS) {
+    PRINT_ERROR("Problems reading geometry file %s.\n", filename);
+    return 1;
+  }
  
   DLIList<RefEdge*> my_curvs;
   DLIList<RefFace*> my_surfs;
@@ -101,6 +108,7 @@
 	printf("  point coords:     %e %e %e\n", coord0.x(), coord0.y(), coord0.z());
 	printf("  projected coords: %e %e %e\n", coord1.x(), coord1.y(), coord1.z());
 	printf("  params returned:  %e %e\n\n", u, v);
+        return 1;
       }
 
     }
@@ -126,6 +134,7 @@
 	  printf("  point coords:     %e %e %e\n", coord0.x(), coord0.y(), coord0.z());
 	  printf("  projected coords: %e %e %e\n", coord1.x(), coord1.y(), coord1.z());
 	  printf("  params returned:  %e %e\n\n", u, v);
+          return 1;
 	}
 
       }




More information about the cgma-dev mailing list