From cd482302946cf900d294d4fc8c3d3d2ae3041467 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 3 Oct 2023 20:12:35 -0500 Subject: [PATCH] fix compiler warnings for CPP tests --- tests/cpp_tests/test_byte_buffer.cpp | 6 +++--- tests/cpp_tests/testutils.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cpp_tests/test_byte_buffer.cpp b/tests/cpp_tests/test_byte_buffer.cpp index 98df661ddd31..83bbae8f0a1e 100644 --- a/tests/cpp_tests/test_byte_buffer.cpp +++ b/tests/cpp_tests/test_byte_buffer.cpp @@ -30,7 +30,7 @@ TEST(ByteBuffer, JustWorks) { EXPECT_EQ(cumulativeSize, buffer->GetSize()); int16_t serializedInt16 = 0; char* int16Ptr = reinterpret_cast(&serializedInt16); - for (int i = 0; i < sizeof(int16_t); i++) { + for (uint i = 0; i < sizeof(int16_t); i++) { int16Ptr[i] = buffer->GetAt(cumulativeSize - (sizeof(int16_t) - i)); } EXPECT_EQ(int16Val, serializedInt16); @@ -41,7 +41,7 @@ TEST(ByteBuffer, JustWorks) { EXPECT_EQ(cumulativeSize, buffer->GetSize()); int64_t serializedInt64 = 0; char* int64Ptr = reinterpret_cast(&serializedInt64); - for (int i = 0; i < sizeof(int64_t); i++) { + for (uint i = 0; i < sizeof(int64_t); i++) { int64Ptr[i] = buffer->GetAt(cumulativeSize - (sizeof(int64_t) - i)); } EXPECT_EQ(int64Val, serializedInt64); @@ -52,7 +52,7 @@ TEST(ByteBuffer, JustWorks) { EXPECT_EQ(cumulativeSize, buffer->GetSize()); double serializedDouble = 0; char* doublePtr = reinterpret_cast(&serializedDouble); - for (int i = 0; i < sizeof(double); i++) { + for (uint i = 0; i < sizeof(double); i++) { doublePtr[i] = buffer->GetAt(cumulativeSize - (sizeof(double) - i)); } EXPECT_EQ(doubleVal, serializedDouble); diff --git a/tests/cpp_tests/testutils.cpp b/tests/cpp_tests/testutils.cpp index f0b3e1c1f206..84acfe5b98a3 100644 --- a/tests/cpp_tests/testutils.cpp +++ b/tests/cpp_tests/testutils.cpp @@ -265,7 +265,7 @@ namespace LightGBM { groups_ptr, thread_count, t); - threads.push_back(move(th)); + threads.push_back(std::move(th)); } for (auto& t : threads) t.join();