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

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

diff --git a/tests/bits/parameter_handler_7.cc b/tests/bits/parameter_handler_7.cc
new file mode 100644 (file)
index 0000000..590672d
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  parameter_handler_7.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_7.cc  ---------------------------
+
+
+// test the output generated by ParameterHandler::print_parameters(Description)
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <base/parameter_handler.h>
+#include <fstream>
+#include <iomanip>
+
+
+int main ()
+{
+  try
+    {
+      std::ofstream logfile("parameter_handler_7/output");
+      deallog.attach(logfile);
+      deallog.depth_console(0);
+      deallog.threshold_double(1.e-10);
+
+      ParameterHandler prm;
+      prm.enter_subsection ("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",
+                         "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::Description);
+    }
+  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_7/cmp/generic b/tests/bits/parameter_handler_7/cmp/generic
new file mode 100644 (file)
index 0000000..eb7e1b7
--- /dev/null
@@ -0,0 +1,9 @@
+
+Listing of Parameters:
+
+subsection Testing
+  set double       =   [Floating point range -1.79769e+308...1.79769e+308 (inclusive)]
+                       (docs 3)
+  set int          =   [Integer range -2147483648...2147483647 (inclusive)]
+  set string list  =   list of <a|b|c|d|e|f|g|h> of length 0...4294967295 (inclusive)
+                       (docs 1)

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.