60 EmptyModifier() : Teuchos::ParameterListModifier(
"Empty Modifier"){}
73 const std::string base_name =
"foo", non_base_name =
"bar";
74 const std::string param1 = base_name, param2 = base_name +
" 1";
75 const std::string sub1 = base_name +
"_sublist";
76 pl.
set(non_base_name, 1);
77 pl.
set(non_base_name + base_name, 2);
85 matches = empty_modifier->findMatchingBaseNames(pl, base_name,
true,
false);
86 expected = Teuchos::tuple(param1, param2);
88 matches = empty_modifier->findMatchingBaseNames(pl, base_name,
false,
true);
89 expected = Teuchos::tuple(sub1);
97 const std::string param_template_name =
"Template Parameter";
99 valid_pl.
set(param_template_name, 1);
100 auto valid_pl_copy = valid_pl;
103 empty_modifier->expandParameters(param_template_name, pl, valid_pl);
105 expected_valid_pl.
set(
"A", 1);
106 expected_valid_pl.
set(
"B", 1);
107 TEST_ASSERT(haveSameValuesSorted(expected_valid_pl, valid_pl,
true));
109 valid_pl = valid_pl_copy;
112 empty_modifier->expandParameters(param_template_name, pl, valid_pl, tuple<std::string>(
"C",
"D"));
113 TEST_ASSERT(haveSameValuesSorted(expected_valid_pl, valid_pl,
true));
120 const std::string sublist_template_name =
"Template Sublist";
123 valid_pl.
set(
"var", 1);
124 valid_pl.
sublist(sublist_template_name);
125 auto valid_pl_copy = valid_pl;
129 empty_modifier->expandSublists(sublist_template_name, pl, valid_pl);
131 expected_valid_pl.
sublist(
"A");
132 expected_valid_pl.
sublist(
"B");
133 expected_valid_pl.
set(
"var", 1);
134 TEST_ASSERT(haveSameValuesSorted(expected_valid_pl, valid_pl,
true));
136 valid_pl = valid_pl_copy;
139 empty_modifier->expandSublists(sublist_template_name, pl, valid_pl, tuple<std::string>(
"C",
"D"));
140 TEST_ASSERT(haveSameValuesSorted(expected_valid_pl, valid_pl,
true));
148 const std::string base_name =
"A";
149 auto &vsub = valid_pl.
sublist(base_name, empty_modifier,
"Sublist A2");
154 empty_modifier->expandSublistsUsingBaseName(base_name, pl, valid_pl);
156 expected_valid_pl.
sublist(
"A1", empty_modifier,
"Sublist A2").
set(
"Val1", 1);
157 expected_valid_pl.
sublist(
"A2", empty_modifier,
"Sublist A2").
set(
"Val1", 1);
158 TEST_ASSERT(haveSameValuesSorted(expected_valid_pl, valid_pl,
true));
161 valid_pl = copy_valid_pl;
162 expected_valid_pl.
sublist(base_name, empty_modifier,
"Sublist A2").
set(
"Val1", 1);
163 empty_modifier->expandSublistsUsingBaseName(base_name, pl, valid_pl,
true);
164 TEST_ASSERT(haveSameValuesSorted(expected_valid_pl, valid_pl,
true));
166 valid_pl = copy_valid_pl;
167 TEST_THROW(empty_modifier->expandSublistsUsingBaseName(base_name, pl, valid_pl,
false), std::logic_error);
180 empty_modifier->setDefaultsInSublists(
"A", pl, tuple<std::string>(
"AA",
"AB"));
183 TEST_ASSERT(haveSameValuesSorted(expected_pl, pl,
true));
#define TEST_ASSERT(v1)
Assert the given statement is true.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Set a parameter whose value has type T.
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#define TEST_THROW(code, ExceptType)
Assert that the statement 'code' throws the exception 'ExceptType' (otherwise the test fails)...
Abstract interface for an object that can modify both a parameter list and the parameter list being u...
A std::string utilities class for Teuchos.
TEUCHOS_UNIT_TEST(ConstNonconstObjectContainer, create)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Templated Parameter List class.
A list of parameters of arbitrary type.
Parameter List Modifier class.
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Creates an empty sublist and returns a reference to the sublist name. If the list already exists...
Smart reference counting pointer class for automatic garbage collection.