From f19a565ec23043b3acf0d625e9f3641eac9a14b6 Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 17 Sep 2012 16:05:55 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@26436 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 10 ++++- tests/base/table_handler_12.cc | 53 +++++++++++++++++++++++++ tests/base/table_handler_12/cmp/generic | 4 ++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tests/base/table_handler_12.cc create mode 100644 tests/base/table_handler_12/cmp/generic diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index ae1c0a599b..aeb69157cb 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -53,7 +53,15 @@ DoFHandler, in particular removal of specializations.

Specific improvements

    -
  1. Fixed: output of super-columns in TableHandler::write_text() +
  2. Fixed: The use of TableHandler::set_precision affected not only the +precision with which elements of a table were printed, but also the +precision carried by the output stream after writing the table was +finished. It thus affected the precision +with which later output was produced. This is now fixed. +
    +(Timo Heister, 2012/09/16) + +
  3. Fixed: Output of super-columns in TableHandler::write_text() was inconsistent. This is now fixed.
    (Timo Heister, 2012/09/16) diff --git a/tests/base/table_handler_12.cc b/tests/base/table_handler_12.cc new file mode 100644 index 0000000000..db899a93ef --- /dev/null +++ b/tests/base/table_handler_12.cc @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// $Id: table_handler_07.cc -1 $ +// Version: $Name$ +// +// Copyright (C) 2010, 2011, 2012 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//----------------------------------------------------------------------------- + +// verify that the flags we set for precision when printing stuff from +// a table do not affect the precision flags set for the stream to +// which we print + + +#include "../tests.h" +#include +#include +#include + +#include +#include +#include +#include + + +int main () +{ + std::ofstream logfile("table_handler_12/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + // set precision on the output + // stream to 4 digits + logfile << std::setprecision(4); + + // but then set precision on the + // table output to 2 + TableHandler table; + table.add_value("key", 0.123456789); + table.set_precision ("key", 2); + + // now output the table... + table.write_text(logfile); + // ...and then output some other + // number, hopefully with 4 digits + // of precision + logfile << 0.123456789 << std::endl; +} diff --git a/tests/base/table_handler_12/cmp/generic b/tests/base/table_handler_12/cmp/generic new file mode 100644 index 0000000000..c6970bb790 --- /dev/null +++ b/tests/base/table_handler_12/cmp/generic @@ -0,0 +1,4 @@ + +key +0.12 +0.1235 -- 2.39.5