// Copyright by Contributors #include #include #include #include "../helpers.h" TEST(Objective, UnknownFunction) { xgboost::ObjFunction* obj = nullptr; xgboost::GenericParameter tparam; std::vector> args; tparam.InitAllowUnknown(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; } }