From 803dae78f3fdae8609ce46a06dd2749aa4c15aa5 Mon Sep 17 00:00:00 2001 From: heister Date: Fri, 28 Feb 2014 15:25:33 +0000 Subject: [PATCH] add failing parameter_handler test git-svn-id: https://svn.dealii.org/trunk@32587 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/parameter_handler_18.cc | 56 ++++++++++++++++++++++++++ tests/bits/parameter_handler_18.output | 3 ++ tests/bits/parameter_handler_18.prm | 6 +++ 3 files changed, 65 insertions(+) create mode 100644 tests/bits/parameter_handler_18.cc create mode 100644 tests/bits/parameter_handler_18.output create mode 100644 tests/bits/parameter_handler_18.prm diff --git a/tests/bits/parameter_handler_18.cc b/tests/bits/parameter_handler_18.cc new file mode 100644 index 0000000000..2ddd07e040 --- /dev/null +++ b/tests/bits/parameter_handler_18.cc @@ -0,0 +1,56 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2002 - 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. +// +// --------------------------------------------------------------------- + + + +// ParameterHandler could not deal with missing endline at end of file +// or can it? +// http://code.google.com/p/dealii/issues/detail?id=126 + +// this is a variant of parameter_handler_15 but in fact reads data +// from a file + +#include "../tests.h" +#include +#include +#include + +void test () +{ + ParameterHandler foo; + foo.enter_subsection("bar"); + foo.declare_entry("val", "1.0", dealii::Patterns::Double(), ""); + foo.leave_subsection(); + + bool okay = foo.read_input(SOURCE_DIR "/parameter_handler_18.prm"); + Assert(okay, ExcMessage("read_input failed")); + + foo.enter_subsection("bar"); + deallog << foo.get ("val") << std::endl; + foo.leave_subsection(); +} + +int main () +{ + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test (); + + return 0; +} diff --git a/tests/bits/parameter_handler_18.output b/tests/bits/parameter_handler_18.output new file mode 100644 index 0000000000..a78af0213a --- /dev/null +++ b/tests/bits/parameter_handler_18.output @@ -0,0 +1,3 @@ + +DEAL::1.0 +DEAL::42 diff --git a/tests/bits/parameter_handler_18.prm b/tests/bits/parameter_handler_18.prm new file mode 100644 index 0000000000..5e405fef3e --- /dev/null +++ b/tests/bits/parameter_handler_18.prm @@ -0,0 +1,6 @@ +# Listing of Parameters +# --------------------- + +subsection bar + +end \ No newline at end of file -- 2.39.5