]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add test for supercolumn output in TableHandler
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 16 Sep 2012 16:14:51 +0000 (16:14 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 16 Sep 2012 16:14:51 +0000 (16:14 +0000)
git-svn-id: https://svn.dealii.org/trunk@26404 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/table_handler_11.cc [new file with mode: 0644]
tests/base/table_handler_11/cmp/generic [new file with mode: 0644]

diff --git a/tests/base/table_handler_11.cc b/tests/base/table_handler_11.cc
new file mode 100644 (file)
index 0000000..3611a80
--- /dev/null
@@ -0,0 +1,57 @@
+//-----------------------------------------------------------------------------
+//    $Id: table_handler_06.cc 24924 2012-01-25 12:35:17Z kormann $
+//    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 supercolumns
+
+
+#include "../tests.h"
+#include <deal.II/base/data_out_base.h>
+#include <deal.II/base/table_handler.h>
+#include <deal.II/base/logstream.h>
+
+#include <vector>
+#include <iomanip>
+#include <fstream>
+#include <string>
+
+
+int main ()
+{
+  std::ofstream logfile("table_handler_11/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  TableHandler table;
+  table.set_auto_fill_mode (true);
+
+  std::string keys[] = { "key1", "key2", "key3", "key4", "key5" };
+
+  table.add_value(keys[0], 0.0);
+  table.add_value(keys[0], 1.0);
+  table.add_value(keys[1], 123.456);
+  table.add_value(keys[2], std::string("abc"));
+  table.add_value(keys[3], std::string("A"));
+  table.add_value(keys[4], 123456789.0);
+  
+  table.add_column_to_supercolumn("key1","short");
+  table.add_column_to_supercolumn("key2","short");
+  table.add_column_to_supercolumn("key3","very_long_supercolumn");
+  table.add_column_to_supercolumn("key4","very_long_supercolumn");
+
+  table.write_text(deallog.get_file_stream(),
+                  TableHandler::table_with_separate_column_description);
+
+  table.write_text(deallog.get_file_stream(),
+                  TableHandler::table_with_headers);  
+}
diff --git a/tests/base/table_handler_11/cmp/generic b/tests/base/table_handler_11/cmp/generic
new file mode 100644 (file)
index 0000000..e4cc24e
--- /dev/null
@@ -0,0 +1,15 @@
+
+# 1: key1
+# 2: key2
+# 3: key3
+0.0000 0.0000   ""  
+1.0000 0.0000   ""  
+2.0000 123.4560 abc 
+1.0000 0.0000   ""  
+# 1: key1
+# 2: key2
+# 3: key3
+0.0000e+00 0.0   ""  
+1.0000e+00 0.0   ""  
+2.0000e+00 123.5 abc 
+1.0000e+00 0.0   ""  

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.