]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 25 Aug 2013 04:45:54 +0000 (04:45 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 25 Aug 2013 04:45:54 +0000 (04:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@30473 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/bits/parameter_handler_2_read_from_string.cc b/tests/bits/parameter_handler_2_read_from_string.cc
new file mode 100644 (file)
index 0000000..a30a129
--- /dev/null
@@ -0,0 +1,60 @@
+// ---------------------------------------------------------------------
+// $Id$
+//
+// Copyright (C) 2003 - 2013 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+
+// like _02, but use the read_input_from_string function
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/parameter_handler.h>
+#include <fstream>
+
+
+int main ()
+{
+  std::ofstream logfile("parameter_handler_2_read_from_string/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  ParameterHandler prm;
+  prm.enter_subsection ("Testing");
+  prm.declare_entry ("Function",
+                     "a",
+                     Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")));
+  prm.leave_subsection ();
+
+  std::string input;
+  std::ifstream in("parameter_handler_2_read_from_string/prm");
+  while (in)
+    {
+      std::string s;
+      std::getline (in, s);
+      input += s;
+      input += '\n';
+    }
+  prm.read_input_from_string(input.c_str());
+
+  std::string list;
+  prm.enter_subsection ("Testing");
+  list = prm.get ("Function");
+  prm.leave_subsection ();
+
+  deallog << list << std::endl;
+
+  return 0;
+}
diff --git a/tests/bits/parameter_handler_2_read_from_string/cmp/generic b/tests/bits/parameter_handler_2_read_from_string/cmp/generic
new file mode 100644 (file)
index 0000000..9eb091f
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::a, b, c
diff --git a/tests/bits/parameter_handler_2_read_from_string/prm b/tests/bits/parameter_handler_2_read_from_string/prm
new file mode 100644 (file)
index 0000000..024b10b
--- /dev/null
@@ -0,0 +1,5 @@
+#Listing of Parameters
+#---------------------
+subsection Testing
+  set Function = a, b, c
+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.