Restore clang tidy test. (#8861)

This commit is contained in:
Jiaming Yuan
2023-03-04 05:47:04 +08:00
committed by GitHub
parent 2dc22e7aad
commit 4d665b3fb0
55 changed files with 216 additions and 205 deletions

View File

@@ -119,13 +119,13 @@ TEST(ArrayInterface, TrivialDim) {
}
TEST(ArrayInterface, ToDType) {
static_assert(ToDType<float>::kType == ArrayInterfaceHandler::kF4, "");
static_assert(ToDType<double>::kType == ArrayInterfaceHandler::kF8, "");
static_assert(ToDType<float>::kType == ArrayInterfaceHandler::kF4);
static_assert(ToDType<double>::kType == ArrayInterfaceHandler::kF8);
static_assert(ToDType<uint32_t>::kType == ArrayInterfaceHandler::kU4, "");
static_assert(ToDType<uint64_t>::kType == ArrayInterfaceHandler::kU8, "");
static_assert(ToDType<uint32_t>::kType == ArrayInterfaceHandler::kU4);
static_assert(ToDType<uint64_t>::kType == ArrayInterfaceHandler::kU8);
static_assert(ToDType<int32_t>::kType == ArrayInterfaceHandler::kI4, "");
static_assert(ToDType<int64_t>::kType == ArrayInterfaceHandler::kI8, "");
static_assert(ToDType<int32_t>::kType == ArrayInterfaceHandler::kI4);
static_assert(ToDType<int64_t>::kType == ArrayInterfaceHandler::kI8);
}
} // namespace xgboost

View File

@@ -21,7 +21,7 @@ TEST(SparsePage, PushCSC) {
offset = {0, 1, 4};
for (size_t i = 0; i < offset.back(); ++i) {
data.emplace_back(Entry(i, 0.1f));
data.emplace_back(i, 0.1f);
}
SparsePage other;

View File

@@ -189,8 +189,8 @@ TEST(SimpleCSRSource, FromColumnarSparse) {
auto& mask = column_bitfields[0];
mask.resize(8);
for (size_t j = 0; j < mask.size(); ++j) {
mask[j] = ~0;
for (auto && j : mask) {
j = ~0;
}
// the 2^th entry of first column is invalid
// [0 0 0 0 0 1 0 0]
@@ -201,8 +201,8 @@ TEST(SimpleCSRSource, FromColumnarSparse) {
auto& mask = column_bitfields[1];
mask.resize(8);
for (size_t j = 0; j < mask.size(); ++j) {
mask[j] = ~0;
for (auto && j : mask) {
j = ~0;
}
// the 19^th entry of second column is invalid
// [~0~], [~0~], [0 0 0 0 1 0 0 0]

View File

@@ -96,7 +96,7 @@ void TestRetainPage() {
// make sure it's const and the caller can not modify the content of page.
for (auto& page : m->GetBatches<Page>()) {
static_assert(std::is_const<std::remove_reference_t<decltype(page)>>::value, "");
static_assert(std::is_const<std::remove_reference_t<decltype(page)>>::value);
}
}

View File

@@ -1,5 +1,6 @@
// Copyright by Contributors
/**
* Copyright 2019-2023 by XGBoost Contributors
*/
#include "../../../src/common/compressed_iterator.h"
#include "../../../src/data/ellpack_page.cuh"
#include "../../../src/data/sparse_page_dmatrix.h"
@@ -69,7 +70,7 @@ TEST(SparsePageDMatrix, RetainEllpackPage) {
std::vector<std::shared_ptr<EllpackPage const>> iterators;
for (auto it = begin; it != end; ++it) {
iterators.push_back(it.Page());
gidx_buffers.emplace_back(HostDeviceVector<common::CompressedByteT>{});
gidx_buffers.emplace_back();
gidx_buffers.back().Resize((*it).Impl()->gidx_buffer.Size());
gidx_buffers.back().Copy((*it).Impl()->gidx_buffer);
}
@@ -87,7 +88,7 @@ TEST(SparsePageDMatrix, RetainEllpackPage) {
// make sure it's const and the caller can not modify the content of page.
for (auto& page : m->GetBatches<EllpackPage>({0, 32})) {
static_assert(std::is_const<std::remove_reference_t<decltype(page)>>::value, "");
static_assert(std::is_const<std::remove_reference_t<decltype(page)>>::value);
}
// The above iteration clears out all references inside DMatrix.