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

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Thu Jul 14 11:56:22 CDT 2011


Author: janehu
Date: 2011-07-14 11:56:22 -0500 (Thu, 14 Jul 2011)
New Revision: 5057

Modified:
   cgm/trunk/test/attribute_to_file.cpp
Log:
Updated for bug fix reported in r5056.

Modified: cgm/trunk/test/attribute_to_file.cpp
===================================================================
--- cgm/trunk/test/attribute_to_file.cpp	2011-07-14 16:55:19 UTC (rev 5056)
+++ cgm/trunk/test/attribute_to_file.cpp	2011-07-14 16:56:22 UTC (rev 5057)
@@ -27,6 +27,9 @@
 #endif
 
 #define ASSERT(A) if (!(A)) failed(#A,__FILE__,__LINE__)
+CubitBoolean is_files_same(char* filename1,
+                           char* filename2);
+
 void failed( const char* A, const char* FILE, int LINE )
 {
   printf( "Condition failed at %s:%d : %s\n", FILE, LINE, A );
@@ -122,7 +125,61 @@
   body_entity_list.reset();
   assert (n_body == 2);
 
+  export_list.clean_out();
+  export_list.append(CAST_TO(body_entity_list.get_and_step(), Body));
+  export_list.append(CAST_TO(body_entity_list.get_and_step(), Body));
+  s = GeometryQueryTool::instance()->export_solid_model( export_list, "bricks23.occ",
+                                                         FORMAT, junk, CubitString(__FILE__) );
+  ASSERT(s);
+
+  ASSERT(is_files_same("bricks2.occ", "bricks23.occ"));
   return 0;
 }
 
+CubitBoolean is_files_same(char* filename1,
+                           char* filename2)
+{
+  FILE *fp1, *fp2;
+  char ch1, ch2;
+  CubitBoolean same = false;
+  /* open first file */
+  if((fp1 = fopen(filename1, "rb"))==NULL) {
+    printf("Cannot open first file.\n");
+    exit(false);
+  }
 
+  /* open second file */
+  if((fp2 = fopen(filename2, "rb"))==NULL) {
+    printf("Cannot open second file.\n");
+    exit(false);
+  } 
+
+  /* compare the files */
+  while(!feof(fp1)) {
+    ch1 = fgetc(fp1);
+    if(ferror(fp1)) {


More information about the cgma-dev mailing list