diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 169b04fffe13..a4b3bb2a066d 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -79,6 +79,9 @@ jobs: METHOD: source swig: TASK: swig + cpp_tests: + TASK: cpp-tests + METHOD: with-sanitizers steps: - script: | echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" diff --git a/include/LightGBM/utils/common.h b/include/LightGBM/utils/common.h index 6c3ebf5d0096..9917cec3f290 100644 --- a/include/LightGBM/utils/common.h +++ b/include/LightGBM/utils/common.h @@ -41,7 +41,7 @@ #if defined(_MSC_VER) #include #elif MM_MALLOC -#include + #include // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html // https://www.oreilly.com/library/view/mac-os-x/0596003560/ch05s01s02.html #elif defined(__GNUC__) && defined(HAVE_MALLOC_H) @@ -49,9 +49,8 @@ #define _mm_malloc(a, b) memalign(b, a) #define _mm_free(a) free(a) #else -#include -#define _mm_malloc(a, b) malloc(a) -#define _mm_free(a) free(a) + #define _mm_malloc(a, b) malloc(a) + #define _mm_free(a) free(a) #endif namespace LightGBM { diff --git a/tests/cpp_tests/test_arrow.cpp b/tests/cpp_tests/test_arrow.cpp index c2dbd6cec6bf..29bff7dcddcb 100644 --- a/tests/cpp_tests/test_arrow.cpp +++ b/tests/cpp_tests/test_arrow.cpp @@ -151,13 +151,7 @@ class ArrowChunkedArrayTest : public testing::Test { /* ------------------------------------- SCHEMA CREATION ------------------------------------- */ - template - ArrowSchema create_primitive_schema() { - std::logic_error("not implemented"); - } - - template <> - ArrowSchema create_primitive_schema() { + ArrowSchema create_primitive_schema_float() { ArrowSchema schema; schema.format = "f"; schema.name = nullptr; @@ -171,8 +165,7 @@ class ArrowChunkedArrayTest : public testing::Test { return schema; } - template <> - ArrowSchema create_primitive_schema() { + ArrowSchema create_primitive_schema_bool() { ArrowSchema schema; schema.format = "b"; schema.name = nullptr; @@ -213,7 +206,7 @@ class ArrowChunkedArrayTest : public testing::Test { /* --------------------------------------------------------------------------------------------- */ TEST_F(ArrowChunkedArrayTest, GetLength) { - auto schema = create_primitive_schema(); + auto schema = create_primitive_schema_float(); std::vector dat1 = {1, 2}; auto arr1 = create_primitive_array(dat1); @@ -241,8 +234,8 @@ TEST_F(ArrowChunkedArrayTest, GetColumns) { std::vector arrs = {&arr1, &arr2}; auto arr = created_nested_array(arrs); - auto schema1 = create_primitive_schema(); - auto schema2 = create_primitive_schema(); + auto schema1 = create_primitive_schema_float(); + auto schema2 = create_primitive_schema_float(); std::vector schemas = {&schema1, &schema2}; auto schema = create_nested_schema(schemas); @@ -266,7 +259,7 @@ TEST_F(ArrowChunkedArrayTest, IteratorArithmetic) { auto arr2 = create_primitive_array(dat2); std::vector dat3 = {7}; auto arr3 = create_primitive_array(dat3); - auto schema = create_primitive_schema(); + auto schema = create_primitive_schema_float(); ArrowArray arrs[3] = {arr1, arr2, arr3}; ArrowChunkedArray ca(3, arrs, &schema); @@ -302,7 +295,7 @@ TEST_F(ArrowChunkedArrayTest, BooleanIterator) { auto arr1 = create_primitive_array(dat1, 0, {2}); std::vector dat2 = {false, false, false, false, true, true, true, true, false, true}; auto arr2 = create_primitive_array(dat2, 1); - auto schema = create_primitive_schema(); + auto schema = create_primitive_schema_bool(); ArrowArray arrs[2] = {arr1, arr2}; ArrowChunkedArray ca(2, arrs, &schema); @@ -328,7 +321,7 @@ TEST_F(ArrowChunkedArrayTest, BooleanIterator) { TEST_F(ArrowChunkedArrayTest, OffsetAndValidity) { std::vector dat = {0, 1, 2, 3, 4, 5, 6}; auto arr = create_primitive_array(dat, 2, {2, 3}); - auto schema = create_primitive_schema(); + auto schema = create_primitive_schema_float(); ArrowChunkedArray ca(1, &arr, &schema); auto it = ca.begin();