From 88ab07083ce4d86d321ae015d0ec246b63dde014 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Thu, 30 Mar 2017 09:53:45 -0400 Subject: [PATCH] add test for parsing Map pattern in ParameterHandler I think this makes for a nice usage example. --- tests/parameter_handler/parameter_handler_13.cc | 10 ++++++++++ tests/parameter_handler/parameter_handler_13.output | 3 +++ 2 files changed, 13 insertions(+) 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' -- 2.39.5