diff --git a/src/mlpack/tests/main_tests/decision_tree_test.cpp b/src/mlpack/tests/main_tests/decision_tree_test.cpp index 18538d27f7..d5551def6a 100644 --- a/src/mlpack/tests/main_tests/decision_tree_test.cpp +++ b/src/mlpack/tests/main_tests/decision_tree_test.cpp @@ -9,7 +9,11 @@ * 3-clause BSD license along with mlpack. If not, see * http://www.opensource.org/licenses/BSD-3-Clause for more information. */ +#include + #define BINDING_TYPE BINDING_TYPE_TEST +static const std::string testName = "DecisionTree"; + #include #include #include @@ -19,31 +23,13 @@ using namespace mlpack; -namespace mlpack { -namespace bindings { -namespace tests { - -extern std::string programName; - -} -} -} - -// Utility function to set a parameter and mark it as passed, using copy -// semantics. -template -void SetInputParam(const std::string& name, const T& value) -{ - CLI::GetParam(name) = value; - CLI::SetPassed(name); -} - -// Utility function to set a parameter and mark it as passed, using move -// semantics. +// Utility function to set a parameter and mark it as passed, +// using copy semantics for lvalues and move semantics for rvalues template void SetInputParam(const std::string& name, T&& value) { - CLI::GetParam(name) = std::move(value); + CLI::GetParam::type>(name) + = std::forward(value); CLI::SetPassed(name); } @@ -53,7 +39,7 @@ struct DecisionTreeTestFixture DecisionTreeTestFixture() { // Cache in the options for this program. - CLI::RestoreSettings(mlpack::bindings::tests::programName); + CLI::RestoreSettings(testName); } ~DecisionTreeTestFixture()