From: Wolfgang Bangerth Date: Mon, 10 Apr 2017 01:37:34 +0000 (-0600) Subject: Add test. X-Git-Tag: v9.0.0-rc1~1705^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4240%2Fhead;p=dealii.git Add test. --- diff --git a/tests/base/table_handler_14.cc b/tests/base/table_handler_14.cc new file mode 100644 index 0000000000..9b8380944f --- /dev/null +++ b/tests/base/table_handler_14.cc @@ -0,0 +1,65 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2010 - 2015, 2017 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +// test TableHandler::start_new_row() + + +#include "../tests.h" +#include +#include +#include + +#include +#include +#include +#include + + +int main () +{ + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.threshold_double(1.e-10); + + 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, using auto_fill_mode + table.add_value(keys[0], 2); + table.add_value(keys[1], 113); + table.add_value(keys[2], std::string("a")); + + // now again fill row 4 partially + table.add_value(keys[0], 1); + + // and start a new row that also fills the remaining columns + table.start_new_row (); + + // do it again: + table.add_value(keys[0], 2); + table.start_new_row (); + + // produce output. hope that row 4 is + // completely padded + table.write_text(deallog.get_file_stream(), + TableHandler::org_mode_table); +} diff --git a/tests/base/table_handler_14.output b/tests/base/table_handler_14.output new file mode 100644 index 0000000000..4059e24e1e --- /dev/null +++ b/tests/base/table_handler_14.output @@ -0,0 +1,7 @@ + +| key1 | key2 | key3 | +| 0 | 0 | "" | +| 1 | 0 | "" | +| 2 | 113 | a | +| 1 | "" | "" | +| 2 | "" | "" |