From 321d983fa85782ba10062216f5ee7bc828e37289 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 25 Aug 2013 04:45:54 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@30473 0785d39b-7218-0410-832d-ea1e28bc413d --- .../parameter_handler_2_read_from_string.cc | 60 +++++++++++++++++++ .../cmp/generic | 2 + .../parameter_handler_2_read_from_string/prm | 5 ++ 3 files changed, 67 insertions(+) create mode 100644 tests/bits/parameter_handler_2_read_from_string.cc create mode 100644 tests/bits/parameter_handler_2_read_from_string/cmp/generic create mode 100644 tests/bits/parameter_handler_2_read_from_string/prm 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 index 0000000000..a30a129567 --- /dev/null +++ b/tests/bits/parameter_handler_2_read_from_string.cc @@ -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 +#include +#include + + +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 index 0000000000..9eb091f67d --- /dev/null +++ b/tests/bits/parameter_handler_2_read_from_string/cmp/generic @@ -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 index 0000000000..024b10b848 --- /dev/null +++ b/tests/bits/parameter_handler_2_read_from_string/prm @@ -0,0 +1,5 @@ +#Listing of Parameters +#--------------------- +subsection Testing + set Function = a, b, c +end -- 2.39.5