diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 8bde0bcfb9b..bfabbbc625d 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -693,7 +693,6 @@ add_library( tests/utilities/base_fixture.cpp tests/utilities/column_utilities.cu tests/utilities/table_utilities.cu - tests/strings/utilities.cpp ) set_target_properties( diff --git a/cpp/include/cudf_test/column_utilities.hpp b/cpp/include/cudf_test/column_utilities.hpp index d41ea530402..b7d890fb315 100644 --- a/cpp/include/cudf_test/column_utilities.hpp +++ b/cpp/include/cudf_test/column_utilities.hpp @@ -107,6 +107,13 @@ bool expect_columns_equivalent(cudf::column_view const& lhs, debug_output_level verbosity = debug_output_level::FIRST_ERROR, size_type fp_ulps = cudf::test::default_ulp); +/** + * @brief Verifies the given column is empty + * + * @param col The column to check + */ +void expect_column_empty(cudf::column_view const& col); + /** * @brief Verifies the bitwise equality of two device memory buffers. * diff --git a/cpp/tests/copying/detail_gather_tests.cu b/cpp/tests/copying/detail_gather_tests.cu index e3cd975ab41..9cd74abce1c 100644 --- a/cpp/tests/copying/detail_gather_tests.cu +++ b/cpp/tests/copying/detail_gather_tests.cu @@ -13,7 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include + +#include +#include +#include +#include +#include +#include #include #include @@ -24,13 +30,6 @@ #include #include -#include -#include -#include -#include -#include -#include - #include #include diff --git a/cpp/tests/copying/gather_list_tests.cpp b/cpp/tests/copying/gather_list_tests.cpp index b26ee90c3b9..1caecb558e2 100644 --- a/cpp/tests/copying/gather_list_tests.cpp +++ b/cpp/tests/copying/gather_list_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include + +#include +#include +#include +#include +#include +#include #include #include @@ -23,13 +29,6 @@ #include #include -#include -#include -#include -#include -#include -#include - template class GatherTestListTyped : public cudf::test::BaseFixture { }; diff --git a/cpp/tests/copying/gather_str_tests.cpp b/cpp/tests/copying/gather_str_tests.cpp index a9a9a4f9342..4e4e9619fbf 100644 --- a/cpp/tests/copying/gather_str_tests.cpp +++ b/cpp/tests/copying/gather_str_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include -#include -#include -#include #include #include #include #include #include -#include + +#include +#include +#include +#include +#include class GatherTestStr : public cudf::test::BaseFixture { }; @@ -135,7 +135,7 @@ TEST_F(GatherTestStr, GatherEmptyMapStringsColumn) gather_map, cudf::out_of_bounds_policy::NULLIFY, cudf::detail::negative_index_policy::NOT_ALLOWED); - cudf::test::expect_strings_empty(results->get_column(0).view()); + cudf::test::expect_column_empty(results->get_column(0).view()); } TEST_F(GatherTestStr, GatherZeroSizeStringsColumn) diff --git a/cpp/tests/copying/gather_tests.cpp b/cpp/tests/copying/gather_tests.cpp index 141503ed978..9c8d6102000 100644 --- a/cpp/tests/copying/gather_tests.cpp +++ b/cpp/tests/copying/gather_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,13 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include - -#include -#include -#include -#include -#include #include #include @@ -28,6 +21,12 @@ #include #include +#include +#include +#include +#include +#include + template class GatherTest : public cudf::test::BaseFixture { }; diff --git a/cpp/tests/copying/scatter_list_tests.cpp b/cpp/tests/copying/scatter_list_tests.cpp index 0c12f10137a..179ab56fc40 100644 --- a/cpp/tests/copying/scatter_list_tests.cpp +++ b/cpp/tests/copying/scatter_list_tests.cpp @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#include +#include +#include +#include +#include +#include #include #include @@ -24,13 +29,6 @@ #include #include -#include -#include -#include -#include -#include -#include - template class TypedScatterListsTest : public cudf::test::BaseFixture { }; diff --git a/cpp/tests/lists/extract_tests.cpp b/cpp/tests/lists/extract_tests.cpp index 210a5814ede..34c8e044a3f 100644 --- a/cpp/tests/lists/extract_tests.cpp +++ b/cpp/tests/lists/extract_tests.cpp @@ -14,16 +14,15 @@ * limitations under the License. */ -#include -#include -#include - #include #include #include #include #include -#include + +#include +#include +#include #include diff --git a/cpp/tests/reshape/interleave_columns_tests.cpp b/cpp/tests/reshape/interleave_columns_tests.cpp index c682e4ab29f..63e465f7658 100644 --- a/cpp/tests/reshape/interleave_columns_tests.cpp +++ b/cpp/tests/reshape/interleave_columns_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,12 @@ * limitations under the License. */ -#include #include #include #include #include -#include +#include #include using namespace cudf::test::iterators; @@ -195,7 +194,7 @@ TEST_F(InterleaveStringsColumnsTest, ZeroSizedColumns) cudf::column_view col0(cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); auto results = cudf::interleave_columns(cudf::table_view{{col0}}); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(InterleaveStringsColumnsTest, SingleColumn) diff --git a/cpp/tests/strings/array_tests.cpp b/cpp/tests/strings/array_tests.cpp index 10cc4562be7..488184f4099 100644 --- a/cpp/tests/strings/array_tests.cpp +++ b/cpp/tests/strings/array_tests.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -#include - #include #include #include @@ -53,7 +51,7 @@ TEST_F(StringsColumnTest, SortZeroSizeStringsColumn) cudf::column_view zero_size_strings_column( cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); auto results = cudf::sort(cudf::table_view({zero_size_strings_column})); - cudf::test::expect_strings_empty(results->view().column(0)); + cudf::test::expect_column_empty(results->view().column(0)); } class SliceParmsTest : public StringsColumnTest, @@ -123,7 +121,7 @@ TEST_F(StringsColumnTest, SliceZeroSizeStringsColumn) cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); auto strings_view = cudf::strings_column_view(zero_size_strings_column); auto results = cudf::strings::detail::copy_slice(strings_view, 1, 2); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsColumnTest, Gather) @@ -151,7 +149,7 @@ TEST_F(StringsColumnTest, GatherZeroSizeStringsColumn) cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); cudf::column_view map_view(cudf::data_type{cudf::type_id::INT32}, 0, nullptr, nullptr, 0); auto results = cudf::gather(cudf::table_view{{zero_size_strings_column}}, map_view)->release(); - cudf::test::expect_strings_empty(results.front()->view()); + cudf::test::expect_column_empty(results.front()->view()); } TEST_F(StringsColumnTest, GatherTooBig) @@ -204,12 +202,12 @@ TEST_F(StringsColumnTest, ScatterZeroSizeStringsColumn) cudf::column_view scatter_map(cudf::data_type{cudf::type_id::INT8}, 0, nullptr, nullptr, 0); auto results = cudf::scatter(cudf::table_view({source}), scatter_map, cudf::table_view({target})); - cudf::test::expect_strings_empty(results->view().column(0)); + cudf::test::expect_column_empty(results->view().column(0)); cudf::string_scalar scalar(""); auto scalar_source = std::vector>({scalar}); results = cudf::scatter(scalar_source, scatter_map, cudf::table_view({target})); - cudf::test::expect_strings_empty(results->view().column(0)); + cudf::test::expect_column_empty(results->view().column(0)); } TEST_F(StringsColumnTest, OffsetsBeginEnd) diff --git a/cpp/tests/strings/booleans_tests.cpp b/cpp/tests/strings/booleans_tests.cpp index cc637bf55a0..b8e47a89274 100644 --- a/cpp/tests/strings/booleans_tests.cpp +++ b/cpp/tests/strings/booleans_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,12 @@ * limitations under the License. */ -#include -#include #include #include #include -#include + +#include +#include #include @@ -69,7 +69,7 @@ TEST_F(StringsConvertTest, ZeroSizeStringsColumnBoolean) { cudf::column_view zero_size_column(cudf::data_type{cudf::type_id::BOOL8}, 0, nullptr, nullptr, 0); auto results = cudf::strings::from_booleans(zero_size_column); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsConvertTest, ZeroSizeBooleansColumn) diff --git a/cpp/tests/strings/case_tests.cpp b/cpp/tests/strings/case_tests.cpp index c399c640bb6..26b44b577eb 100644 --- a/cpp/tests/strings/case_tests.cpp +++ b/cpp/tests/strings/case_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,16 +14,15 @@ * limitations under the License. */ +#include +#include +#include + #include #include #include #include -#include -#include -#include -#include - #include #include @@ -211,19 +210,19 @@ TEST_F(StringsCaseTest, EmptyStringsColumn) auto strings_view = cudf::strings_column_view(zero_size_strings_column); auto results = cudf::strings::to_lower(strings_view); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); results = cudf::strings::to_upper(strings_view); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); results = cudf::strings::swapcase(strings_view); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); results = cudf::strings::capitalize(strings_view); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); results = cudf::strings::title(strings_view); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsCaseTest, ErrorTest) diff --git a/cpp/tests/strings/combine/concatenate_tests.cpp b/cpp/tests/strings/combine/concatenate_tests.cpp index 569767531bc..0b744cd6bb4 100644 --- a/cpp/tests/strings/combine/concatenate_tests.cpp +++ b/cpp/tests/strings/combine/concatenate_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,10 @@ * limitations under the License. */ +#include +#include +#include + #include #include #include @@ -21,11 +25,6 @@ #include #include -#include -#include -#include -#include - #include constexpr cudf::test::debug_output_level verbosity{cudf::test::debug_output_level::ALL_ERRORS}; @@ -158,7 +157,7 @@ TEST_F(StringsCombineTest, ConcatZeroSizeStringsColumns) strings_columns.push_back(zero_size_strings_column); cudf::table_view table(strings_columns); auto results = cudf::strings::concatenate(table); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsCombineTest, SingleColumnErrorCheck) @@ -207,7 +206,7 @@ TEST_F(StringsConcatenateWithColSeparatorTest, ZeroSizedColumns) auto results = cudf::strings::concatenate(cudf::table_view{{col0}}, cudf::strings_column_view(col0)); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsConcatenateWithColSeparatorTest, SingleColumnEmptyAndNullStringsNoReplacements) diff --git a/cpp/tests/strings/combine/join_strings_tests.cpp b/cpp/tests/strings/combine/join_strings_tests.cpp index e018540e84c..e0187ce2e26 100644 --- a/cpp/tests/strings/combine/join_strings_tests.cpp +++ b/cpp/tests/strings/combine/join_strings_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,17 +14,16 @@ * limitations under the License. */ +#include +#include +#include + #include #include #include #include #include -#include -#include -#include -#include - #include struct JoinStringsTest : public cudf::test::BaseFixture { @@ -66,7 +65,7 @@ TEST_F(JoinStringsTest, JoinZeroSizeStringsColumn) cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); auto strings_view = cudf::strings_column_view(zero_size_strings_column); auto results = cudf::strings::join_strings(strings_view); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(JoinStringsTest, JoinAllNullStringsColumn) diff --git a/cpp/tests/strings/concatenate_tests.cpp b/cpp/tests/strings/concatenate_tests.cpp index 0318fc3edb9..1462d4dc73a 100644 --- a/cpp/tests/strings/concatenate_tests.cpp +++ b/cpp/tests/strings/concatenate_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,13 @@ * limitations under the License. */ -#include -#include -#include - #include #include #include -#include + +#include +#include +#include #include @@ -76,7 +75,7 @@ TEST_F(StringsConcatenateTest, ZeroSizeStringsColumns) strings_columns.push_back(zero_size_strings_column); strings_columns.push_back(zero_size_strings_column); auto results = cudf::strings::detail::concatenate(strings_columns); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsConcatenateTest, ZeroSizeStringsPlusNormal) diff --git a/cpp/tests/strings/datetime_tests.cpp b/cpp/tests/strings/datetime_tests.cpp index d8203917d4c..26beaf9756a 100644 --- a/cpp/tests/strings/datetime_tests.cpp +++ b/cpp/tests/strings/datetime_tests.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +#include +#include +#include + #include #include #include @@ -21,11 +25,6 @@ #include #include -#include -#include -#include -#include - #include #include @@ -573,7 +572,7 @@ TEST_F(StringsDatetimeTest, ZeroSizeStringsColumn) cudf::column_view zero_size_column( cudf::data_type{cudf::type_id::TIMESTAMP_SECONDS}, 0, nullptr, nullptr, 0); auto results = cudf::strings::from_timestamps(zero_size_column); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); cudf::column_view zero_size_strings_column( cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); diff --git a/cpp/tests/strings/durations_tests.cpp b/cpp/tests/strings/durations_tests.cpp index 523c64159f4..ac971aa300d 100644 --- a/cpp/tests/strings/durations_tests.cpp +++ b/cpp/tests/strings/durations_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,13 @@ * limitations under the License. */ -#include -#include -#include - #include #include #include -#include + +#include +#include +#include #include #include @@ -732,7 +731,7 @@ TEST_F(StringsDurationsTest, ZeroSizeStringsColumn) cudf::column_view zero_size_column( cudf::data_type{cudf::type_id::DURATION_SECONDS}, 0, nullptr, nullptr, 0); auto results = cudf::strings::from_durations(zero_size_column); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); cudf::column_view zero_size_strings_column( cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); diff --git a/cpp/tests/strings/extract_tests.cpp b/cpp/tests/strings/extract_tests.cpp index 49a0c51e14f..e396ca42d6c 100644 --- a/cpp/tests/strings/extract_tests.cpp +++ b/cpp/tests/strings/extract_tests.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -#include - #include #include #include diff --git a/cpp/tests/strings/factories_test.cu b/cpp/tests/strings/factories_test.cu index 36fdd423168..a381c1cff89 100644 --- a/cpp/tests/strings/factories_test.cu +++ b/cpp/tests/strings/factories_test.cu @@ -14,6 +14,10 @@ * limitations under the License. */ +#include +#include +#include + #include #include #include @@ -24,10 +28,6 @@ #include #include #include -#include -#include -#include -#include #include #include @@ -188,12 +188,12 @@ TEST_F(StringsFactoriesTest, EmptyStringsColumn) rmm::device_uvector d_nulls{0, cudf::default_stream_value}; auto results = cudf::make_strings_column(d_chars, d_offsets, d_nulls, 0); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); rmm::device_uvector> d_strings{ 0, cudf::default_stream_value}; results = cudf::make_strings_column(d_strings); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } namespace { diff --git a/cpp/tests/strings/fill_tests.cpp b/cpp/tests/strings/fill_tests.cpp index 44bbb3c9c29..46f6b633dc5 100644 --- a/cpp/tests/strings/fill_tests.cpp +++ b/cpp/tests/strings/fill_tests.cpp @@ -14,16 +14,15 @@ * limitations under the License. */ +#include +#include +#include + #include #include #include #include -#include -#include -#include -#include - #include #include @@ -83,7 +82,7 @@ TEST_F(StringsFillTest, ZeroSizeStringsColumns) cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); auto results = cudf::strings::detail::fill( cudf::strings_column_view(zero_size_strings_column), 0, 1, cudf::string_scalar("")); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsFillTest, FillRangeError) diff --git a/cpp/tests/strings/findall_tests.cpp b/cpp/tests/strings/findall_tests.cpp index b55d0977215..1dd088cb70f 100644 --- a/cpp/tests/strings/findall_tests.cpp +++ b/cpp/tests/strings/findall_tests.cpp @@ -14,13 +14,13 @@ * limitations under the License. */ -#include -#include #include #include #include #include -#include + +#include +#include #include diff --git a/cpp/tests/strings/fixed_point_tests.cpp b/cpp/tests/strings/fixed_point_tests.cpp index 81122b1c5d8..15c12421dd9 100644 --- a/cpp/tests/strings/fixed_point_tests.cpp +++ b/cpp/tests/strings/fixed_point_tests.cpp @@ -14,17 +14,16 @@ * limitations under the License. */ -#include -#include -#include - #include #include #include #include -#include -#include +#include +#include +#include + +#include struct StringsConvertTest : public cudf::test::BaseFixture { }; @@ -224,7 +223,7 @@ TEST_F(StringsConvertTest, ZeroSizeStringsColumnFixedPoint) auto zero_size_column = cudf::make_empty_column(cudf::data_type{cudf::type_id::DECIMAL32}); auto results = cudf::strings::from_fixed_point(zero_size_column->view()); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsConvertTest, ZeroSizeFixedPointColumn) diff --git a/cpp/tests/strings/floats_tests.cpp b/cpp/tests/strings/floats_tests.cpp index 360ea8be178..1a3c5ada04f 100644 --- a/cpp/tests/strings/floats_tests.cpp +++ b/cpp/tests/strings/floats_tests.cpp @@ -14,13 +14,12 @@ * limitations under the License. */ -#include -#include - #include #include #include -#include + +#include +#include #include @@ -188,7 +187,7 @@ TEST_F(StringsConvertTest, ZeroSizeStringsColumnFloat) cudf::column_view zero_size_column( cudf::data_type{cudf::type_id::FLOAT32}, 0, nullptr, nullptr, 0); auto results = cudf::strings::from_floats(zero_size_column); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsConvertTest, ZeroSizeFloatsColumn) diff --git a/cpp/tests/strings/format_lists_tests.cpp b/cpp/tests/strings/format_lists_tests.cpp index 63fcdf6f00e..f1ab90ee9c5 100644 --- a/cpp/tests/strings/format_lists_tests.cpp +++ b/cpp/tests/strings/format_lists_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,8 +14,6 @@ * limitations under the License. */ -#include - #include #include #include @@ -36,7 +34,7 @@ TEST_F(StringsFormatListsTest, EmptyList) auto const view = cudf::lists_column_view(input); auto results = cudf::strings::format_list_column(view); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsFormatListsTest, EmptyNestedList) diff --git a/cpp/tests/strings/integers_tests.cpp b/cpp/tests/strings/integers_tests.cpp index 5802a1ddc0a..e938eec8b3e 100644 --- a/cpp/tests/strings/integers_tests.cpp +++ b/cpp/tests/strings/integers_tests.cpp @@ -14,15 +14,14 @@ * limitations under the License. */ -#include -#include - -#include #include #include #include #include -#include + +#include +#include +#include #include #include @@ -265,7 +264,7 @@ TEST_F(StringsConvertTest, ZeroSizeStringsColumn) { cudf::column_view zero_size_column(cudf::data_type{cudf::type_id::INT32}, 0, nullptr, nullptr, 0); auto results = cudf::strings::from_integers(zero_size_column); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsConvertTest, ZeroSizeIntegersColumn) diff --git a/cpp/tests/strings/ipv4_tests.cpp b/cpp/tests/strings/ipv4_tests.cpp index 1bc726edea7..0a404534916 100644 --- a/cpp/tests/strings/ipv4_tests.cpp +++ b/cpp/tests/strings/ipv4_tests.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ -#include -#include #include #include #include -#include + +#include +#include #include @@ -75,7 +75,7 @@ TEST_F(StringsConvertTest, ZeroSizeStringsColumnIPV4) { cudf::column_view zero_size_column(cudf::data_type{cudf::type_id::INT64}, 0, nullptr, nullptr, 0); auto results = cudf::strings::integers_to_ipv4(zero_size_column); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); results = cudf::strings::ipv4_to_integers(results->view()); EXPECT_EQ(0, results->size()); } diff --git a/cpp/tests/strings/pad_tests.cpp b/cpp/tests/strings/pad_tests.cpp index 1ccef58a8f6..c416c2b3ce1 100644 --- a/cpp/tests/strings/pad_tests.cpp +++ b/cpp/tests/strings/pad_tests.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +#include +#include +#include + #include #include #include @@ -21,11 +25,6 @@ #include #include -#include -#include -#include -#include - #include #include @@ -103,7 +102,7 @@ TEST_F(StringsPadTest, ZeroSizeStringsColumn) cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); auto strings_view = cudf::strings_column_view(zero_size_strings_column); auto results = cudf::strings::pad(strings_view, 5); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } class PadParameters : public StringsPadTest, public testing::WithParamInterface { diff --git a/cpp/tests/strings/replace_regex_tests.cpp b/cpp/tests/strings/replace_regex_tests.cpp index 79d968b14ad..6280463d112 100644 --- a/cpp/tests/strings/replace_regex_tests.cpp +++ b/cpp/tests/strings/replace_regex_tests.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ -#include -#include #include #include #include -#include + +#include +#include #include diff --git a/cpp/tests/strings/replace_tests.cpp b/cpp/tests/strings/replace_tests.cpp index 75c6cfa70e4..cd39c1e088a 100644 --- a/cpp/tests/strings/replace_tests.cpp +++ b/cpp/tests/strings/replace_tests.cpp @@ -14,16 +14,15 @@ * limitations under the License. */ +#include +#include +#include + #include #include #include #include -#include "./utilities.h" -#include -#include -#include - #include #include @@ -348,5 +347,5 @@ TEST_F(StringsReplaceTest, EmptyStringsColumn) auto results = cudf::strings::replace( strings_view, cudf::string_scalar("not"), cudf::string_scalar("pertinent")); auto view = results->view(); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } diff --git a/cpp/tests/strings/strip_tests.cpp b/cpp/tests/strings/strip_tests.cpp index 6916b990762..f7044b48e40 100644 --- a/cpp/tests/strings/strip_tests.cpp +++ b/cpp/tests/strings/strip_tests.cpp @@ -14,15 +14,14 @@ * limitations under the License. */ -#include -#include -#include - -#include "./utilities.h" #include #include #include +#include +#include +#include + #include #include @@ -99,7 +98,7 @@ TEST_F(StringsStripTest, EmptyStringsColumn) auto strings_view = cudf::strings_column_view(zero_size_strings_column); auto results = cudf::strings::strip(strings_view); auto view = results->view(); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsStripTest, InvalidParameter) diff --git a/cpp/tests/strings/substring_tests.cpp b/cpp/tests/strings/substring_tests.cpp index 1a90dc5fe38..e8e2d936d12 100644 --- a/cpp/tests/strings/substring_tests.cpp +++ b/cpp/tests/strings/substring_tests.cpp @@ -14,16 +14,15 @@ * limitations under the License. */ +#include +#include +#include + #include #include #include #include -#include -#include -#include -#include - #include #include #include @@ -283,18 +282,18 @@ TEST_F(StringsSubstringsTest, ZeroSizeStringsColumn) auto strings_view = cudf::strings_column_view(zero_size_strings_column); auto results = cudf::strings::slice_strings(strings_view, 1, 2); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); results = cudf::strings::slice_strings(strings_view, cudf::string_scalar("foo"), 1); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); cudf::column_view starts_column(cudf::data_type{cudf::type_id::INT32}, 0, nullptr, nullptr, 0); cudf::column_view stops_column(cudf::data_type{cudf::type_id::INT32}, 0, nullptr, nullptr, 0); results = cudf::strings::slice_strings(strings_view, starts_column, stops_column); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); results = cudf::strings::slice_strings(strings_view, strings_view, 1); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsSubstringsTest, AllEmpty) diff --git a/cpp/tests/strings/translate_tests.cpp b/cpp/tests/strings/translate_tests.cpp index 53c6982b880..1e278caa366 100644 --- a/cpp/tests/strings/translate_tests.cpp +++ b/cpp/tests/strings/translate_tests.cpp @@ -14,17 +14,16 @@ * limitations under the License. */ +#include +#include +#include + #include #include #include #include #include -#include -#include -#include -#include - #include #include @@ -69,9 +68,9 @@ TEST_F(StringsTranslateTest, ZeroSizeStringsColumn) auto strings_view = cudf::strings_column_view(zero_size_strings_column); std::vector> translate_table; auto results = cudf::strings::translate(strings_view, translate_table); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); results = cudf::strings::filter_characters(strings_view, translate_table); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(StringsTranslateTest, FilterCharacters) diff --git a/cpp/tests/strings/urls_tests.cpp b/cpp/tests/strings/urls_tests.cpp index 95a51bbaaeb..9199d78cfb8 100644 --- a/cpp/tests/strings/urls_tests.cpp +++ b/cpp/tests/strings/urls_tests.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ -#include -#include #include #include #include -#include + +#include +#include #include @@ -230,7 +230,7 @@ TEST_F(StringsConvertTest, ZeroSizeUrlStringsColumn) cudf::column_view zero_size_column( cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); auto results = cudf::strings::url_encode(zero_size_column); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); results = cudf::strings::url_decode(zero_size_column); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } diff --git a/cpp/tests/strings/utilities.cpp b/cpp/tests/strings/utilities.cpp deleted file mode 100644 index 1d7ec7cbecd..00000000000 --- a/cpp/tests/strings/utilities.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019, NVIDIA CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include - -namespace cudf { -namespace test { -void expect_strings_empty(cudf::column_view strings_column) -{ - EXPECT_EQ(type_id::STRING, strings_column.type().id()); - EXPECT_EQ(0, strings_column.size()); - EXPECT_EQ(0, strings_column.null_count()); - EXPECT_EQ(0, strings_column.num_children()); -} - -} // namespace test -} // namespace cudf diff --git a/cpp/tests/strings/utilities.h b/cpp/tests/strings/utilities.h deleted file mode 100644 index d6f0e9c4f1f..00000000000 --- a/cpp/tests/strings/utilities.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include - -namespace cudf { -namespace test { -/** - * @brief Utility will verify the given strings column is empty. - * - * @param strings_column Column of strings to check - */ -void expect_strings_empty(cudf::column_view strings_column); - -} // namespace test -} // namespace cudf diff --git a/cpp/tests/text/ngrams_tests.cpp b/cpp/tests/text/ngrams_tests.cpp index 20ffd3baa41..61bd1b3dccd 100644 --- a/cpp/tests/text/ngrams_tests.cpp +++ b/cpp/tests/text/ngrams_tests.cpp @@ -14,13 +14,13 @@ * limitations under the License. */ -#include -#include -#include #include #include #include -#include + +#include +#include +#include #include @@ -105,9 +105,9 @@ TEST_F(TextGenerateNgramsTest, Empty) cudf::column_view zero_size_strings_column( cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0); auto results = nvtext::generate_ngrams(cudf::strings_column_view(zero_size_strings_column)); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); results = nvtext::generate_character_ngrams(cudf::strings_column_view(zero_size_strings_column)); - cudf::test::expect_strings_empty(results->view()); + cudf::test::expect_column_empty(results->view()); } TEST_F(TextGenerateNgramsTest, Errors) diff --git a/cpp/tests/utilities/column_utilities.cu b/cpp/tests/utilities/column_utilities.cu index 5106196a58f..d0fc92b0bb5 100644 --- a/cpp/tests/utilities/column_utilities.cu +++ b/cpp/tests/utilities/column_utilities.cu @@ -854,6 +854,15 @@ bool expect_columns_equivalent(cudf::column_view const& lhs, fp_ulps); } +/** + * @copydoc cudf::test::expect_column_empty + */ +void expect_column_empty(cudf::column_view const& col) +{ + EXPECT_EQ(0, col.size()); + EXPECT_EQ(0, col.null_count()); +} + /** * @copydoc cudf::test::expect_equal_buffers */