]> https://gitweb.dealii.org/ - dealii.git/commitdiff
new test
authorweiler <weiler@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 27 Aug 2010 15:28:39 +0000 (15:28 +0000)
committerweiler <weiler@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 27 Aug 2010 15:28:39 +0000 (15:28 +0000)
git-svn-id: https://svn.dealii.org/trunk@21752 0785d39b-7218-0410-832d-ea1e28bc413d

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

index c657cb114363865fcd0c4715a881c408e5da7b16..08127dedd9c8c684f2e30ad2d144e7427b1b16fd 100644 (file)
@@ -72,6 +72,7 @@ tests_x =  geometry_info_* \
           named_data \
           slice_vector \
           table \
+          table_handler* \
           tensor \
           tensor_* \
           point_* \
diff --git a/tests/base/table_handler_01.cc b/tests/base/table_handler_01.cc
new file mode 100644 (file)
index 0000000..bb88649
--- /dev/null
@@ -0,0 +1,56 @@
+//-----------------------------------------------------------------------------
+//    $Id: table_handler_01.cc 20952 2010-04-06 15:02:46Z bangerth $
+//    Version: $Name$ 
+//
+//    Copyright (C) 2010 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.
+//
+//-----------------------------------------------------------------------------
+
+#include "../tests.h"
+#include <base/data_out_base.h>
+#include <base/table_handler.h>
+#include <base/logstream.h>
+
+#include <vector>
+#include <iomanip>
+#include <fstream>
+#include <string>
+
+// test the method set_tex_table_caption
+// it creates a caption for the whole table
+
+int main ()
+{
+  std::ofstream logfile("table_handler_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  TableHandler table;
+
+  for (unsigned int i=1; i<=10; ++i)
+  {
+    table.add_value("numbers", i);
+    table.add_value("squares", i*i);
+    table.add_value("square roots", sqrt(i));
+  }
+
+  table.set_tex_table_caption("This is a caption text with \\LaTeX{} symbols");
+
+                                 // output
+  std::ofstream out("table_handler_01/outfile.tex");
+  table.write_tex(out);
+  std::ifstream in("table_handler_01/outfile.tex");
+  while (in)
+    {
+      std::string s;
+      std::getline(in, s);
+      deallog.get_file_stream() << s << "\n";
+    }
+
+}
diff --git a/tests/base/table_handler_01/cmp/generic b/tests/base/table_handler_01/cmp/generic
new file mode 100644 (file)
index 0000000..e5b1556
--- /dev/null
@@ -0,0 +1,26 @@
+
+\documentclass[10pt]{report}
+\usepackage{float}
+
+
+\begin{document}
+\begin{table}[H]
+\begin{center}
+\begin{tabular}{|c|c|c|} \hline
+numbers & squares & square roots\\ \hline
+1 & 1 & 1.0000\\ \hline
+2 & 4 & 1.4142\\ \hline
+3 & 9 & 1.7321\\ \hline
+4 & 16 & 2.0000\\ \hline
+5 & 25 & 2.2361\\ \hline
+6 & 36 & 2.4495\\ \hline
+7 & 49 & 2.6458\\ \hline
+8 & 64 & 2.8284\\ \hline
+9 & 81 & 3.0000\\ \hline
+10 & 100 & 3.1623\\ \hline
+\end{tabular}
+\end{center}
+\caption{This is a caption text with \LaTeX{} symbols}
+\end{table}
+\end{document}
+

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.