]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 7 Sep 2010 23:34:25 +0000 (23:34 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 7 Sep 2010 23:34:25 +0000 (23:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@21872 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/bits/parameter_handler_9.cc b/tests/bits/parameter_handler_9.cc
new file mode 100644 (file)
index 0000000..65e5574
--- /dev/null
@@ -0,0 +1,99 @@
+//----------------------------  parameter_handler_9.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_9.cc  ---------------------------
+
+
+// test ParameterHandler::log_parameters(Text)
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <base/parameter_handler.h>
+#include <fstream>
+#include <iomanip>
+
+
+int main ()
+{
+  try
+    {
+      std::ofstream logfile("parameter_handler_9/output");
+      deallog.attach(logfile);
+      deallog.depth_console(0);
+      deallog.threshold_double(1.e-10);
+
+      ParameterHandler prm;
+      prm.enter_subsection ("Testing testing");
+      {
+       prm.declare_entry ("string list",
+                          "a",
+                          Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
+                          "docs 1");
+       prm.declare_entry ("int/int",
+                          "1",
+                          Patterns::Integer());
+       prm.declare_entry ("double_double",
+                          "3.1415926",
+                          Patterns::Double(),
+                          "docs 3");
+
+       prm.enter_subsection ("Testing%testing");
+       {
+         prm.declare_entry ("string&list",
+                            "a,b,c",
+                            Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
+                            "docs 1");
+         prm.declare_entry ("int*int",
+                            "2",
+                            Patterns::Integer());
+         prm.declare_entry ("double+double",
+                            "6.1415926",
+                            Patterns::Double(),
+                            "docs 3");
+       }
+       prm.leave_subsection ();
+      }
+      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_8.prm");
+      prm.log_parameters (deallog);
+    }
+  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_9/cmp/generic b/tests/bits/parameter_handler_9/cmp/generic
new file mode 100644 (file)
index 0000000..3b8d867
--- /dev/null
@@ -0,0 +1,24 @@
+
+# Listing of Parameters
+# ---------------------
+subsection Testing testing
+  # docs 3
+  set double_double = 3.1415926
+  set int/int       = 1
+
+  # docs 1
+  set string list   = a
+
+
+  subsection Testing%testing
+    # docs 3
+    set double+double = 3.1415926 # default: 6.1415926
+    set int*int       = 1         # default: 2
+
+    # docs 1
+    set string&list   = a         # default: a,b,c
+  end
+
+end
+
+

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.