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:
Jiaming Yuan
2019-03-13 02:25:51 +08:00
committed by GitHub
parent 259fb809e9
commit 7b9043cf71
41 changed files with 775 additions and 628 deletions

View File

@@ -13,7 +13,7 @@ TEST(SparsePage, PushCSC) {
offset = {0, 1, 4};
for (size_t i = 0; i < offset.back(); ++i) {
data.push_back(Entry(i, 0.1f));
data.emplace_back(Entry(i, 0.1f));
}
SparsePage other;
@@ -52,4 +52,4 @@ TEST(SparsePage, PushCSC) {
ASSERT_EQ(inst[i].index, indices_sol[i % 3]);
}
}
}
} // namespace xgboost

View File

@@ -27,7 +27,7 @@ TEST(SimpleDMatrix, RowAccess) {
xgboost::DMatrix * dmat = xgboost::DMatrix::Load(tmp_file, false, false);
// Loop over the batches and count the records
long row_count = 0;
int64_t row_count = 0;
for (auto &batch : dmat->GetRowBatches()) {
row_count += batch.Size();
}
@@ -54,7 +54,7 @@ TEST(SimpleDMatrix, ColAccessWithoutBatches) {
ASSERT_TRUE(dmat->SingleColBlock());
// Loop over the batches and assert the data is as expected
long num_col_batch = 0;
int64_t num_col_batch = 0;
for (const auto &batch : dmat->GetSortedColumnBatches()) {
num_col_batch += 1;
EXPECT_EQ(batch.Size(), dmat->Info().num_col_)

View File

@@ -1,6 +1,8 @@
// Copyright by Contributors
#include <xgboost/data.h>
#include <dmlc/filesystem.h>
#include <cinttypes>
#include "../../../src/data/sparse_page_dmatrix.h"
#include "../helpers.h"
@@ -33,7 +35,7 @@ TEST(SparsePageDMatrix, RowAccess) {
EXPECT_TRUE(FileExists(tmp_file + ".cache.row.page"));
// Loop over the batches and count the records
long row_count = 0;
int64_t row_count = 0;
for (auto &batch : dmat->GetRowBatches()) {
row_count += batch.Size();
}