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.
This commit is contained in:
@@ -4,8 +4,10 @@
|
||||
#include "../helpers.h"
|
||||
|
||||
TEST(Objective, UnknownFunction) {
|
||||
xgboost::ObjFunction* obj;
|
||||
xgboost::ObjFunction* obj = nullptr;
|
||||
EXPECT_ANY_THROW(obj = xgboost::ObjFunction::Create("unknown_name"));
|
||||
EXPECT_NO_THROW(obj = xgboost::ObjFunction::Create("reg:linear"));
|
||||
delete obj;
|
||||
if (obj) {
|
||||
delete obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ TEST(Objective, DeclareUnifiedTest(LogisticRawGPair)) {
|
||||
TEST(Objective, DeclareUnifiedTest(PoissonRegressionGPair)) {
|
||||
xgboost::ObjFunction * obj = xgboost::ObjFunction::Create("count:poisson");
|
||||
std::vector<std::pair<std::string, std::string> > args;
|
||||
args.push_back(std::make_pair("max_delta_step", "0.1f"));
|
||||
args.emplace_back(std::make_pair("max_delta_step", "0.1f"));
|
||||
obj->Configure(args);
|
||||
CheckObjFunction(obj,
|
||||
{ 0, 0.1f, 0.9f, 1, 0, 0.1f, 0.9f, 1},
|
||||
@@ -176,7 +176,7 @@ TEST(Objective, DeclareUnifiedTest(GammaRegressionBasic)) {
|
||||
TEST(Objective, DeclareUnifiedTest(TweedieRegressionGPair)) {
|
||||
xgboost::ObjFunction * obj = xgboost::ObjFunction::Create("reg:tweedie");
|
||||
std::vector<std::pair<std::string, std::string> > args;
|
||||
args.push_back(std::make_pair("tweedie_variance_power", "1.1f"));
|
||||
args.emplace_back(std::make_pair("tweedie_variance_power", "1.1f"));
|
||||
obj->Configure(args);
|
||||
CheckObjFunction(obj,
|
||||
{ 0, 0.1f, 0.9f, 1, 0, 0.1f, 0.9f, 1},
|
||||
|
||||
Reference in New Issue
Block a user