From 52b3766f8941ba1bc87af8ae32534a9ed6c34354 Mon Sep 17 00:00:00 2001 From: bangerth Date: Fri, 7 Sep 2012 22:04:44 +0000 Subject: [PATCH] Yet another test. git-svn-id: https://svn.dealii.org/trunk@26253 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/table_handler_08.cc | 60 +++++++++++++++++++++++++ tests/base/table_handler_08/cmp/generic | 8 ++++ 2 files changed, 68 insertions(+) create mode 100644 tests/base/table_handler_08.cc create mode 100644 tests/base/table_handler_08/cmp/generic diff --git a/tests/base/table_handler_08.cc b/tests/base/table_handler_08.cc new file mode 100644 index 0000000000..777c55cc93 --- /dev/null +++ b/tests/base/table_handler_08.cc @@ -0,0 +1,60 @@ +//----------------------------------------------------------------------------- +// $Id$ +// 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. +// +//----------------------------------------------------------------------------- + +// make sure a TableHandler can be copied, this time using the copy +// constructor + + +#include "../tests.h" +#include +#include +#include + +#include +#include +#include +#include + + +int main () +{ + std::ofstream logfile("table_handler_08/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + +/* Like in _06 */ + TableHandler table; + table.set_auto_fill_mode (true); + + std::string keys[3] = { "key1", "key2", "key3" }; + + // fill rows 1 and 2 partially + table.add_value(keys[0], 0); + table.add_value(keys[0], 1); + // now fill row 3 completely + table.add_value(keys[0], 2); + table.add_value(keys[1], 13); + table.add_value(keys[2], std::string("a")); + + // now again fill row 4 partially + table.add_value(keys[0], 1); + +/* Now copy and write the file from the copy */ + TableHandler table2(table); + + // produce output. hope that row 4 is + // completely padded + table2.write_text(deallog.get_file_stream(), + TableHandler::table_with_separate_column_description); +} diff --git a/tests/base/table_handler_08/cmp/generic b/tests/base/table_handler_08/cmp/generic new file mode 100644 index 0000000000..e6a8bb1bed --- /dev/null +++ b/tests/base/table_handler_08/cmp/generic @@ -0,0 +1,8 @@ + +# 1: key1 +# 2: key2 +# 3: key3 +0 0 "" +1 0 "" +2 13 a +1 0 "" -- 2.39.5