From a70b8ce49c80676e82619b33c4b55b3333994396 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 9 Apr 2017 19:37:34 -0600 Subject: [PATCH] Add test. --- tests/base/table_handler_14.cc | 65 ++++++++++++++++++++++++++++++ tests/base/table_handler_14.output | 7 ++++ 2 files changed, 72 insertions(+) create mode 100644 tests/base/table_handler_14.cc create mode 100644 tests/base/table_handler_14.output 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 | "" | "" | -- 2.39.5