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);
88 matches = empty_modifier->findMatchingBaseNames(pl, base_name,
false,
true);
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);
109 valid_pl = valid_pl_copy;
112 empty_modifier->expandParameters(param_template_name, pl, valid_pl,
tuple<std::string>(
"C",
"D"));
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);
136 valid_pl = valid_pl_copy;
139 empty_modifier->expandSublists(sublist_template_name, pl, valid_pl,
tuple<std::string>(
"C",
"D"));
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);
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);
166 valid_pl = copy_valid_pl;
167 TEST_THROW(empty_modifier->expandSublistsUsingBaseName(base_name, pl, valid_pl,
false), std::logic_error);
#define TEST_ASSERT(v1)
Assert the given statement is true.
#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).
Parameter List Modifier class.
Templated Parameter List class.
A std::string utilities class for Teuchos.
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes.
Abstract interface for an object that can modify both a parameter list and the parameter list being u...
A list of parameters of arbitrary type.
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,...
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.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT bool haveSameValuesSorted(const ParameterList &list1, const ParameterList &list2, bool verbose=false)
Returns true if two parameter lists have the same values independent of ordering.
Smart reference counting pointer class for automatic garbage collection.
Tuple< T, 1 > tuple(const T &a)
Create a Tuple<T,1>.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.