xgboost/tests/cpp/objective/test_objective.cc
Jiaming Yuan 7b9043cf71
Fix clang-tidy warnings. (#4149)
* Upgrade gtest for clang-tidy.
* Use CMake to install GTest instead of mv.
* Don't enforce clang-tidy to return 0 due to errors in thrust.
* Add a small test for tidy itself.

* Reformat.
2019-03-13 02:25:51 +08:00

14 lines
336 B
C++

// Copyright by Contributors
#include <xgboost/objective.h>
#include "../helpers.h"
TEST(Objective, UnknownFunction) {
xgboost::ObjFunction* obj = nullptr;
EXPECT_ANY_THROW(obj = xgboost::ObjFunction::Create("unknown_name"));
EXPECT_NO_THROW(obj = xgboost::ObjFunction::Create("reg:linear"));
if (obj) {
delete obj;
}
}