]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New test.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 17 Oct 2011 08:58:45 +0000 (08:58 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 17 Oct 2011 08:58:45 +0000 (08:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@24613 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/base/table_handler_02.cc b/tests/base/table_handler_02.cc
new file mode 100644 (file)
index 0000000..4d5af41
--- /dev/null
@@ -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 <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_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 (file)
index 0000000..abe493a
--- /dev/null
@@ -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    

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.