From: Timo Heister Date: Thu, 30 Mar 2017 13:53:45 +0000 (-0400) Subject: add test for parsing Map pattern in ParameterHandler X-Git-Tag: v9.0.0-rc1~1763^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88ab07083ce4d86d321ae015d0ec246b63dde014;p=dealii.git add test for parsing Map pattern in ParameterHandler I think this makes for a nice usage example. --- diff --git a/tests/parameter_handler/parameter_handler_13.cc b/tests/parameter_handler/parameter_handler_13.cc index 5802caf13f..994fd4af3e 100644 --- a/tests/parameter_handler/parameter_handler_13.cc +++ b/tests/parameter_handler/parameter_handler_13.cc @@ -34,6 +34,16 @@ void check (const char *p) prm.read_input (in); deallog << "test_13=" << prm.get ("test_13") << std::endl; + + const std::vector split_entries = Utilities::split_string_list (prm.get ("test_13"), ','); + for (const std::string &entry : split_entries) + { + const std::vector parts = Utilities::split_string_list (entry, ':'); + const std::string key = parts[0]; + const std::string value = parts[1]; + deallog << " found key = '" << key << "' value = '" << value << "'" << std::endl; + } + } diff --git a/tests/parameter_handler/parameter_handler_13.output b/tests/parameter_handler/parameter_handler_13.output index 360228008c..1621b8d66a 100644 --- a/tests/parameter_handler/parameter_handler_13.output +++ b/tests/parameter_handler/parameter_handler_13.output @@ -1,2 +1,5 @@ DEAL::test_13=1 : b, 0: a, 1 : c +DEAL:: found key = '1' value = 'b' +DEAL:: found key = '0' value = 'a' +DEAL:: found key = '1' value = 'c'