* Use `UpdateAllowUnknown' for non-model related parameter. Model parameter can not pack an additional boolean value due to binary IO format. This commit deals only with non-model related parameter configuration. * Add tidy command line arg for use-dmlc-gtest.
20 lines
554 B
C++
20 lines
554 B
C++
// Copyright by Contributors
|
|
#include <gtest/gtest.h>
|
|
#include <xgboost/objective.h>
|
|
#include <xgboost/generic_parameters.h>
|
|
|
|
#include "../helpers.h"
|
|
|
|
TEST(Objective, UnknownFunction) {
|
|
xgboost::ObjFunction* obj = nullptr;
|
|
xgboost::GenericParameter tparam;
|
|
std::vector<std::pair<std::string, std::string>> args;
|
|
tparam.UpdateAllowUnknown(args);
|
|
|
|
EXPECT_ANY_THROW(obj = xgboost::ObjFunction::Create("unknown_name", &tparam));
|
|
EXPECT_NO_THROW(obj = xgboost::ObjFunction::Create("reg:squarederror", &tparam));
|
|
if (obj) {
|
|
delete obj;
|
|
}
|
|
}
|