From: kanschat Date: Mon, 23 Oct 2006 22:21:04 +0000 (+0000) Subject: use crc32 checksum to verify binary output X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d5d98e04f68fc0aef746391f71828c66b27b1b3;p=dealii-svn.git use crc32 checksum to verify binary output git-svn-id: https://svn.dealii.org/trunk@14059 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/base/data_out_base_tecplot_bin.cc b/tests/base/data_out_base_tecplot_bin.cc index 869799fb3b..c42f2e750a 100644 --- a/tests/base/data_out_base_tecplot_bin.cc +++ b/tests/base/data_out_base_tecplot_bin.cc @@ -18,17 +18,18 @@ #include #include #include +#include #include #include +#ifdef HAVE_LIBZ +# include +#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 void check(DataOutBase::TecplotFlags flags, std::ostream& out) @@ -50,37 +51,37 @@ void check(DataOutBase::TecplotFlags flags, template -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(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(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>(); } diff --git a/tests/base/data_out_base_tecplot_bin/cmp/generic b/tests/base/data_out_base_tecplot_bin/cmp/generic index e69de29bb2..d6a965837a 100644 --- a/tests/base/data_out_base_tecplot_bin/cmp/generic +++ b/tests/base/data_out_base_tecplot_bin/cmp/generic @@ -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