]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
use crc32 checksum to verify binary output
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 23 Oct 2006 22:21:04 +0000 (22:21 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 23 Oct 2006 22:21:04 +0000 (22:21 +0000)
git-svn-id: https://svn.dealii.org/trunk@14059 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/data_out_base_tecplot_bin.cc
tests/base/data_out_base_tecplot_bin/cmp/generic

index 869799fb3b7dfd7c5e0b534737c1e1f9b1ce2e21..c42f2e750a6441134c8e01e9cc269a6eeecb7b9b 100644 (file)
 #include <vector>
 #include <iostream>
 #include <fstream>
+#include <sstream>
 #include <string>
 #include <stdio.h>
 
+#ifdef HAVE_LIBZ
+#  include <zlib.h>
+#endif
+
 #include "patches.h"
 
 // Output data on repetitions of the unit hypercube
 
-// define this as 1 to get output into a separate file for each testcase
-#define SEPARATE_FILES 1
-
-
 template <int dim, int spacedim>
 void check(DataOutBase::TecplotFlags flags,
               std::ostream& out)
@@ -50,37 +51,37 @@ void check(DataOutBase::TecplotFlags flags,
 
 
 template<int dim, int spacedim>
-void check_all(std::ostream& log)
+void check_all()
 {
-#if SEPARATE_FILES == 0
-  std::ostream& out = log;
-#else
-  (void)log;
-#endif
+  std::ostringstream out;
   
   char name[100];
   DataOutBase::TecplotFlags flags;
   if (true) {
     sprintf(name, "data_out_base_tecplot_bin/%d%d.tecplot", dim, spacedim);
     flags.tecplot_binary_file_name=name;
-#if SEPARATE_FILES==1
-    std::ofstream out(name, std::ios_base::trunc | std::ios_base::binary);
+    
+    check<dim,spacedim>(flags, out);
+#ifdef HAVE_LIBZ
+    uLong crc = crc32(0L, Z_NULL, 0);
+    const Bytef* bytes = (const Bytef*) (out.str().c_str());
+    crc = crc32(crc, bytes, out.str().size());
+    deallog << "check_all<" << dim << ',' << spacedim
+           << "> checksum " << crc << std::endl;
 #else
-       out << "==============================\n"
-           << name
-           << "\n==============================\n";
+    deallog << "zlib missing" << std::endl;
 #endif
-    check<dim,spacedim>(flags, out);
   }
 }
 
 int main()
 {
-  std::ofstream logfile("data_out_base_tecplot_bin/output",
-                       std::ios_base::trunc | std::ios_base::binary);
-  check_all<1,1>(logfile);
-  check_all<1,2>(logfile);
-  check_all<2,2>(logfile);
-  check_all<2,3>(logfile);
-  check_all<3,3>(logfile);
+  std::ofstream logfile("data_out_base_tecplot_bin/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  check_all<1,1>();
+  check_all<1,2>();
+  check_all<2,2>();
+  check_all<2,3>();
+  check_all<3,3>();
 }
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..d6a965837a1bdd1c2e23e2cb457206228097f635 100644 (file)
@@ -0,0 +1,6 @@
+
+DEAL::check_all<1,1> checksum 3099677259
+DEAL::check_all<1,2> checksum 3595456989
+DEAL::check_all<2,2> checksum 3149151781
+DEAL::check_all<2,3> checksum 2579237065
+DEAL::check_all<3,3> checksum 3996659970

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.