From aebe4fb78d153fc589dd575623a8e6523a3c9860 Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 17 Oct 2011 08:58:45 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@24613 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/table_handler_02.cc | 54 +++++++++++++++++++++++++ tests/base/table_handler_02/cmp/generic | 12 ++++++ 2 files changed, 66 insertions(+) create mode 100644 tests/base/table_handler_02.cc create mode 100644 tests/base/table_handler_02/cmp/generic diff --git a/tests/base/table_handler_02.cc b/tests/base/table_handler_02.cc new file mode 100644 index 0000000000..4d5af41e92 --- /dev/null +++ b/tests/base/table_handler_02.cc @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2010, 2011 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. +// +//----------------------------------------------------------------------------- + +// test output of tables with columns in a variety of data types + + +#include "../tests.h" +#include +#include +#include + +#include +#include +#include +#include + + +int main () +{ + std::ofstream logfile("table_handler_02/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + TableHandler table; + + // have keys that we rotate in each row to + // make sure that individual entries in the + // same column really have different data + // types + std::string keys[4] = { "key1", "key2", "key3", "key4" }; + + + for (unsigned int i=0; i<10; ++i) + { + table.add_value(keys[(0+i)%4], i); + table.add_value(keys[(1+i)%4], sqrt(i)); + table.add_value(keys[(2+i)%4], 'a'+i); + table.add_value(keys[(3+i)%4], std::string("abc-")+"0123456789"[i]); + } + + // output + table.write_text(deallog.get_file_stream()); +} diff --git a/tests/base/table_handler_02/cmp/generic b/tests/base/table_handler_02/cmp/generic new file mode 100644 index 0000000000..abe493a20b --- /dev/null +++ b/tests/base/table_handler_02/cmp/generic @@ -0,0 +1,12 @@ + + key1 key2 key3 key4 +0 0.0000 97 abc-0 +abc-1 1 1.0000 98 +99 abc-2 2 1.4142 +1.7321 100 abc-3 3 +4 2.0000 101 abc-4 +abc-5 5 2.2361 102 +103 abc-6 6 2.4495 +2.6458 104 abc-7 7 +8 2.8284 105 abc-8 +abc-9 9 3.0000 106 -- 2.39.5