]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New test.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 7 Sep 2010 19:58:26 +0000 (19:58 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 7 Sep 2010 19:58:26 +0000 (19:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@21866 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/parameter_handler_4a.cc [new file with mode: 0644]
tests/bits/parameter_handler_4a/cmp/generic [new file with mode: 0644]

diff --git a/tests/bits/parameter_handler_4a.cc b/tests/bits/parameter_handler_4a.cc
new file mode 100644 (file)
index 0000000..58287ed
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  parameter_handler_4a.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003, 2004, 2005, 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.
+//
+//----------------------------  parameter_handler_4a.cc  ---------------------------
+
+
+// test the output generated by
+// ParameterHandler::print_parameters(LaTeX). like the _4 test but
+// with nested subsections
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <base/parameter_handler.h>
+#include <fstream>
+#include <iomanip>
+
+
+int main ()
+{
+  try
+    {
+      std::ofstream logfile("parameter_handler_4a/output");
+      deallog.attach(logfile);
+      deallog.depth_console(0);
+      deallog.threshold_double(1.e-10);
+
+      ParameterHandler prm;
+      prm.enter_subsection ("Testing");
+      {
+       prm.enter_subsection ("Testing 2");
+       {
+         prm.declare_entry ("string list 2",
+                            "a",
+                            Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
+                            "docs 1");
+         prm.declare_entry ("int 2",
+                            "1",
+                            Patterns::Integer());
+         prm.declare_entry ("double 2",
+                            "3.1415926",
+                            Patterns::Double(),
+                            "docs 3");
+       }
+       prm.leave_subsection ();
+
+       prm.declare_entry ("string list",
+                          "a",
+                          Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
+                          "docs 1");
+       prm.declare_entry ("int",
+                          "1",
+                          Patterns::Integer());
+       prm.declare_entry ("double",
+                          "3.1415926",
+                          Patterns::Double(),
+                          "docs 3");
+      }
+      prm.leave_subsection ();
+
+                                       // read and then write
+                                       // parameters. take same input file
+                                       // as for parameter_handler_3, but
+                                       // use different output format
+      prm.read_input("parameter_handler_3.prm");
+      prm.print_parameters (logfile, ParameterHandler::LaTeX);
+    }
+  catch (std::exception &exc)
+    {
+      deallog << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      deallog << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+
+      return 1;
+    }
+  catch (...)
+    {
+      deallog << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      deallog << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+
+  return 0;
+}
diff --git a/tests/bits/parameter_handler_4a/cmp/generic b/tests/bits/parameter_handler_4a/cmp/generic
new file mode 100644 (file)
index 0000000..79ccd38
--- /dev/null
@@ -0,0 +1,21 @@
+
+\subsubsection*{Listing of parameters}
+
+\begin{itemize}
+
+\item {\bf Subsection Testing}
+\begin{itemize}
+\item {\bf double:} 3.1415926 (docs 3, {\it default:} 3.1415926)
+\item {\bf int:} 1 ({\it default:} 3)
+\item {\bf string list:} a (docs 1, {\it default:} a, b, c)
+
+
+
+\item {\bf Subsection Testing 2}
+\begin{itemize}
+\item {\bf double 2:} 3.1415926 (docs 3, {\it default:} 3.1415926)
+\item {\bf int 2:} 1 ({\it default:} 1)
+\item {\bf string list 2:} a (docs 1, {\it default:} a)
+\end{itemize}
+\end{itemize}
+\end{itemize}

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.