From dbc1cca66c77f67c3eca5d5c02c9c3690ef0a629 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Mon, 24 Nov 2025 14:27:35 -0800 Subject: [PATCH 01/10] Rewrite `groupby_test_util.*` Signed-off-by: Nghia Truong --- cpp/tests/groupby/argmax_tests.cpp | 60 ++++--- cpp/tests/groupby/argmin_tests.cpp | 60 ++++--- cpp/tests/groupby/collect_list_tests.cpp | 28 ++-- cpp/tests/groupby/correlation_tests.cpp | 35 ++-- cpp/tests/groupby/count_scan_tests.cpp | 32 ++-- cpp/tests/groupby/count_tests.cpp | 69 ++++---- cpp/tests/groupby/covariance_tests.cpp | 46 ++++-- cpp/tests/groupby/groupby_test_util.cpp | 25 ++- cpp/tests/groupby/groupby_test_util.hpp | 19 ++- cpp/tests/groupby/keys_tests.cpp | 112 ++++++------- cpp/tests/groupby/lists_tests.cpp | 10 +- cpp/tests/groupby/max_scan_tests.cpp | 36 ++-- cpp/tests/groupby/max_tests.cpp | 139 ++++++++-------- cpp/tests/groupby/mean_tests.cpp | 18 +- cpp/tests/groupby/median_tests.cpp | 22 +-- cpp/tests/groupby/min_scan_tests.cpp | 36 ++-- cpp/tests/groupby/min_tests.cpp | 137 ++++++++-------- cpp/tests/groupby/nth_element_tests.cpp | 132 +++++++-------- cpp/tests/groupby/nunique_tests.cpp | 30 ++-- cpp/tests/groupby/product_scan_tests.cpp | 26 +-- cpp/tests/groupby/product_tests.cpp | 72 ++++---- cpp/tests/groupby/quantile_tests.cpp | 46 +++--- cpp/tests/groupby/rank_scan_tests.cpp | 154 +++++++++--------- cpp/tests/groupby/std_tests.cpp | 16 +- cpp/tests/groupby/structs_tests.cpp | 20 +-- cpp/tests/groupby/sum_of_squares_tests.cpp | 22 +-- cpp/tests/groupby/sum_scan_tests.cpp | 28 ++-- cpp/tests/groupby/sum_tests.cpp | 52 +++--- cpp/tests/groupby/sum_with_overflow_tests.cpp | 24 +-- cpp/tests/groupby/var_tests.cpp | 24 +-- 30 files changed, 808 insertions(+), 722 deletions(-) diff --git a/cpp/tests/groupby/argmax_tests.cpp b/cpp/tests/groupby/argmax_tests.cpp index db41219b00f..62986ac0874 100644 --- a/cpp/tests/groupby/argmax_tests.cpp +++ b/cpp/tests/groupby/argmax_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -33,10 +33,11 @@ TYPED_TEST(groupby_argmax_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{0, 1, 2}; auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmax_test, zero_valid_keys) @@ -53,10 +54,11 @@ TYPED_TEST(groupby_argmax_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmax_test, zero_valid_values) @@ -73,10 +75,11 @@ TYPED_TEST(groupby_argmax_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmax_test, null_keys_and_values) @@ -99,10 +102,11 @@ TYPED_TEST(groupby_argmax_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({3, 4, 7, 0}, {1, 1, 1, 0}); auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_argmax_string_test : public cudf::test::BaseFixture {}; @@ -119,10 +123,11 @@ TEST_F(groupby_argmax_string_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({0, 4, 2}); auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_argmax_string_test, zero_valid_values) @@ -136,10 +141,11 @@ TEST_F(groupby_argmax_string_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_dictionary_argmax_test : public cudf::test::BaseFixture {}; @@ -156,17 +162,17 @@ TEST_F(groupby_dictionary_argmax_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({ 0, 4, 2 }); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_argmax_aggregation()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_argmax_aggregation(), - force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_argmax_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_argmax_aggregation(), + force_use_sort_impl::YES); } struct groupby_argmax_struct_test : public cudf::test::BaseFixture {}; @@ -185,7 +191,7 @@ TEST_F(groupby_argmax_struct_test, basic) auto const expect_indices = cudf::test::fixed_width_column_wrapper{0, 4, 2}; auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); } TEST_F(groupby_argmax_struct_test, slice_input) @@ -218,7 +224,7 @@ TEST_F(groupby_argmax_struct_test, slice_input) auto const expect_indices = cudf::test::fixed_width_column_wrapper{0, 4, 2}; auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); } TEST_F(groupby_argmax_struct_test, null_keys_and_values) @@ -241,7 +247,7 @@ TEST_F(groupby_argmax_struct_test, null_keys_and_values) {0, 4, 2, null}, cudf::test::iterators::null_at(3)}; auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); } CUDF_TEST_PROGRAM_MAIN() diff --git a/cpp/tests/groupby/argmin_tests.cpp b/cpp/tests/groupby/argmin_tests.cpp index b85337d952b..6b0539e1616 100644 --- a/cpp/tests/groupby/argmin_tests.cpp +++ b/cpp/tests/groupby/argmin_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -34,10 +34,11 @@ TYPED_TEST(groupby_argmin_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{6, 9, 8}; auto agg = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmin_test, zero_valid_keys) @@ -54,10 +55,11 @@ TYPED_TEST(groupby_argmin_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmin_test, zero_valid_values) @@ -74,10 +76,11 @@ TYPED_TEST(groupby_argmin_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmin_test, null_keys_and_values) @@ -99,11 +102,12 @@ TYPED_TEST(groupby_argmin_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({3, 9, 8, 0}, {1, 1, 1, 0}); auto agg = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); // TODO: explore making this a gtest parameter auto agg2 = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_argmin_string_test : public cudf::test::BaseFixture {}; @@ -120,10 +124,11 @@ TEST_F(groupby_argmin_string_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({3, 5, 7}); auto agg = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_argmin_string_test, zero_valid_values) @@ -137,10 +142,11 @@ TEST_F(groupby_argmin_string_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_dictionary_argmin_test : public cudf::test::BaseFixture {}; @@ -157,17 +163,17 @@ TEST_F(groupby_dictionary_argmin_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({ 3, 5, 7 }); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_argmin_aggregation()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_argmin_aggregation(), - force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_argmin_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_argmin_aggregation(), + force_use_sort_impl::YES); } struct groupby_argmin_struct_test : public cudf::test::BaseFixture {}; @@ -186,7 +192,7 @@ TEST_F(groupby_argmin_struct_test, basic) auto const expect_indices = cudf::test::fixed_width_column_wrapper{3, 5, 7}; auto agg = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); } TEST_F(groupby_argmin_struct_test, slice_input) @@ -219,7 +225,7 @@ TEST_F(groupby_argmin_struct_test, slice_input) auto const expect_indices = cudf::test::fixed_width_column_wrapper{3, 5, 7}; auto agg = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); } TEST_F(groupby_argmin_struct_test, null_keys_and_values) @@ -241,5 +247,5 @@ TEST_F(groupby_argmin_struct_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper{{3, 1, 8, null}, null_at(3)}; auto agg = cudf::make_argmin_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); } diff --git a/cpp/tests/groupby/collect_list_tests.cpp b/cpp/tests/groupby/collect_list_tests.cpp index b416b22b6a8..1e542b7070e 100644 --- a/cpp/tests/groupby/collect_list_tests.cpp +++ b/cpp/tests/groupby/collect_list_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -29,7 +29,7 @@ TYPED_TEST(groupby_collect_list_test, CollectWithoutNulls) cudf::test::lists_column_wrapper expect_vals{{1, 2, 3}, {4, 5, 6}}; auto agg = cudf::make_collect_list_aggregation(); - test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectWithNulls) @@ -48,7 +48,7 @@ TYPED_TEST(groupby_collect_list_test, CollectWithNulls) {{1, 2}, validity.begin()}, {{3, 4}, validity.begin()}, {{5, 6}, validity.begin()}}; auto agg = cudf::make_collect_list_aggregation(); - test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectWithNullExclusion) @@ -67,7 +67,7 @@ TYPED_TEST(groupby_collect_list_test, CollectWithNullExclusion) auto agg = cudf::make_collect_list_aggregation(cudf::null_policy::EXCLUDE); - test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInput) @@ -83,7 +83,7 @@ TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInput) auto agg = cudf::make_collect_list_aggregation(cudf::null_policy::EXCLUDE); - test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectLists) @@ -103,7 +103,7 @@ TYPED_TEST(groupby_collect_list_test, CollectLists) {{1, 2}, {3, 4}}, {{5, 6, 7}, LCW{}}, {{9, 10}, {11}}}; auto agg = cudf::make_collect_list_aggregation(); - test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectListsWithNullExclusion) @@ -124,7 +124,7 @@ TYPED_TEST(groupby_collect_list_test, CollectListsWithNullExclusion) auto agg = cudf::make_collect_list_aggregation(cudf::null_policy::EXCLUDE); - test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputLists) @@ -148,7 +148,7 @@ TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputLists) cudf::make_lists_column(0, cudf::make_empty_column(offsets), std::move(expect_child), 0, {}); auto agg = cudf::make_collect_list_aggregation(); - test_single_agg(keys, values->view(), expect_keys, expect_values->view(), std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, values->view(), expect_keys, expect_values->view(), std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputListsOfStructs) @@ -188,7 +188,7 @@ TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputListsOfStructs) {}); auto agg = cudf::make_collect_list_aggregation(); - test_single_agg(keys, values->view(), expect_keys, expect_values->view(), std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, values->view(), expect_keys, expect_values->view(), std::move(agg)); } TYPED_TEST(groupby_collect_list_test, dictionary) @@ -209,9 +209,9 @@ TYPED_TEST(groupby_collect_list_test, dictionary) 0, rmm::device_buffer{}); - test_single_agg(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_collect_list_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_collect_list_aggregation()); } diff --git a/cpp/tests/groupby/correlation_tests.cpp b/cpp/tests/groupby/correlation_tests.cpp index 1a7bbc18f0c..7d0690c934f 100644 --- a/cpp/tests/groupby/correlation_tests.cpp +++ b/cpp/tests/groupby/correlation_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -43,7 +43,8 @@ TYPED_TEST(groupby_correlation_test, basic) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, empty_cols) @@ -60,7 +61,8 @@ TYPED_TEST(groupby_correlation_test, empty_cols) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, zero_valid_keys) @@ -77,7 +79,8 @@ TYPED_TEST(groupby_correlation_test, zero_valid_keys) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, zero_valid_values) @@ -95,7 +98,8 @@ TYPED_TEST(groupby_correlation_test, zero_valid_values) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, null_keys_and_values) @@ -119,7 +123,8 @@ TYPED_TEST(groupby_correlation_test, null_keys_and_values) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, null_values_same) @@ -144,7 +149,8 @@ TYPED_TEST(groupby_correlation_test, null_values_same) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } // keys=[1, 1, 1, 2, 2, 2, 2, 3, N, 3, 4] @@ -173,7 +179,8 @@ TYPED_TEST(groupby_correlation_test, null_values_different) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, min_periods) @@ -193,17 +200,20 @@ TYPED_TEST(groupby_correlation_test, min_periods) cudf::test::fixed_width_column_wrapper expect_vals1{{1.0, 0.6, nan}}; auto agg1 = cudf::make_correlation_aggregation( cudf::correlation_type::PEARSON, 3); - test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals2{{1.0, 0.6, nan}, {0, 1, 0}}; auto agg2 = cudf::make_correlation_aggregation( cudf::correlation_type::PEARSON, 4); - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals3{{1.0, 0.6, nan}, {0, 0, 0}}; auto agg3 = cudf::make_correlation_aggregation( cudf::correlation_type::PEARSON, 5); - test_single_agg(keys, vals, expect_keys, expect_vals3, std::move(agg3), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals3, std::move(agg3), force_use_sort_impl::YES); } struct groupby_dictionary_correlation_test : public cudf::test::BaseFixture {}; @@ -225,5 +235,6 @@ TEST_F(groupby_dictionary_correlation_test, basic) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } diff --git a/cpp/tests/groupby/count_scan_tests.cpp b/cpp/tests/groupby/count_scan_tests.cpp index f5b10d6606d..466e242828b 100644 --- a/cpp/tests/groupby/count_scan_tests.cpp +++ b/cpp/tests/groupby/count_scan_tests.cpp @@ -39,11 +39,11 @@ TYPED_TEST(groupby_count_scan_test, basic) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_scan_test, empty_cols) @@ -58,11 +58,11 @@ TYPED_TEST(groupby_count_scan_test, empty_cols) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_scan_test, zero_valid_keys) @@ -77,11 +77,11 @@ TYPED_TEST(groupby_count_scan_test, zero_valid_keys) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_scan_test, zero_valid_values) @@ -96,12 +96,12 @@ TYPED_TEST(groupby_count_scan_test, zero_valid_values) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); expect_vals = result_wrapper{1, 2, 3}; auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_scan_test, null_keys_and_values) @@ -121,12 +121,12 @@ TYPED_TEST(groupby_count_scan_test, null_keys_and_values) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); expect_vals = result_wrapper{1, 2, 3, 1, 2, 3, 4, 1, 2, 1}; auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); } struct groupby_count_scan_string_test : public cudf::test::BaseFixture {}; @@ -146,11 +146,11 @@ TEST_F(groupby_count_scan_string_test, basic) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); } template @@ -177,11 +177,11 @@ TYPED_TEST(GroupByCountScanFixedPointTest, GroupByCountScan) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); } struct groupby_dictionary_count_scan_test : public cudf::test::BaseFixture {}; @@ -200,8 +200,8 @@ TEST_F(groupby_dictionary_count_scan_test, basic) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); } diff --git a/cpp/tests/groupby/count_tests.cpp b/cpp/tests/groupby/count_tests.cpp index ffcd3773959..9695762dbe5 100644 --- a/cpp/tests/groupby/count_tests.cpp +++ b/cpp/tests/groupby/count_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -30,13 +30,14 @@ TYPED_TEST(groupby_count_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{3, 4, 3}; auto agg = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_test, empty_cols) @@ -51,10 +52,11 @@ TYPED_TEST(groupby_count_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals; auto agg = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); } TYPED_TEST(groupby_count_test, zero_valid_keys) @@ -69,13 +71,14 @@ TYPED_TEST(groupby_count_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_test, zero_valid_values) @@ -90,14 +93,15 @@ TYPED_TEST(groupby_count_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals{0}; auto agg = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals2{3}; auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg2)); } TYPED_TEST(groupby_count_test, null_keys_and_values) @@ -119,14 +123,15 @@ TYPED_TEST(groupby_count_test, null_keys_and_values) // clang-format on auto agg = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals2{3, 4, 2, 1}; auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg2)); } struct groupby_count_string_test : public cudf::test::BaseFixture {}; @@ -145,10 +150,11 @@ TEST_F(groupby_count_string_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{1, 1, 2, 2}; auto agg = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); } // clang-format on @@ -175,13 +181,14 @@ TYPED_TEST(GroupByCountFixedPointTest, GroupByCount) auto const expect_vals = cudf::test::fixed_width_column_wrapper{3, 4, 3}; auto agg = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg2)); } struct groupby_dictionary_count_test : public cudf::test::BaseFixture {}; @@ -198,15 +205,15 @@ TEST_F(groupby_dictionary_count_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{1, 1, 2, 2}; // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_count_aggregation()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_count_aggregation(), - force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_count_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_count_aggregation(), + force_use_sort_impl::YES); } diff --git a/cpp/tests/groupby/covariance_tests.cpp b/cpp/tests/groupby/covariance_tests.cpp index b188f00479e..9708baac770 100644 --- a/cpp/tests/groupby/covariance_tests.cpp +++ b/cpp/tests/groupby/covariance_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -39,8 +39,9 @@ TYPED_TEST(groupby_covariance_test, invalid_types) auto vals = cudf::test::structs_column_wrapper{{member_0, member_1}}; auto agg = cudf::make_covariance_aggregation(); - EXPECT_THROW(test_single_agg(keys, vals, keys, vals, std::move(agg), force_use_sort_impl::YES), - cudf::logic_error); + EXPECT_THROW( + CUDF_TEST_SINGLE_AGG(keys, vals, keys, vals, std::move(agg), force_use_sort_impl::YES), + cudf::logic_error); } TYPED_TEST(groupby_covariance_test, basic) @@ -57,7 +58,8 @@ TYPED_TEST(groupby_covariance_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{{1.0, 1.0, 0.0}}; auto agg = cudf::make_covariance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, empty_cols) @@ -73,7 +75,8 @@ TYPED_TEST(groupby_covariance_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_covariance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, zero_valid_keys) @@ -89,7 +92,8 @@ TYPED_TEST(groupby_covariance_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_covariance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, zero_valid_values) @@ -106,7 +110,8 @@ TYPED_TEST(groupby_covariance_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_covariance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, null_keys_and_values) @@ -127,7 +132,8 @@ TYPED_TEST(groupby_covariance_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({0.5, 1.0, 0.0, -0.}, {1, 1, 1, 0}); auto agg = cudf::make_covariance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, null_values_same) @@ -149,7 +155,8 @@ TYPED_TEST(groupby_covariance_test, null_values_same) cudf::test::fixed_width_column_wrapper expect_vals({0.5, 1.0, 0.0, -0.}, {1, 1, 1, 0}); auto agg = cudf::make_covariance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, null_values_different) @@ -172,7 +179,8 @@ TYPED_TEST(groupby_covariance_test, null_values_different) {std::numeric_limits::quiet_NaN(), 1.5, 0.0, -0.}, {0, 1, 1, 0}); auto agg = cudf::make_covariance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, min_periods) @@ -189,15 +197,18 @@ TYPED_TEST(groupby_covariance_test, min_periods) cudf::test::fixed_width_column_wrapper expect_vals1{{1.0, 1.0, 0.0}}; auto agg1 = cudf::make_covariance_aggregation(3); - test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals2{{1.0, 1.0, 0.0}, {0, 1, 0}}; auto agg2 = cudf::make_covariance_aggregation(4); - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals3{{1.0, 1.0, 0.0}, {0, 0, 0}}; auto agg3 = cudf::make_covariance_aggregation(5); - test_single_agg(keys, vals, expect_keys, expect_vals3, std::move(agg3), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals3, std::move(agg3), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, ddof) @@ -214,12 +225,14 @@ TYPED_TEST(groupby_covariance_test, ddof) cudf::test::fixed_width_column_wrapper expect_vals1{{2.0, 1.5, 0.0}}; auto agg1 = cudf::make_covariance_aggregation(1, 2); - test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); auto const inf = std::numeric_limits::infinity(); cudf::test::fixed_width_column_wrapper expect_vals2{{inf, 3.0, 0.0}, {0, 1, 0}}; auto agg2 = cudf::make_covariance_aggregation(1, 3); - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); } struct groupby_dictionary_covariance_test : public cudf::test::BaseFixture {}; @@ -238,5 +251,6 @@ TEST_F(groupby_dictionary_covariance_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{{1.0, -0.5, 0.0}}; auto agg = cudf::make_covariance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } diff --git a/cpp/tests/groupby/groupby_test_util.cpp b/cpp/tests/groupby/groupby_test_util.cpp index 341aa3b1f38..788e118b203 100644 --- a/cpp/tests/groupby/groupby_test_util.cpp +++ b/cpp/tests/groupby/groupby_test_util.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -17,7 +17,9 @@ #include #include -void test_single_agg(cudf::column_view const& keys, +void test_single_agg(char const* file, + int line, + cudf::column_view const& keys, cudf::column_view const& values, cudf::column_view const& expect_keys, cudf::column_view const& expect_vals, @@ -29,6 +31,9 @@ void test_single_agg(cudf::column_view const& keys, std::vector const& null_precedence, cudf::sorted reference_keys_are_sorted) { + SCOPED_TRACE("Original line of failure: " + std::to_string(line) + + ", file: " + std::string{file}); + auto const [sorted_expect_keys, sorted_expect_vals] = [&]() { if (reference_keys_are_sorted == cudf::sorted::NO) { auto const sort_expect_order = @@ -83,13 +88,17 @@ void test_single_agg(cudf::column_view const& keys, } } -void test_sum_agg(cudf::column_view const& keys, +void test_sum_agg(char const* file, + int line, + cudf::column_view const& keys, cudf::column_view const& values, cudf::column_view const& expected_keys, cudf::column_view const& expected_values) { auto const do_test = [&](auto const use_sort_option) { - test_single_agg(keys, + test_single_agg(file, + line, + keys, values, expected_keys, expected_values, @@ -101,7 +110,9 @@ void test_sum_agg(cudf::column_view const& keys, do_test(force_use_sort_impl::NO); } -void test_single_scan(cudf::column_view const& keys, +void test_single_scan(char const* file, + int line, + cudf::column_view const& keys, cudf::column_view const& values, cudf::column_view const& expect_keys, cudf::column_view const& expect_vals, @@ -111,10 +122,12 @@ void test_single_scan(cudf::column_view const& keys, std::vector const& column_order, std::vector const& null_precedence) { + SCOPED_TRACE("Original line of failure: " + std::to_string(line) + + ", file: " + std::string{file}); + std::vector requests; requests.emplace_back(); requests[0].values = values; - requests[0].aggregations.push_back(std::move(agg)); cudf::groupby::groupby gb_obj( diff --git a/cpp/tests/groupby/groupby_test_util.hpp b/cpp/tests/groupby/groupby_test_util.hpp index 28f9f79c74d..25551bd584f 100644 --- a/cpp/tests/groupby/groupby_test_util.hpp +++ b/cpp/tests/groupby/groupby_test_util.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -10,7 +10,9 @@ enum class force_use_sort_impl : bool { NO, YES }; -void test_single_agg(cudf::column_view const& keys, +void test_single_agg(char const* file, + int line, + cudf::column_view const& keys, cudf::column_view const& values, cudf::column_view const& expect_keys, cudf::column_view const& expect_vals, @@ -21,13 +23,16 @@ void test_single_agg(cudf::column_view const& keys, std::vector const& column_order = {}, std::vector const& null_precedence = {}, cudf::sorted reference_keys_are_sorted = cudf::sorted::NO); - -void test_sum_agg(cudf::column_view const& keys, +void test_sum_agg(char const* file, + int line, + cudf::column_view const& keys, cudf::column_view const& values, cudf::column_view const& expected_keys, cudf::column_view const& expected_values); -void test_single_scan(cudf::column_view const& keys, +void test_single_scan(char const* file, + int line, + cudf::column_view const& keys, cudf::column_view const& values, cudf::column_view const& expect_keys, cudf::column_view const& expect_vals, @@ -36,3 +41,7 @@ void test_single_scan(cudf::column_view const& keys, cudf::sorted keys_are_sorted = cudf::sorted::NO, std::vector const& column_order = {}, std::vector const& null_precedence = {}); + +#define CUDF_TEST_SINGLE_AGG(...) test_single_agg(__FILE__, __LINE__, __VA_ARGS__) +#define CUDF_TEST_SUM_AGG(...) test_sum_agg(__FILE__, __LINE__, __VA_ARGS__) +#define CUDF_TEST_SINGLE_SCAN(...) test_single_scan(__FILE__, __LINE__, __VA_ARGS__) diff --git a/cpp/tests/groupby/keys_tests.cpp b/cpp/tests/groupby/keys_tests.cpp index 196945d22d5..ec2243b1c45 100644 --- a/cpp/tests/groupby/keys_tests.cpp +++ b/cpp/tests/groupby/keys_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,7 @@ TYPED_TEST(groupby_keys_test, basic) // clang-format on auto agg = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_keys_test, zero_valid_keys) @@ -56,7 +56,7 @@ TYPED_TEST(groupby_keys_test, zero_valid_keys) // clang-format on auto agg = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_keys_test, some_null_keys) @@ -77,7 +77,7 @@ TYPED_TEST(groupby_keys_test, some_null_keys) // clang-format on auto agg = cudf::make_count_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_keys_test, include_null_keys) @@ -99,13 +99,13 @@ TYPED_TEST(groupby_keys_test, include_null_keys) // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::NO, - cudf::null_policy::INCLUDE); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::NO, + cudf::null_policy::INCLUDE); } TYPED_TEST(groupby_keys_test, pre_sorted_keys) @@ -123,14 +123,14 @@ TYPED_TEST(groupby_keys_test, pre_sorted_keys) // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::YES, - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::YES, + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_keys_test, pre_sorted_keys_descending) @@ -148,15 +148,15 @@ TYPED_TEST(groupby_keys_test, pre_sorted_keys_descending) // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::YES, - cudf::null_policy::EXCLUDE, - cudf::sorted::YES, - {cudf::order::DESCENDING}); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::YES, + cudf::null_policy::EXCLUDE, + cudf::sorted::YES, + {cudf::order::DESCENDING}); } TYPED_TEST(groupby_keys_test, pre_sorted_keys_nullable) @@ -175,14 +175,14 @@ TYPED_TEST(groupby_keys_test, pre_sorted_keys_nullable) // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::YES, - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::YES, + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_keys_test, pre_sorted_keys_nulls_before_include_nulls) @@ -203,14 +203,14 @@ TYPED_TEST(groupby_keys_test, pre_sorted_keys_nulls_before_include_nulls) // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::YES, - cudf::null_policy::INCLUDE, - cudf::sorted::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::YES, + cudf::null_policy::INCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_keys_test, mismatch_num_rows) @@ -223,9 +223,9 @@ TYPED_TEST(groupby_keys_test, mismatch_num_rows) // Verify that scan throws an error when given data of mismatched sizes. auto agg = cudf::make_count_aggregation(); - EXPECT_THROW(test_single_agg(keys, vals, keys, vals, std::move(agg)), cudf::logic_error); + EXPECT_THROW(CUDF_TEST_SINGLE_AGG(keys, vals, keys, vals, std::move(agg)), cudf::logic_error); auto agg2 = cudf::make_count_aggregation(); - EXPECT_THROW(test_single_scan(keys, vals, keys, vals, std::move(agg2)), cudf::logic_error); + EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, vals, keys, vals, std::move(agg2)), cudf::logic_error); } template @@ -280,7 +280,7 @@ TYPED_TEST(groupby_keys_test, structs) auto expect_vals = FWCW{6, 1, 8, 7}; auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } template @@ -299,7 +299,7 @@ TYPED_TEST(groupby_keys_test, lists) // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, values, expected_keys, expected_values, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, values, expected_keys, expected_values, std::move(agg)); } struct groupby_string_keys_test : public cudf::test::BaseFixture {}; @@ -318,7 +318,7 @@ TEST_F(groupby_string_keys_test, basic) // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } // clang-format on @@ -337,14 +337,14 @@ TEST_F(groupby_dictionary_keys_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({ 9, 19, 17 }); // clang-format on - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals, cudf::make_sum_aggregation()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_sum_aggregation(), - force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_sum_aggregation(), + force_use_sort_impl::YES); } struct groupby_cache_test : public cudf::test::BaseFixture {}; diff --git a/cpp/tests/groupby/lists_tests.cpp b/cpp/tests/groupby/lists_tests.cpp index 355be13fff1..abb831b4fc2 100644 --- a/cpp/tests/groupby/lists_tests.cpp +++ b/cpp/tests/groupby/lists_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -49,7 +49,7 @@ TYPED_TEST(groupby_lists_test, basic) auto expected_values = fwcw{ 3, 5, 2 }; // clang-format on - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_lists_test, all_null_input) @@ -62,7 +62,7 @@ TYPED_TEST(groupby_lists_test, all_null_input) auto expected_values = fwcw{ 10 }; // clang-format on - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_lists_test, lists_with_nulls) @@ -75,7 +75,7 @@ TYPED_TEST(groupby_lists_test, lists_with_nulls) auto expected_values = fwcw{ 7, 3 }; // clang-format on - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_lists_test, lists_with_null_elements) @@ -92,5 +92,5 @@ TYPED_TEST(groupby_lists_test, lists_with_null_elements) {{}, lcw{{{1, 2, 3}, {}, {4, 5}, {}, {6, 0}}, nulls_at({1, 3})}}, null_at(0)}; auto expected_values = fwcw{9, 3}; - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } diff --git a/cpp/tests/groupby/max_scan_tests.cpp b/cpp/tests/groupby/max_scan_tests.cpp index f7e10db7959..64b351f3e22 100644 --- a/cpp/tests/groupby/max_scan_tests.cpp +++ b/cpp/tests/groupby/max_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -41,7 +41,7 @@ TYPED_TEST(groupby_max_scan_test, basic) // clang-format on auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_max_scan_test, pre_sorted) @@ -58,13 +58,13 @@ TYPED_TEST(groupby_max_scan_test, pre_sorted) // clang-format on auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + CUDF_TEST_SINGLE_SCAN(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_max_scan_test, empty_cols) @@ -78,7 +78,7 @@ TYPED_TEST(groupby_max_scan_test, empty_cols) result_wrapper expect_vals{}; auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_max_scan_test, zero_valid_keys) @@ -92,7 +92,7 @@ TYPED_TEST(groupby_max_scan_test, zero_valid_keys) result_wrapper expect_vals{}; auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_max_scan_test, zero_valid_values) @@ -106,7 +106,7 @@ TYPED_TEST(groupby_max_scan_test, zero_valid_values) result_wrapper expect_vals({-1, -1, -1}, all_nulls()); auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_max_scan_test, null_keys_and_values) @@ -126,7 +126,7 @@ TYPED_TEST(groupby_max_scan_test, null_keys_and_values) // clang-format on auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } struct groupby_max_scan_string_test : public cudf::test::BaseFixture {}; @@ -142,7 +142,7 @@ TEST_F(groupby_max_scan_string_test, basic) {"año", "año", "año", "bit", "zit", "zit", "zit", "₹1", "₹1", "₹1"}); auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } template @@ -169,7 +169,7 @@ TYPED_TEST(GroupByMaxScanFixedPointTest, GroupBySortMaxScanDecimalAsValue) // clang-format on auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals_max, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals_max, std::move(agg)); } } @@ -194,7 +194,7 @@ TEST_F(groupby_max_scan_struct_test, basic) }(); auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_max_scan_struct_test, slice_input) @@ -231,7 +231,7 @@ TEST_F(groupby_max_scan_struct_test, slice_input) }(); auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_max_scan_struct_test, null_keys_and_values) @@ -256,5 +256,5 @@ TEST_F(groupby_max_scan_struct_test, null_keys_and_values) }(); auto agg = cudf::make_max_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } diff --git a/cpp/tests/groupby/max_tests.cpp b/cpp/tests/groupby/max_tests.cpp index 62ead70a2de..12722e7303d 100644 --- a/cpp/tests/groupby/max_tests.cpp +++ b/cpp/tests/groupby/max_tests.cpp @@ -38,10 +38,11 @@ TYPED_TEST(groupby_max_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({6, 9, 8}); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_max_test, empty_cols) @@ -56,10 +57,11 @@ TYPED_TEST(groupby_max_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_max_test, zero_valid_keys) @@ -74,10 +76,11 @@ TYPED_TEST(groupby_max_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_max_test, zero_valid_values) @@ -92,10 +95,11 @@ TYPED_TEST(groupby_max_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_max_test, null_keys_and_values) @@ -115,10 +119,11 @@ TYPED_TEST(groupby_max_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({3, 5, 8, 0}, {1, 1, 1, 0}); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_max_string_test : public cudf::test::BaseFixture {}; @@ -133,10 +138,11 @@ TEST_F(groupby_max_string_test, basic) cudf::test::strings_column_wrapper expect_vals({"año", "zit", "₹1"}); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_max_string_test, zero_valid_values) @@ -148,10 +154,11 @@ TEST_F(groupby_max_string_test, zero_valid_values) cudf::test::strings_column_wrapper expect_vals({""}, all_nulls()); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_max_string_test, max_sorted_strings) @@ -184,14 +191,14 @@ TEST_F(groupby_max_string_test, max_sorted_strings) // {6, 10, 14, 18, 22, 26, 30, 34, 38, 42, -1}, // {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::NO, - cudf::null_policy::INCLUDE, - cudf::sorted::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::NO, + cudf::null_policy::INCLUDE, + cudf::sorted::YES); } struct groupby_dictionary_max_test : public cudf::test::BaseFixture {}; @@ -209,17 +216,17 @@ TEST_F(groupby_dictionary_max_test, basic) auto expect_vals = cudf::dictionary::set_keys(expect_vals_w, vals.keys()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_max_aggregation()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_max_aggregation(), - force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_max_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_max_aggregation(), + force_use_sort_impl::YES); } TEST_F(groupby_dictionary_max_test, fixed_width) @@ -233,17 +240,17 @@ TEST_F(groupby_dictionary_max_test, fixed_width) cudf::test::fixed_width_column_wrapper expect_vals_w({ 0xABC, 0xFFF, 0xF1 }); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals_w, - cudf::make_max_aggregation()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals_w, - cudf::make_max_aggregation(), - force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals_w, + cudf::make_max_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals_w, + cudf::make_max_aggregation(), + force_use_sort_impl::YES); } template @@ -270,7 +277,7 @@ TYPED_TEST(GroupByMaxFixedPointTest, GroupBySortMaxDecimalAsValue) auto const expect_vals_max = fp_wrapper{{6, 9, 8}, scale}; auto agg3 = cudf::make_max_aggregation(); - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals_max, std::move(agg3), force_use_sort_impl::YES); } } @@ -294,7 +301,7 @@ TYPED_TEST(GroupByMaxFixedPointTest, GroupByHashMaxDecimalAsValue) auto const expect_vals_max = fp_wrapper{{6, 9, 8}, scale}; auto agg7 = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals_max, std::move(agg7)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals_max, std::move(agg7)); } } @@ -318,7 +325,7 @@ TEST_F(groupby_max_struct_test, basic) }(); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_max_struct_test, slice_input) @@ -355,7 +362,7 @@ TEST_F(groupby_max_struct_test, slice_input) }(); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_max_struct_test, null_keys_and_values) @@ -380,7 +387,7 @@ TEST_F(groupby_max_struct_test, null_keys_and_values) }(); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_max_struct_test, values_with_null_child) @@ -402,7 +409,7 @@ TEST_F(groupby_max_struct_test, values_with_null_child) }(); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } { @@ -421,7 +428,7 @@ TEST_F(groupby_max_struct_test, values_with_null_child) }(); auto agg = cudf::make_max_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } } @@ -436,7 +443,7 @@ TEST_F(groupby_max_list_test, basic) auto const expect_keys = cudf::test::fixed_width_column_wrapper{1, 2, 3}; auto const expect_vals = lists{{1, 2}, {9, 10}, {5, 6, 7}}; - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals, cudf::make_max_aggregation()); } @@ -455,7 +462,7 @@ TEST_F(groupby_max_list_test, slice_input) auto const expect_keys = cudf::test::fixed_width_column_wrapper{1, 2, 3}; auto const expect_vals = lists{{1, 2}, {9, 10}, {5, 6, 7}}; - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals, cudf::make_max_aggregation()); } @@ -472,11 +479,11 @@ TEST_F(groupby_max_list_test, null_keys_and_values) { auto const vals = lists{{{} /*null*/, {1, 2}, {3, 4}, {5, 6, 7}, {0, 8}, {9, 10}}, null_at(0)}; auto const expect_vals = lists{{0, 8}, {9, 10}, {3, 4}}; - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_max_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_max_aggregation()); } // Null child element. @@ -488,11 +495,11 @@ TEST_F(groupby_max_list_test, null_keys_and_values) lists{0, 8}, lists{9, 10}}; auto const expect_vals = lists{{0, 8}, {9, 10}, {3, 4}}; - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_max_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_max_aggregation()); } } @@ -518,7 +525,7 @@ TYPED_TEST(groupby_max_floating_point_test, values_with_infinity) // Related issue: https://github.com/rapidsai/cudf/issues/11352 // The issue only occurs in sort-based cudf::aggregation. auto agg = cudf::make_max_aggregation(); - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expected_keys, expected_vals, std::move(agg), force_use_sort_impl::YES); } @@ -562,7 +569,7 @@ TEST_F(groupby_max_hash_based_gmem_fallback_kernel_test, all_block_fallback) auto agg = cudf::make_max_aggregation(); // Keys are the same as values. - test_single_agg(keys, keys, expect_keys, expect_keys, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, keys, expect_keys, expect_keys, std::move(agg)); } TEST_F(groupby_max_hash_based_gmem_fallback_kernel_test, partial_fallback) @@ -590,5 +597,5 @@ TEST_F(groupby_max_hash_based_gmem_fallback_kernel_test, partial_fallback) auto agg = cudf::make_max_aggregation(); // Keys are the same as values. - test_single_agg(keys, keys, expect_keys, expect_keys, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, keys, expect_keys, expect_keys, std::move(agg)); } diff --git a/cpp/tests/groupby/mean_tests.cpp b/cpp/tests/groupby/mean_tests.cpp index ec2049e9c6f..678e4321f68 100644 --- a/cpp/tests/groupby/mean_tests.cpp +++ b/cpp/tests/groupby/mean_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -51,7 +51,7 @@ TYPED_TEST(groupby_mean_test, basic) // clang-format on auto agg = cudf::make_mean_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_mean_test, empty_cols) @@ -66,7 +66,7 @@ TYPED_TEST(groupby_mean_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_mean_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_mean_test, zero_valid_keys) @@ -81,7 +81,7 @@ TYPED_TEST(groupby_mean_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_mean_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_mean_test, zero_valid_values) @@ -96,7 +96,7 @@ TYPED_TEST(groupby_mean_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_mean_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_mean_test, null_keys_and_values) @@ -121,7 +121,7 @@ TYPED_TEST(groupby_mean_test, null_keys_and_values) expect_v.cbegin(), expect_v.cend(), {1, 1, 1, 0}); auto agg = cudf::make_mean_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } // clang-format on @@ -140,7 +140,7 @@ TEST_F(groupby_dictionary_mean_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({9. / 3, 19. / 4, 17. / 3}); // clang-format on - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals, cudf::make_mean_aggregation()); } @@ -167,7 +167,7 @@ TYPED_TEST(FixedPointTestBothReps, GroupBySortMeanDecimalAsValue) auto const expect_vals_min = fp_wrapper{{3, 4, 5}, scale}; auto agg = cudf::make_mean_aggregation(); - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals_min, std::move(agg), force_use_sort_impl::YES); } } @@ -191,6 +191,6 @@ TYPED_TEST(FixedPointTestBothReps, GroupByHashMeanDecimalAsValue) auto const expect_vals_min = fp_wrapper{{3, 4, 5}, scale}; auto agg = cudf::make_mean_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals_min, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals_min, std::move(agg)); } } diff --git a/cpp/tests/groupby/median_tests.cpp b/cpp/tests/groupby/median_tests.cpp index faa46874c42..1ab915284db 100644 --- a/cpp/tests/groupby/median_tests.cpp +++ b/cpp/tests/groupby/median_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,7 @@ TYPED_TEST(groupby_median_test, basic) // clang-format on auto agg = cudf::make_median_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_median_test, empty_cols) @@ -54,7 +54,7 @@ TYPED_TEST(groupby_median_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_median_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_median_test, zero_valid_keys) @@ -70,7 +70,7 @@ TYPED_TEST(groupby_median_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_median_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_median_test, zero_valid_values) @@ -86,7 +86,7 @@ TYPED_TEST(groupby_median_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_median_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_median_test, null_keys_and_values) @@ -107,7 +107,7 @@ TYPED_TEST(groupby_median_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({4.5, 4., 5., 0.}, {1, 1, 1, 0}); auto agg = cudf::make_median_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_median_test, dictionary) @@ -126,9 +126,9 @@ TYPED_TEST(groupby_median_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({3., 4.5, 7. }, no_nulls()); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_median_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_median_aggregation()); } diff --git a/cpp/tests/groupby/min_scan_tests.cpp b/cpp/tests/groupby/min_scan_tests.cpp index 6623f561a2b..721597cd82b 100644 --- a/cpp/tests/groupby/min_scan_tests.cpp +++ b/cpp/tests/groupby/min_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,7 @@ TYPED_TEST(groupby_min_scan_test, basic) // clang-format on auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_min_scan_test, pre_sorted) @@ -55,13 +55,13 @@ TYPED_TEST(groupby_min_scan_test, pre_sorted) // clang-format on auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + CUDF_TEST_SINGLE_SCAN(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_min_scan_test, empty_cols) @@ -75,7 +75,7 @@ TYPED_TEST(groupby_min_scan_test, empty_cols) result_wrapper expect_vals{}; auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_min_scan_test, zero_valid_keys) @@ -89,7 +89,7 @@ TYPED_TEST(groupby_min_scan_test, zero_valid_keys) result_wrapper expect_vals{}; auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_min_scan_test, zero_valid_values) @@ -103,7 +103,7 @@ TYPED_TEST(groupby_min_scan_test, zero_valid_values) result_wrapper expect_vals({-1, -1, -1}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_min_scan_test, null_keys_and_values) @@ -123,7 +123,7 @@ TYPED_TEST(groupby_min_scan_test, null_keys_and_values) // clang-format on auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } struct groupby_min_scan_string_test : public cudf::test::BaseFixture {}; @@ -139,7 +139,7 @@ TEST_F(groupby_min_scan_string_test, basic) {"año", "aaa", "aaa", "bit", "bit", "bat", "bat", "₹1", "$1", "$1"}); auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } template @@ -167,7 +167,7 @@ TYPED_TEST(GroupByMinScanFixedPointTest, GroupBySortMinScanDecimalAsValue) // clang-format on auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals_min, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals_min, std::move(agg)); } } @@ -192,7 +192,7 @@ TEST_F(groupby_min_scan_struct_test, basic) }(); auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_min_scan_struct_test, slice_input) @@ -229,7 +229,7 @@ TEST_F(groupby_min_scan_struct_test, slice_input) }(); auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_min_scan_struct_test, null_keys_and_values) @@ -258,5 +258,5 @@ TEST_F(groupby_min_scan_struct_test, null_keys_and_values) }(); auto agg = cudf::make_min_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } diff --git a/cpp/tests/groupby/min_tests.cpp b/cpp/tests/groupby/min_tests.cpp index ea444fabc38..5c539c89d5b 100644 --- a/cpp/tests/groupby/min_tests.cpp +++ b/cpp/tests/groupby/min_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -35,10 +35,11 @@ TYPED_TEST(groupby_min_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({0, 1, 2}); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_min_test, empty_cols) @@ -53,10 +54,11 @@ TYPED_TEST(groupby_min_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_min_test, zero_valid_keys) @@ -71,10 +73,11 @@ TYPED_TEST(groupby_min_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_min_test, zero_valid_values) @@ -89,10 +92,11 @@ TYPED_TEST(groupby_min_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_min_test, null_keys_and_values) @@ -112,10 +116,11 @@ TYPED_TEST(groupby_min_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({3, 1, 2, 0}, {1, 1, 1, 0}); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_min_string_test : public cudf::test::BaseFixture {}; @@ -130,10 +135,11 @@ TEST_F(groupby_min_string_test, basic) cudf::test::strings_column_wrapper expect_vals({"aaa", "bat", "$1"}); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_min_string_test, zero_valid_values) @@ -145,10 +151,11 @@ TEST_F(groupby_min_string_test, zero_valid_values) cudf::test::strings_column_wrapper expect_vals({""}, all_nulls()); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_min_string_test, min_sorted_strings) @@ -178,14 +185,14 @@ TEST_F(groupby_min_string_test, min_sorted_strings) {true, true, true, true, true, true, true, true, true, true, false}); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::NO, - cudf::null_policy::INCLUDE, - cudf::sorted::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::NO, + cudf::null_policy::INCLUDE, + cudf::sorted::YES); } struct groupby_dictionary_min_test : public cudf::test::BaseFixture {}; @@ -203,17 +210,17 @@ TEST_F(groupby_dictionary_min_test, basic) auto expect_vals = cudf::dictionary::set_keys(expect_vals_w, vals.keys()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_min_aggregation()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_min_aggregation(), - force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_min_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_min_aggregation(), + force_use_sort_impl::YES); } TEST_F(groupby_dictionary_min_test, fixed_width) @@ -227,17 +234,17 @@ TEST_F(groupby_dictionary_min_test, fixed_width) cudf::test::fixed_width_column_wrapper expect_vals_w({ 0xAAA, 0xBAA, 0x01 }); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals_w, - cudf::make_min_aggregation()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals_w, - cudf::make_min_aggregation(), - force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals_w, + cudf::make_min_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals_w, + cudf::make_min_aggregation(), + force_use_sort_impl::YES); } template @@ -263,7 +270,7 @@ TYPED_TEST(GroupByMinFixedPointTest, GroupBySortMinDecimalAsValue) auto const expect_vals_min = fp_wrapper{{0, 1, 2}, scale}; auto agg2 = cudf::make_min_aggregation(); - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals_min, std::move(agg2), force_use_sort_impl::YES); } } @@ -287,7 +294,7 @@ TYPED_TEST(GroupByMinFixedPointTest, GroupByHashMinDecimalAsValue) auto const expect_vals_min = fp_wrapper{{0, 1, 2}, scale}; auto agg6 = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals_min, std::move(agg6)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals_min, std::move(agg6)); } } @@ -311,7 +318,7 @@ TEST_F(groupby_min_struct_test, basic) }(); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_min_struct_test, slice_input) @@ -348,7 +355,7 @@ TEST_F(groupby_min_struct_test, slice_input) }(); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_min_struct_test, null_keys_and_values) @@ -373,7 +380,7 @@ TEST_F(groupby_min_struct_test, null_keys_and_values) }(); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_min_struct_test, values_with_null_child) @@ -395,7 +402,7 @@ TEST_F(groupby_min_struct_test, values_with_null_child) }(); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } { @@ -414,7 +421,7 @@ TEST_F(groupby_min_struct_test, values_with_null_child) }(); auto agg = cudf::make_min_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } } @@ -429,7 +436,7 @@ TEST_F(groupby_min_list_test, basic) auto const expect_keys = cudf::test::fixed_width_column_wrapper{1, 2, 3}; auto const expect_vals = lists{{0, 8}, {3, 4}, {5, 6, 7}}; - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals, cudf::make_min_aggregation()); } @@ -448,7 +455,7 @@ TEST_F(groupby_min_list_test, slice_input) auto const expect_keys = cudf::test::fixed_width_column_wrapper{1, 2, 3}; auto const expect_vals = lists{{0, 8}, {3, 4}, {5, 6, 7}}; - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals, cudf::make_min_aggregation()); } @@ -465,11 +472,11 @@ TEST_F(groupby_min_list_test, null_keys_and_values) { auto const vals = lists{{{} /*null*/, {1, 2}, {3, 4}, {5, 6, 7}, {0, 8}, {9, 10}}, null_at(0)}; auto const expect_vals = lists{{0, 8}, {1, 2}, {3, 4}}; - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_min_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_min_aggregation()); } // Null child element. @@ -481,11 +488,11 @@ TEST_F(groupby_min_list_test, null_keys_and_values) lists{0, 8}, lists{9, 10}}; auto const expect_vals = lists{lists{{0, null}, null_at(1)}, {1, 2}, {3, 4}}; - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_min_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_min_aggregation()); } } @@ -511,7 +518,7 @@ TYPED_TEST(groupby_min_floating_point_test, values_with_infinity) // Related issue: https://github.com/rapidsai/cudf/issues/11352 // The issue only occurs in sort-based aggregation. auto agg = cudf::make_min_aggregation(); - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expected_keys, expected_vals, std::move(agg), force_use_sort_impl::YES); } diff --git a/cpp/tests/groupby/nth_element_tests.cpp b/cpp/tests/groupby/nth_element_tests.cpp index e55ce32ebcb..b760f653676 100644 --- a/cpp/tests/groupby/nth_element_tests.cpp +++ b/cpp/tests/groupby/nth_element_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -37,15 +37,15 @@ TYPED_TEST(groupby_nth_element_test, basic) //groupby.first() auto agg = cudf::make_nth_element_aggregation(0); cudf::test::fixed_width_column_wrapper expect_vals0({0, 1, 2}); - test_single_agg(keys, vals, expect_keys, expect_vals0, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals0, std::move(agg)); agg = cudf::make_nth_element_aggregation(1); cudf::test::fixed_width_column_wrapper expect_vals1({3, 4, 7}); - test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg)); agg = cudf::make_nth_element_aggregation(2); cudf::test::fixed_width_column_wrapper expect_vals2({6, 5, 8}); - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, empty_cols) @@ -61,7 +61,7 @@ TYPED_TEST(groupby_nth_element_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_nth_element_aggregation(0); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, basic_out_of_bounds) @@ -77,7 +77,7 @@ TYPED_TEST(groupby_nth_element_test, basic_out_of_bounds) auto agg = cudf::make_nth_element_aggregation(3); cudf::test::fixed_width_column_wrapper expect_vals({0, 9, 0}, {0, 1, 0}); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, negative) @@ -96,15 +96,15 @@ TYPED_TEST(groupby_nth_element_test, negative) //groupby.last() auto agg = cudf::make_nth_element_aggregation(-1); cudf::test::fixed_width_column_wrapper expect_vals0({6, 9, 8}); - test_single_agg(keys, vals, expect_keys, expect_vals0, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals0, std::move(agg)); agg = cudf::make_nth_element_aggregation(-2); cudf::test::fixed_width_column_wrapper expect_vals1({3, 5, 7}); - test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg)); agg = cudf::make_nth_element_aggregation(-3); cudf::test::fixed_width_column_wrapper expect_vals2({0, 4, 2}); - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, negative_out_of_bounds) @@ -120,7 +120,7 @@ TYPED_TEST(groupby_nth_element_test, negative_out_of_bounds) auto agg = cudf::make_nth_element_aggregation(-4); cudf::test::fixed_width_column_wrapper expect_vals({0, 1, 0}, {0, 1, 0}); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, zero_valid_keys) @@ -136,7 +136,7 @@ TYPED_TEST(groupby_nth_element_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_nth_element_aggregation(0); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, zero_valid_values) @@ -152,7 +152,7 @@ TYPED_TEST(groupby_nth_element_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({3}, all_nulls()); auto agg = cudf::make_nth_element_aggregation(0); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, null_keys_and_values) @@ -172,7 +172,7 @@ TYPED_TEST(groupby_nth_element_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({-1, 1, 2, -1}, {0, 1, 1, 0}); auto agg = cudf::make_nth_element_aggregation(0); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, null_keys_and_values_out_of_bounds) @@ -192,7 +192,7 @@ TYPED_TEST(groupby_nth_element_test, null_keys_and_values_out_of_bounds) cudf::test::fixed_width_column_wrapper expect_vals({6, -1, -1, -1}, {1, 0, 0, 0}); auto agg = cudf::make_nth_element_aggregation(2); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, exclude_nulls) @@ -223,18 +223,18 @@ TYPED_TEST(groupby_nth_element_test, exclude_nulls) cudf::test::fixed_width_column_wrapper expect_vals2({-1, 9, 8, -1}, {0, 1, 1, 0}); auto agg = cudf::make_nth_element_aggregation(0, cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_nuls0, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls0, std::move(agg)); agg = cudf::make_nth_element_aggregation(1, cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_nuls1, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls1, std::move(agg)); agg = cudf::make_nth_element_aggregation(2, cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_nuls2, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls2, std::move(agg)); agg = cudf::make_nth_element_aggregation(0, cudf::null_policy::EXCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals0, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals0, std::move(agg)); agg = cudf::make_nth_element_aggregation(1, cudf::null_policy::EXCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg)); agg = cudf::make_nth_element_aggregation(2, cudf::null_policy::EXCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, exclude_nulls_negative_index) @@ -268,18 +268,18 @@ TYPED_TEST(groupby_nth_element_test, exclude_nulls_negative_index) cudf::test::fixed_width_column_wrapper expect_vals2({-1, 1, 2, -1}, {0, 1, 1, 0}); auto agg = cudf::make_nth_element_aggregation(-1, cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_nuls0, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls0, std::move(agg)); agg = cudf::make_nth_element_aggregation(-2, cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_nuls1, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls1, std::move(agg)); agg = cudf::make_nth_element_aggregation(-3, cudf::null_policy::INCLUDE); - test_single_agg(keys, vals, expect_keys, expect_nuls2, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls2, std::move(agg)); agg = cudf::make_nth_element_aggregation(-1, cudf::null_policy::EXCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals0, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals0, std::move(agg)); agg = cudf::make_nth_element_aggregation(-2, cudf::null_policy::EXCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg)); agg = cudf::make_nth_element_aggregation(-3, cudf::null_policy::EXCLUDE); - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg)); } struct groupby_nth_element_string_test : public cudf::test::BaseFixture { @@ -297,38 +297,38 @@ TEST_F(groupby_nth_element_string_test, basic_string) //groupby.first() auto agg = cudf::make_nth_element_aggregation(0); cudf::test::strings_column_wrapper expect_vals0{"ABCD", "1", "2"}; - test_single_agg(keys, vals, expect_keys, expect_vals0, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals0, std::move(agg)); agg = cudf::make_nth_element_aggregation(1); cudf::test::strings_column_wrapper expect_vals1{"3", "4", "7"}; - test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg)); agg = cudf::make_nth_element_aggregation(2); cudf::test::strings_column_wrapper expect_vals2{"6", "5", "8"}; - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg)); //+ve out of bounds agg = cudf::make_nth_element_aggregation(3); cudf::test::strings_column_wrapper expect_vals3{{"", "9", ""}, {false, true, false}}; - test_single_agg(keys, vals, expect_keys, expect_vals3, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals3, std::move(agg)); //groupby.last() agg = cudf::make_nth_element_aggregation(-1); cudf::test::strings_column_wrapper expect_vals4{"6", "9", "8"}; - test_single_agg(keys, vals, expect_keys, expect_vals4, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals4, std::move(agg)); agg = cudf::make_nth_element_aggregation(-2); cudf::test::strings_column_wrapper expect_vals5{"3", "5", "7"}; - test_single_agg(keys, vals, expect_keys, expect_vals5, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals5, std::move(agg)); agg = cudf::make_nth_element_aggregation(-3); cudf::test::strings_column_wrapper expect_vals6{"ABCD", "4", "2"}; - test_single_agg(keys, vals, expect_keys, expect_vals6, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals6, std::move(agg)); //-ve out of bounds agg = cudf::make_nth_element_aggregation(-4); cudf::test::strings_column_wrapper expect_vals7{{"", "1", ""}, {false, true, false}}; - test_single_agg(keys, vals, expect_keys, expect_vals7, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals7, std::move(agg)); } // clang-format on @@ -344,11 +344,11 @@ TEST_F(groupby_nth_element_string_test, dictionary) auto expect_vals = cudf::dictionary::set_keys(expect_vals_w, vals.keys()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_nth_element_aggregation(2)); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_nth_element_aggregation(2)); } template @@ -369,11 +369,11 @@ TYPED_TEST(groupby_nth_element_lists_test, Basics) auto expected_keys = cudf::test::fixed_width_column_wrapper{1, 2, 3}; auto expected_values = lists{{1, 2}, {5, 6, 7}, {9, 10}}; - test_single_agg(keys, - values, - expected_keys, - expected_values, - cudf::make_nth_element_aggregation(0)); + CUDF_TEST_SINGLE_AGG(keys, + values, + expected_keys, + expected_values, + cudf::make_nth_element_aggregation(0)); } TYPED_TEST(groupby_nth_element_lists_test, EmptyInput) @@ -389,11 +389,11 @@ TYPED_TEST(groupby_nth_element_lists_test, EmptyInput) auto expected_keys = cudf::test::fixed_width_column_wrapper{}; auto expected_values = lists{}; - test_single_agg(keys, - values, - expected_keys, - expected_values, - cudf::make_nth_element_aggregation(2)); + CUDF_TEST_SINGLE_AGG(keys, + values, + expected_keys, + expected_values, + cudf::make_nth_element_aggregation(2)); } struct groupby_nth_element_structs_test : cudf::test::BaseFixture {}; @@ -418,18 +418,18 @@ TEST_F(groupby_nth_element_structs_test, Basics) auto expected_ch2 = strings{"a", "d", "g", ""}; auto expected_values = structs{{expected_ch0, expected_ch1, expected_ch2}, {false, true, true, false}}; - test_single_agg(keys, - values, - expected_keys, - expected_values, - cudf::make_nth_element_aggregation(1)); + CUDF_TEST_SINGLE_AGG(keys, + values, + expected_keys, + expected_values, + cudf::make_nth_element_aggregation(1)); expected_keys = ints{0, 1, 2, 3}; expected_ch0 = ints{0, 4, 6, 9}; expected_ch1 = doubles{0.1, 4.51, 6.3231, 9.999}; expected_ch2 = strings{"", "d", "f", "JJJ"}; expected_values = structs{{expected_ch0, expected_ch1, expected_ch2}, {true, true, true, true}}; - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, values, expected_keys, @@ -461,11 +461,11 @@ TEST_F(groupby_nth_element_structs_test, NestedStructs) auto expected_ch2 = lists{{1, 2, 3}, {5, 6}, {7}, {}}; auto expected_values = structs{{expected_ch0, expected_ch1, expected_ch2}, {false, true, true, false}}; - test_single_agg(keys, - values, - expected_keys, - expected_values, - cudf::make_nth_element_aggregation(1)); + CUDF_TEST_SINGLE_AGG(keys, + values, + expected_keys, + expected_values, + cudf::make_nth_element_aggregation(1)); expected_keys = ints{0, 1, 2, 3}; expected_ch0 = ints{0, 4, 6, 9}; @@ -474,7 +474,7 @@ TEST_F(groupby_nth_element_structs_test, NestedStructs) expected_ch1 = structs{expected_ch0_of_ch1, expected_ch1_of_ch1}; expected_ch2 = lists{{0}, {5, 6}, {}, {}}; expected_values = structs{{expected_ch0, expected_ch1, expected_ch2}, {true, true, true, true}}; - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, values, expected_keys, @@ -500,9 +500,9 @@ TEST_F(groupby_nth_element_structs_test, EmptyInput) auto expected_ch1 = doubles{}; auto expected_ch2 = strings{}; auto expected_values = structs{{expected_ch0, expected_ch1, expected_ch2}}; - test_single_agg(keys, - values, - expected_keys, - expected_values, - cudf::make_nth_element_aggregation(0)); + CUDF_TEST_SINGLE_AGG(keys, + values, + expected_keys, + expected_values, + cudf::make_nth_element_aggregation(0)); } diff --git a/cpp/tests/groupby/nunique_tests.cpp b/cpp/tests/groupby/nunique_tests.cpp index fad4c0ef45c..b317d0e6117 100644 --- a/cpp/tests/groupby/nunique_tests.cpp +++ b/cpp/tests/groupby/nunique_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -35,9 +35,9 @@ TYPED_TEST(groupby_nunique_test, basic) auto agg = cudf::make_nunique_aggregation(); if (std::is_same()) - test_single_agg(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); else - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, empty_cols) @@ -53,7 +53,7 @@ TYPED_TEST(groupby_nunique_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_nunique_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, basic_duplicates) @@ -71,9 +71,9 @@ TYPED_TEST(groupby_nunique_test, basic_duplicates) auto agg = cudf::make_nunique_aggregation(); if (std::is_same()) - test_single_agg(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); else - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, zero_valid_keys) @@ -89,7 +89,7 @@ TYPED_TEST(groupby_nunique_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_nunique_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, zero_valid_values) @@ -105,7 +105,7 @@ TYPED_TEST(groupby_nunique_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals{0}; auto agg = cudf::make_nunique_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, null_keys_and_values) @@ -129,9 +129,9 @@ TYPED_TEST(groupby_nunique_test, null_keys_and_values) auto agg = cudf::make_nunique_aggregation(); if (std::is_same()) - test_single_agg(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); else - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, null_keys_and_values_with_duplicates) @@ -156,9 +156,9 @@ TYPED_TEST(groupby_nunique_test, null_keys_and_values_with_duplicates) auto agg = cudf::make_nunique_aggregation(); if (std::is_same()) - test_single_agg(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); else - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, include_nulls) @@ -183,9 +183,9 @@ TYPED_TEST(groupby_nunique_test, include_nulls) auto agg = cudf::make_nunique_aggregation(cudf::null_policy::INCLUDE); if (std::is_same()) - test_single_agg(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); else - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, dictionary) @@ -211,7 +211,7 @@ TYPED_TEST(groupby_nunique_test, dictionary) cudf::column_view expect_vals = (std::is_same()) ? cudf::column_view{expect_bool_vals} : cudf::column_view{expect_fixed_vals}; - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, diff --git a/cpp/tests/groupby/product_scan_tests.cpp b/cpp/tests/groupby/product_scan_tests.cpp index 3b4b45bc172..c5d3c4e8a82 100644 --- a/cpp/tests/groupby/product_scan_tests.cpp +++ b/cpp/tests/groupby/product_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -41,7 +41,7 @@ TYPED_TEST(groupby_product_scan_test, basic) result_wrapper expect_vals{0, 0, 0, 1, 4, 20, 180, 2, 14, 112}; // clang-format on auto agg = cudf::make_product_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_product_scan_test, pre_sorted) @@ -58,13 +58,13 @@ TYPED_TEST(groupby_product_scan_test, pre_sorted) // clang-format on auto agg = cudf::make_product_aggregation(); - test_single_scan(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + CUDF_TEST_SINGLE_SCAN(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_product_scan_test, empty_cols) @@ -79,7 +79,7 @@ TYPED_TEST(groupby_product_scan_test, empty_cols) result_wrapper expect_vals{}; auto agg = cudf::make_product_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_product_scan_test, zero_valid_keys) @@ -93,7 +93,7 @@ TYPED_TEST(groupby_product_scan_test, zero_valid_keys) result_wrapper expect_vals{}; auto agg = cudf::make_product_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_product_scan_test, zero_valid_values) @@ -107,7 +107,7 @@ TYPED_TEST(groupby_product_scan_test, zero_valid_values) result_wrapper expect_vals({3, 4, 5}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_product_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_product_scan_test, null_keys_and_values) @@ -127,5 +127,5 @@ TYPED_TEST(groupby_product_scan_test, null_keys_and_values) // clang-format on auto agg = cudf::make_product_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } diff --git a/cpp/tests/groupby/product_tests.cpp b/cpp/tests/groupby/product_tests.cpp index 87b728f18cb..88f4b5bb5ef 100644 --- a/cpp/tests/groupby/product_tests.cpp +++ b/cpp/tests/groupby/product_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -37,11 +37,11 @@ TYPED_TEST(groupby_product_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({ 0., 180., 112. }, no_nulls()); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, empty_cols) @@ -56,11 +56,11 @@ TYPED_TEST(groupby_product_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_keys{}; cudf::test::fixed_width_column_wrapper expect_vals{}; - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, zero_valid_keys) @@ -75,11 +75,11 @@ TYPED_TEST(groupby_product_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_keys{}; cudf::test::fixed_width_column_wrapper expect_vals{}; - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, zero_valid_values) @@ -94,11 +94,11 @@ TYPED_TEST(groupby_product_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_keys{1}; cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, null_keys_and_values) @@ -120,11 +120,11 @@ TYPED_TEST(groupby_product_test, null_keys_and_values) { 1, 1, 1, 0}); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, dictionary) @@ -143,11 +143,11 @@ TYPED_TEST(groupby_product_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({ 0., 180., 112. }, no_nulls()); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, dictionary_with_nulls) @@ -167,9 +167,9 @@ TYPED_TEST(groupby_product_test, dictionary_with_nulls) cudf::test::fixed_width_column_wrapper expect_vals({ 0., 180., 56. }, no_nulls()); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } diff --git a/cpp/tests/groupby/quantile_tests.cpp b/cpp/tests/groupby/quantile_tests.cpp index 0bb2ca52eb2..02182b799de 100644 --- a/cpp/tests/groupby/quantile_tests.cpp +++ b/cpp/tests/groupby/quantile_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -39,7 +39,7 @@ TYPED_TEST(groupby_quantile_test, basic) auto agg = cudf::make_quantile_aggregation({0.5}, cudf::interpolation::LINEAR); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_quantile_test, empty_cols) @@ -55,7 +55,7 @@ TYPED_TEST(groupby_quantile_test, empty_cols) auto agg = cudf::make_quantile_aggregation({0.5}, cudf::interpolation::LINEAR); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_quantile_test, zero_valid_keys) @@ -71,7 +71,7 @@ TYPED_TEST(groupby_quantile_test, zero_valid_keys) auto agg = cudf::make_quantile_aggregation({0.5}, cudf::interpolation::LINEAR); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_quantile_test, zero_valid_values) @@ -87,7 +87,7 @@ TYPED_TEST(groupby_quantile_test, zero_valid_values) auto agg = cudf::make_quantile_aggregation({0.5}, cudf::interpolation::LINEAR); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_quantile_test, null_keys_and_values) @@ -108,7 +108,7 @@ TYPED_TEST(groupby_quantile_test, null_keys_and_values) auto agg = cudf::make_quantile_aggregation({0.5}, cudf::interpolation::LINEAR); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_quantile_test, multiple_quantile) @@ -128,17 +128,17 @@ TYPED_TEST(groupby_quantile_test, multiple_quantile) auto agg = cudf::make_quantile_aggregation( {0.25, 0.75}, cudf::interpolation::LINEAR); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::YES, - cudf::null_policy::EXCLUDE, - cudf::sorted::NO, - {}, - {}, - cudf::sorted::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::YES, + cudf::null_policy::EXCLUDE, + cudf::sorted::NO, + {}, + {}, + cudf::sorted::YES); } TYPED_TEST(groupby_quantile_test, interpolation_types) @@ -156,27 +156,27 @@ TYPED_TEST(groupby_quantile_test, interpolation_types) // {0, 3, 6, 1, 4, 5, 9, 2, 7} cudf::test::fixed_width_column_wrapper expect_vals1({2.4, 4.2, 4.}, no_nulls()); auto agg1 = cudf::make_quantile_aggregation({0.4}, cudf::interpolation::LINEAR); - test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg1)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg1)); // {0, 3, 6, 1, 4, 5, 9, 2, 7} cudf::test::fixed_width_column_wrapper expect_vals2({3, 4, 2}, no_nulls()); auto agg2 = cudf::make_quantile_aggregation({0.4}, cudf::interpolation::NEAREST); - test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg2)); // {0, 3, 6, 1, 4, 5, 9, 2, 7} cudf::test::fixed_width_column_wrapper expect_vals3({0, 4, 2}, no_nulls()); auto agg3 = cudf::make_quantile_aggregation({0.4}, cudf::interpolation::LOWER); - test_single_agg(keys, vals, expect_keys, expect_vals3, std::move(agg3)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals3, std::move(agg3)); // {0, 3, 6, 1, 4, 5, 9, 2, 7} cudf::test::fixed_width_column_wrapper expect_vals4({3, 5, 7}, no_nulls()); auto agg4 = cudf::make_quantile_aggregation({0.4}, cudf::interpolation::HIGHER); - test_single_agg(keys, vals, expect_keys, expect_vals4, std::move(agg4)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals4, std::move(agg4)); // {0, 3, 6, 1, 4, 5, 9, 2, 7} cudf::test::fixed_width_column_wrapper expect_vals5({1.5, 4.5, 4.5}, no_nulls()); auto agg5 = cudf::make_quantile_aggregation({0.4}, cudf::interpolation::MIDPOINT); - test_single_agg(keys, vals, expect_keys, expect_vals5, std::move(agg5)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals5, std::move(agg5)); // clang-format on } @@ -195,7 +195,7 @@ TYPED_TEST(groupby_quantile_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({3., 4.5, 7.}, no_nulls()); // clang-format on - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, diff --git a/cpp/tests/groupby/rank_scan_tests.cpp b/cpp/tests/groupby/rank_scan_tests.cpp index a123093fd52..29551957ac1 100644 --- a/cpp/tests/groupby/rank_scan_tests.cpp +++ b/cpp/tests/groupby/rank_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -28,34 +28,34 @@ void test_rank_scans(cudf::column_view const& keys, cudf::column_view const& expected_rank, cudf::column_view const& expected_percent_rank) { - test_single_scan(keys, - order, - keys, - expected_dense, - cudf::make_rank_aggregation( - cudf::rank_method::DENSE, {}, cudf::null_policy::INCLUDE), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); - test_single_scan(keys, - order, - keys, - expected_rank, - cudf::make_rank_aggregation( - cudf::rank_method::MIN, {}, cudf::null_policy::INCLUDE), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); - test_single_scan(keys, - order, - keys, - expected_percent_rank, - cudf::make_rank_aggregation( - cudf::rank_method::MIN, - {}, - cudf::null_policy::INCLUDE, - {}, - cudf::rank_percentage::ONE_NORMALIZED), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); + CUDF_TEST_SINGLE_SCAN(keys, + order, + keys, + expected_dense, + cudf::make_rank_aggregation( + cudf::rank_method::DENSE, {}, cudf::null_policy::INCLUDE), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); + CUDF_TEST_SINGLE_SCAN(keys, + order, + keys, + expected_rank, + cudf::make_rank_aggregation( + cudf::rank_method::MIN, {}, cudf::null_policy::INCLUDE), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); + CUDF_TEST_SINGLE_SCAN(keys, + order, + keys, + expected_percent_rank, + cudf::make_rank_aggregation( + cudf::rank_method::MIN, + {}, + cudf::null_policy::INCLUDE, + {}, + cudf::rank_percentage::ONE_NORMALIZED), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); } struct groupby_rank_scan_test : public cudf::test::BaseFixture {}; @@ -521,63 +521,63 @@ TEST_F(groupby_rank_scan_test_failures, DISABLED_test_exception_triggers) auto const col = input{3, 3, 1}; // All of these aggregations raise exceptions unless provided presorted keys - EXPECT_THROW(test_single_scan(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::DENSE), - cudf::null_policy::INCLUDE, - cudf::sorted::NO), + EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::DENSE), + cudf::null_policy::INCLUDE, + cudf::sorted::NO), cudf::logic_error); - EXPECT_THROW(test_single_scan(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::MIN), - cudf::null_policy::INCLUDE, - cudf::sorted::NO), + EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::MIN), + cudf::null_policy::INCLUDE, + cudf::sorted::NO), cudf::logic_error); - EXPECT_THROW(test_single_scan(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::DENSE), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES), + EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::DENSE), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES), cudf::logic_error); - EXPECT_THROW(test_single_scan(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::MIN), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES), + EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::MIN), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES), cudf::logic_error); - EXPECT_THROW(test_single_scan(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::DENSE), - cudf::null_policy::EXCLUDE, - cudf::sorted::NO), + EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::DENSE), + cudf::null_policy::EXCLUDE, + cudf::sorted::NO), cudf::logic_error); - EXPECT_THROW(test_single_scan(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::MIN), - cudf::null_policy::EXCLUDE, - cudf::sorted::NO), + EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::MIN), + cudf::null_policy::EXCLUDE, + cudf::sorted::NO), cudf::logic_error); } diff --git a/cpp/tests/groupby/std_tests.cpp b/cpp/tests/groupby/std_tests.cpp index 2d5d21509df..8c7d603ff69 100644 --- a/cpp/tests/groupby/std_tests.cpp +++ b/cpp/tests/groupby/std_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,7 @@ TYPED_TEST(groupby_std_test, basic) // clang-format on auto agg = cudf::make_std_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, empty_cols) @@ -54,7 +54,7 @@ TYPED_TEST(groupby_std_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_std_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, zero_valid_keys) @@ -70,7 +70,7 @@ TYPED_TEST(groupby_std_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_std_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, zero_valid_values) @@ -86,7 +86,7 @@ TYPED_TEST(groupby_std_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_std_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, null_keys_and_values) @@ -108,7 +108,7 @@ TYPED_TEST(groupby_std_test, null_keys_and_values) {1, 1, 1, 0}); auto agg = cudf::make_std_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, ddof_non_default) @@ -130,7 +130,7 @@ TYPED_TEST(groupby_std_test, ddof_non_default) {0, 1, 0, 0}); auto agg = cudf::make_std_aggregation(2); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, dictionary) @@ -149,6 +149,6 @@ TYPED_TEST(groupby_std_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({3., sqrt(131./12), sqrt(31./3)}, no_nulls()); // clang-format on - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals, cudf::make_std_aggregation()); } diff --git a/cpp/tests/groupby/structs_tests.cpp b/cpp/tests/groupby/structs_tests.cpp index 34fcb7e0380..8fcfcfd0527 100644 --- a/cpp/tests/groupby/structs_tests.cpp +++ b/cpp/tests/groupby/structs_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -79,7 +79,7 @@ TYPED_TEST(groupby_structs_test, basic) auto expected_keys = cudf::test::structs_column_wrapper{expected_member_0, expected_member_1, expected_member_2}; // clang-format on - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, structs_with_nulls_in_members) @@ -107,7 +107,7 @@ TYPED_TEST(groupby_structs_test, structs_with_nulls_in_members) auto expected_keys = cudf::test::structs_column_wrapper{expected_member_0, expected_member_1, expected_member_2}; // clang-format on - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, structs_with_null_rows) @@ -133,7 +133,7 @@ TYPED_TEST(groupby_structs_test, structs_with_null_rows) print_agg_results(keys, values); - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, structs_with_nulls_in_rows_and_members) @@ -162,7 +162,7 @@ TYPED_TEST(groupby_structs_test, structs_with_nulls_in_rows_and_members) // clang-format on print_agg_results(keys, values); - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, null_members_differ_from_null_structs) @@ -196,7 +196,7 @@ TYPED_TEST(groupby_structs_test, null_members_differ_from_null_structs) auto expected_keys = cudf::test::structs_column_wrapper{{expected_member_0, expected_member_1, expected_member_2}, null_at(4)}; // clang-format on - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, structs_of_structs) @@ -232,7 +232,7 @@ TYPED_TEST(groupby_structs_test, structs_of_structs) auto expected_keys = cudf::test::structs_column_wrapper{{expected_structs, expected_struct_1_member_1}}; // clang-format on - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, empty_input) @@ -256,7 +256,7 @@ TYPED_TEST(groupby_structs_test, empty_input) auto expected_keys = cudf::test::structs_column_wrapper{expected_member_0, expected_member_1, expected_member_2}; // clang-format on - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, all_null_input) @@ -280,7 +280,7 @@ TYPED_TEST(groupby_structs_test, all_null_input) auto expected_keys = cudf::test::structs_column_wrapper{{expected_member_0, expected_member_1, expected_member_2}, all_nulls()}; // clang-format on - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, lists_as_keys) @@ -304,5 +304,5 @@ TYPED_TEST(groupby_structs_test, lists_as_keys) // clang-format on auto expected_keys = cudf::test::structs_column_wrapper{{expected_member_0, expected_member_1}}; - test_sum_agg(keys, values, expected_keys, expected_values); + CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); } diff --git a/cpp/tests/groupby/sum_of_squares_tests.cpp b/cpp/tests/groupby/sum_of_squares_tests.cpp index e4da29128bc..789be4096e9 100644 --- a/cpp/tests/groupby/sum_of_squares_tests.cpp +++ b/cpp/tests/groupby/sum_of_squares_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -36,7 +36,7 @@ TYPED_TEST(groupby_sum_of_squares_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({45., 123., 117.}, no_nulls()); auto agg = cudf::make_sum_of_squares_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_of_squares_test, empty_cols) @@ -52,7 +52,7 @@ TYPED_TEST(groupby_sum_of_squares_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_sum_of_squares_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_of_squares_test, zero_valid_keys) @@ -68,7 +68,7 @@ TYPED_TEST(groupby_sum_of_squares_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_sum_of_squares_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_of_squares_test, zero_valid_values) @@ -84,7 +84,7 @@ TYPED_TEST(groupby_sum_of_squares_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_sum_of_squares_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_of_squares_test, null_keys_and_values) @@ -105,7 +105,7 @@ TYPED_TEST(groupby_sum_of_squares_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({45., 98., 68., 9.}, {1, 1, 1, 0}); auto agg = cudf::make_sum_of_squares_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_of_squares_test, dictionary) @@ -124,9 +124,9 @@ TYPED_TEST(groupby_sum_of_squares_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({45., 123., 117. }, no_nulls()); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_sum_of_squares_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_sum_of_squares_aggregation()); } diff --git a/cpp/tests/groupby/sum_scan_tests.cpp b/cpp/tests/groupby/sum_scan_tests.cpp index bcb2f0233b5..b7fb832d616 100644 --- a/cpp/tests/groupby/sum_scan_tests.cpp +++ b/cpp/tests/groupby/sum_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -42,7 +42,7 @@ TYPED_TEST(groupby_sum_scan_test, basic) result_wrapper expect_vals{0, 3, 9, 1, 5, 10, 19, 2, 9, 17}; // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_scan_test, pre_sorted) @@ -59,13 +59,13 @@ TYPED_TEST(groupby_sum_scan_test, pre_sorted) // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_scan(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + CUDF_TEST_SINGLE_SCAN(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_sum_scan_test, empty_cols) @@ -82,7 +82,7 @@ TYPED_TEST(groupby_sum_scan_test, empty_cols) // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_scan_test, zero_valid_keys) @@ -96,7 +96,7 @@ TYPED_TEST(groupby_sum_scan_test, zero_valid_keys) result_wrapper expect_vals{}; auto agg = cudf::make_sum_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_scan_test, zero_valid_values) @@ -110,7 +110,7 @@ TYPED_TEST(groupby_sum_scan_test, zero_valid_values) result_wrapper expect_vals({3, 4, 5}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_sum_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_scan_test, null_keys_and_values) @@ -130,7 +130,7 @@ TYPED_TEST(groupby_sum_scan_test, null_keys_and_values) // clang-format on auto agg = cudf::make_sum_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); } template @@ -156,6 +156,6 @@ TYPED_TEST(GroupBySumScanFixedPointTest, GroupBySortSumScanDecimalAsValue) // clang-format on auto agg2 = cudf::make_sum_aggregation(); - test_single_scan(keys, vals, expect_keys, expect_vals_sum, std::move(agg2)); + CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals_sum, std::move(agg2)); } } diff --git a/cpp/tests/groupby/sum_tests.cpp b/cpp/tests/groupby/sum_tests.cpp index 3938547ad2a..7ee0406b428 100644 --- a/cpp/tests/groupby/sum_tests.cpp +++ b/cpp/tests/groupby/sum_tests.cpp @@ -36,10 +36,11 @@ TYPED_TEST(groupby_sum_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{9, 19, 17}; auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_sum_test, empty_cols) @@ -54,10 +55,11 @@ TYPED_TEST(groupby_sum_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_sum_test, zero_valid_keys) @@ -72,10 +74,11 @@ TYPED_TEST(groupby_sum_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_sum_test, zero_valid_values) @@ -90,10 +93,11 @@ TYPED_TEST(groupby_sum_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_sum_test, null_keys_and_values) @@ -114,10 +118,11 @@ TYPED_TEST(groupby_sum_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({9, 14, 10, 0}, {1, 1, 1, 0}); auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG( + keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_sum_test, dictionary) @@ -130,14 +135,14 @@ TYPED_TEST(groupby_sum_test, dictionary) cudf::test::fixed_width_column_wrapper expect_keys{1, 2, 3}; cudf::test::fixed_width_column_wrapper expect_vals{9, 19, 17}; - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals, cudf::make_sum_aggregation()); - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_sum_aggregation(), - force_use_sort_impl::YES); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_sum_aggregation(), + force_use_sort_impl::YES); } struct overflow_test : public cudf::test::BaseFixture {}; @@ -153,7 +158,7 @@ TEST_F(overflow_test, overflow_integer) auto test_sum = [&](auto const use_sort) { auto agg = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), use_sort); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg), use_sort); }; test_sum(force_use_sort_impl::NO); @@ -184,12 +189,12 @@ TYPED_TEST(GroupBySumFixedPointTest, GroupBySortSumDecimalAsValue) auto const expect_vals_sum = fp_wrapper{{9, 19, 17}, scale}; auto agg1 = cudf::make_sum_aggregation(); - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals_sum, std::move(agg1), force_use_sort_impl::YES); auto agg4 = cudf::make_product_aggregation(); EXPECT_THROW( - test_single_agg(keys, vals, expect_keys, {}, std::move(agg4), force_use_sort_impl::YES), + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, {}, std::move(agg4), force_use_sort_impl::YES), cudf::logic_error); } } @@ -213,13 +218,14 @@ TYPED_TEST(GroupBySumFixedPointTest, GroupByHashSumDecimalAsValue) auto const expect_vals_sum = fp_wrapper{{9, 19, 17}, scale}; auto agg5 = cudf::make_sum_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals_sum, std::move(agg5)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals_sum, std::move(agg5)); auto agg6 = cudf::make_sum_aggregation(); - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, expect_vals_sum, std::move(agg6), force_use_sort_impl::NO); auto agg8 = cudf::make_product_aggregation(); - EXPECT_THROW(test_single_agg(keys, vals, expect_keys, {}, std::move(agg8)), cudf::logic_error); + EXPECT_THROW(CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, {}, std::move(agg8)), + cudf::logic_error); } } diff --git a/cpp/tests/groupby/sum_with_overflow_tests.cpp b/cpp/tests/groupby/sum_with_overflow_tests.cpp index a320f4c1f64..b28eb373d3f 100644 --- a/cpp/tests/groupby/sum_with_overflow_tests.cpp +++ b/cpp/tests/groupby/sum_with_overflow_tests.cpp @@ -54,12 +54,12 @@ TYPED_TEST(groupby_sum_with_overflow_test, basic) auto expect_vals = cudf::create_structs_hierarchy(3, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); // SUM_WITH_OVERFLOW should throw with sort-based groupby auto agg_sort = cudf::make_sum_with_overflow_aggregation(); EXPECT_THROW( - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, *expect_vals, std::move(agg_sort), force_use_sort_impl::YES), cudf::logic_error); } else { @@ -76,12 +76,12 @@ TYPED_TEST(groupby_sum_with_overflow_test, basic) auto expect_vals = cudf::create_structs_hierarchy(3, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); // SUM_WITH_OVERFLOW should throw with sort-based groupby auto agg_sort = cudf::make_sum_with_overflow_aggregation(); EXPECT_THROW( - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, *expect_vals, std::move(agg_sort), force_use_sort_impl::YES), cudf::logic_error); } @@ -109,7 +109,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, empty_cols) auto expect_vals = cudf::create_structs_hierarchy(0, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); // Note: SUM_WITH_OVERFLOW only works with hash groupby, not sort groupby } @@ -134,7 +134,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, zero_valid_keys) auto expect_vals = cudf::create_structs_hierarchy(0, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); // Note: SUM_WITH_OVERFLOW only works with hash groupby, not sort groupby } @@ -163,7 +163,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, zero_valid_values) cudf::create_structs_hierarchy(1, std::move(children), null_count, std::move(validity_mask)); auto agg = cudf::make_sum_with_overflow_aggregation(); - test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); // Note: SUM_WITH_OVERFLOW only works with hash groupby, not sort groupby } @@ -198,7 +198,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, null_keys_and_values) cudf::create_structs_hierarchy(4, std::move(children), null_count, std::move(validity_mask)); auto agg = cudf::make_sum_with_overflow_aggregation(); - test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); // Note: SUM_WITH_OVERFLOW only works with hash groupby, not sort groupby } @@ -273,12 +273,12 @@ TYPED_TEST(groupby_sum_with_overflow_test, overflow_detection) auto expect_vals = cudf::create_structs_hierarchy(4, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); // Verify that sort-based groupby throws for decimals auto agg2 = cudf::make_sum_with_overflow_aggregation(); EXPECT_THROW( - test_single_agg( + CUDF_TEST_SINGLE_AGG( keys, vals, expect_keys, *expect_vals, std::move(agg2), force_use_sort_impl::YES), cudf::logic_error); } else { @@ -343,7 +343,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, overflow_detection) auto expect_vals = cudf::create_structs_hierarchy(4, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); } else { // For unsigned types: only test positive overflow cudf::test::fixed_width_column_wrapper vals{ @@ -380,7 +380,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, overflow_detection) auto expect_vals = cudf::create_structs_hierarchy(4, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); } // Note: SUM_WITH_OVERFLOW only works with hash groupby, not sort groupby diff --git a/cpp/tests/groupby/var_tests.cpp b/cpp/tests/groupby/var_tests.cpp index 2de32181638..90cf6d15190 100644 --- a/cpp/tests/groupby/var_tests.cpp +++ b/cpp/tests/groupby/var_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,7 @@ TYPED_TEST(groupby_var_test, basic) // clang-format on auto agg = cudf::make_variance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, empty_cols) @@ -54,7 +54,7 @@ TYPED_TEST(groupby_var_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_variance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, zero_valid_keys) @@ -70,7 +70,7 @@ TYPED_TEST(groupby_var_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_variance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, zero_valid_values) @@ -86,7 +86,7 @@ TYPED_TEST(groupby_var_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_variance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, null_keys_and_values) @@ -109,7 +109,7 @@ TYPED_TEST(groupby_var_test, null_keys_and_values) // clang-format on auto agg = cudf::make_variance_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, ddof_non_default) @@ -133,7 +133,7 @@ TYPED_TEST(groupby_var_test, ddof_non_default) // clang-format on auto agg = cudf::make_variance_aggregation(2); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, dictionary) @@ -152,11 +152,11 @@ TYPED_TEST(groupby_var_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({9., 131./12, 31./3 }, no_nulls()); // clang-format on - test_single_agg(keys, - vals, - expect_keys, - expect_vals, - cudf::make_variance_aggregation()); + CUDF_TEST_SINGLE_AGG(keys, + vals, + expect_keys, + expect_vals, + cudf::make_variance_aggregation()); } // This test ensures that the same results are produced by the sort-based and From d4b0be5a7403a8e70b603e4ad8d08eb7bee73453 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Mon, 24 Nov 2025 14:31:07 -0800 Subject: [PATCH 02/10] Wrap in namespace Signed-off-by: Nghia Truong --- cpp/tests/groupby/groupby_test_util.cpp | 110 ++++++++++++------------ cpp/tests/groupby/groupby_test_util.hpp | 60 +++++++------ 2 files changed, 87 insertions(+), 83 deletions(-) diff --git a/cpp/tests/groupby/groupby_test_util.cpp b/cpp/tests/groupby/groupby_test_util.cpp index 788e118b203..742a4987915 100644 --- a/cpp/tests/groupby/groupby_test_util.cpp +++ b/cpp/tests/groupby/groupby_test_util.cpp @@ -17,70 +17,68 @@ #include #include +namespace cudf ::test { + void test_single_agg(char const* file, int line, - cudf::column_view const& keys, - cudf::column_view const& values, - cudf::column_view const& expect_keys, - cudf::column_view const& expect_vals, - std::unique_ptr&& agg, + column_view const& keys, + column_view const& values, + column_view const& expect_keys, + column_view const& expect_vals, + std::unique_ptr&& agg, force_use_sort_impl use_sort, - cudf::null_policy include_null_keys, - cudf::sorted keys_are_sorted, - std::vector const& column_order, - std::vector const& null_precedence, - cudf::sorted reference_keys_are_sorted) + null_policy include_null_keys, + sorted keys_are_sorted, + std::vector const& column_order, + std::vector const& null_precedence, + sorted reference_keys_are_sorted) { SCOPED_TRACE("Original line of failure: " + std::to_string(line) + ", file: " + std::string{file}); auto const [sorted_expect_keys, sorted_expect_vals] = [&]() { - if (reference_keys_are_sorted == cudf::sorted::NO) { + if (reference_keys_are_sorted == sorted::NO) { auto const sort_expect_order = - cudf::sorted_order(cudf::table_view{{expect_keys}}, column_order, null_precedence); - auto sorted_expect_keys = cudf::gather(cudf::table_view{{expect_keys}}, *sort_expect_order); - auto sorted_expect_vals = cudf::gather(cudf::table_view{{expect_vals}}, *sort_expect_order); - return std::make_pair(std::move(sorted_expect_keys), std::move(sorted_expect_vals)); - } else { - auto sorted_expect_keys = std::make_unique(cudf::table_view{{expect_keys}}); - auto sorted_expect_vals = std::make_unique(cudf::table_view{{expect_vals}}); + sorted_order(table_view{{expect_keys}}, column_order, null_precedence); + auto sorted_expect_keys = gather(table_view{{expect_keys}}, *sort_expect_order); + auto sorted_expect_vals = gather(table_view{{expect_vals}}, *sort_expect_order); return std::make_pair(std::move(sorted_expect_keys), std::move(sorted_expect_vals)); } + auto sorted_expect_keys = std::make_unique(table_view{{expect_keys}}); + auto sorted_expect_vals = std::make_unique
(table_view{{expect_vals}}); + return std::make_pair(std::move(sorted_expect_keys), std::move(sorted_expect_vals)); }(); - std::vector requests; + std::vector requests; requests.emplace_back(); requests[0].values = values; requests[0].aggregations.push_back(std::move(agg)); if (use_sort == force_use_sort_impl::YES) { - // WAR to force cudf::groupby to use sort implementation - requests[0].aggregations.push_back( - cudf::make_nth_element_aggregation(0)); + // WAR to force groupby to use sort implementation + requests[0].aggregations.push_back(make_nth_element_aggregation(0)); } - // since the default behavior of cudf::groupby(...) for an empty null_precedence vector is - // null_order::AFTER whereas for cudf::sorted_order(...) it's null_order::BEFORE - auto const precedence = null_precedence.empty() - ? std::vector(1, cudf::null_order::BEFORE) - : null_precedence; + // since the default behavior of groupby(...) for an empty null_precedence vector is + // null_order::AFTER whereas for sorted_order(...) it's null_order::BEFORE + auto const precedence = + null_precedence.empty() ? std::vector(1, null_order::BEFORE) : null_precedence; - cudf::groupby::groupby gb_obj( - cudf::table_view({keys}), include_null_keys, keys_are_sorted, column_order, precedence); + groupby::groupby gb_obj( + table_view({keys}), include_null_keys, keys_are_sorted, column_order, precedence); - auto result = gb_obj.aggregate(requests, cudf::test::get_default_stream()); + auto result = gb_obj.aggregate(requests, test::get_default_stream()); - if (use_sort == force_use_sort_impl::YES && keys_are_sorted == cudf::sorted::NO) { + if (use_sort == force_use_sort_impl::YES && keys_are_sorted == sorted::NO) { CUDF_TEST_EXPECT_TABLES_EQUAL(*sorted_expect_keys, result.first->view()); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(sorted_expect_vals->get_column(0), *result.second[0].results[0]); } else { - auto const sort_order = cudf::sorted_order(result.first->view(), column_order, precedence); - auto const sorted_keys = cudf::gather(result.first->view(), *sort_order); - auto const sorted_vals = - cudf::gather(cudf::table_view({result.second[0].results[0]->view()}), *sort_order); + auto const sort_order = sorted_order(result.first->view(), column_order, precedence); + auto const sorted_keys = gather(result.first->view(), *sort_order); + auto const sorted_vals = gather(table_view({result.second[0].results[0]->view()}), *sort_order); CUDF_TEST_EXPECT_TABLES_EQUAL(*sorted_expect_keys, *sorted_keys); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(sorted_expect_vals->get_column(0), @@ -90,10 +88,10 @@ void test_single_agg(char const* file, void test_sum_agg(char const* file, int line, - cudf::column_view const& keys, - cudf::column_view const& values, - cudf::column_view const& expected_keys, - cudf::column_view const& expected_values) + column_view const& keys, + column_view const& values, + column_view const& expected_keys, + column_view const& expected_values) { auto const do_test = [&](auto const use_sort_option) { test_single_agg(file, @@ -102,9 +100,9 @@ void test_sum_agg(char const* file, values, expected_keys, expected_values, - cudf::make_sum_aggregation(), + make_sum_aggregation(), use_sort_option, - cudf::null_policy::INCLUDE); + null_policy::INCLUDE); }; do_test(force_use_sort_impl::YES); do_test(force_use_sort_impl::NO); @@ -112,30 +110,32 @@ void test_sum_agg(char const* file, void test_single_scan(char const* file, int line, - cudf::column_view const& keys, - cudf::column_view const& values, - cudf::column_view const& expect_keys, - cudf::column_view const& expect_vals, - std::unique_ptr&& agg, - cudf::null_policy include_null_keys, - cudf::sorted keys_are_sorted, - std::vector const& column_order, - std::vector const& null_precedence) + column_view const& keys, + column_view const& values, + column_view const& expect_keys, + column_view const& expect_vals, + std::unique_ptr&& agg, + null_policy include_null_keys, + sorted keys_are_sorted, + std::vector const& column_order, + std::vector const& null_precedence) { SCOPED_TRACE("Original line of failure: " + std::to_string(line) + ", file: " + std::string{file}); - std::vector requests; + std::vector requests; requests.emplace_back(); requests[0].values = values; requests[0].aggregations.push_back(std::move(agg)); - cudf::groupby::groupby gb_obj( - cudf::table_view({keys}), include_null_keys, keys_are_sorted, column_order, null_precedence); + groupby::groupby gb_obj( + table_view({keys}), include_null_keys, keys_are_sorted, column_order, null_precedence); - // cudf::groupby scan uses sort implementation + // groupby scan uses sort implementation auto result = gb_obj.scan(requests); - CUDF_TEST_EXPECT_TABLES_EQUAL(cudf::table_view({expect_keys}), result.first->view()); + CUDF_TEST_EXPECT_TABLES_EQUAL(table_view({expect_keys}), result.first->view()); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(expect_vals, *result.second[0].results[0]); } + +} // namespace cudf::test \ No newline at end of file diff --git a/cpp/tests/groupby/groupby_test_util.hpp b/cpp/tests/groupby/groupby_test_util.hpp index 25551bd584f..53e8d7d9148 100644 --- a/cpp/tests/groupby/groupby_test_util.hpp +++ b/cpp/tests/groupby/groupby_test_util.hpp @@ -10,38 +10,42 @@ enum class force_use_sort_impl : bool { NO, YES }; +namespace cudf::test { + void test_single_agg(char const* file, int line, - cudf::column_view const& keys, - cudf::column_view const& values, - cudf::column_view const& expect_keys, - cudf::column_view const& expect_vals, - std::unique_ptr&& agg, - force_use_sort_impl use_sort = force_use_sort_impl::NO, - cudf::null_policy include_null_keys = cudf::null_policy::EXCLUDE, - cudf::sorted keys_are_sorted = cudf::sorted::NO, - std::vector const& column_order = {}, - std::vector const& null_precedence = {}, - cudf::sorted reference_keys_are_sorted = cudf::sorted::NO); + column_view const& keys, + column_view const& values, + column_view const& expect_keys, + column_view const& expect_vals, + std::unique_ptr&& agg, + force_use_sort_impl use_sort = force_use_sort_impl::NO, + null_policy include_null_keys = null_policy::EXCLUDE, + sorted keys_are_sorted = sorted::NO, + std::vector const& column_order = {}, + std::vector const& null_precedence = {}, + sorted reference_keys_are_sorted = sorted::NO); void test_sum_agg(char const* file, int line, - cudf::column_view const& keys, - cudf::column_view const& values, - cudf::column_view const& expected_keys, - cudf::column_view const& expected_values); + column_view const& keys, + column_view const& values, + column_view const& expected_keys, + column_view const& expected_values); void test_single_scan(char const* file, int line, - cudf::column_view const& keys, - cudf::column_view const& values, - cudf::column_view const& expect_keys, - cudf::column_view const& expect_vals, - std::unique_ptr&& agg, - cudf::null_policy include_null_keys = cudf::null_policy::EXCLUDE, - cudf::sorted keys_are_sorted = cudf::sorted::NO, - std::vector const& column_order = {}, - std::vector const& null_precedence = {}); - -#define CUDF_TEST_SINGLE_AGG(...) test_single_agg(__FILE__, __LINE__, __VA_ARGS__) -#define CUDF_TEST_SUM_AGG(...) test_sum_agg(__FILE__, __LINE__, __VA_ARGS__) -#define CUDF_TEST_SINGLE_SCAN(...) test_single_scan(__FILE__, __LINE__, __VA_ARGS__) + column_view const& keys, + column_view const& values, + column_view const& expect_keys, + column_view const& expect_vals, + std::unique_ptr&& agg, + null_policy include_null_keys = null_policy::EXCLUDE, + sorted keys_are_sorted = sorted::NO, + std::vector const& column_order = {}, + std::vector const& null_precedence = {}); + +} // namespace cudf::test + +#define CUDF_TEST_SINGLE_AGG(...) cudf::test::test_single_agg(__FILE__, __LINE__, __VA_ARGS__) +#define CUDF_TEST_SUM_AGG(...) cudf::test::test_sum_agg(__FILE__, __LINE__, __VA_ARGS__) +#define CUDF_TEST_SINGLE_SCAN(...) cudf::test::test_single_scan(__FILE__, __LINE__, __VA_ARGS__) From 5c59bd4f04968ba3a9323fc347a7800dffe8e338 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Mon, 24 Nov 2025 14:53:09 -0800 Subject: [PATCH 03/10] Change report format Signed-off-by: Nghia Truong --- cpp/tests/groupby/groupby_test_util.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cpp/tests/groupby/groupby_test_util.cpp b/cpp/tests/groupby/groupby_test_util.cpp index 742a4987915..28f3edbcbf9 100644 --- a/cpp/tests/groupby/groupby_test_util.cpp +++ b/cpp/tests/groupby/groupby_test_util.cpp @@ -33,8 +33,7 @@ void test_single_agg(char const* file, std::vector const& null_precedence, sorted reference_keys_are_sorted) { - SCOPED_TRACE("Original line of failure: " + std::to_string(line) + - ", file: " + std::string{file}); + SCOPED_TRACE("Original failure location: " + std::string{file} + ":" + std::to_string(line)); auto const [sorted_expect_keys, sorted_expect_vals] = [&]() { if (reference_keys_are_sorted == sorted::NO) { @@ -120,8 +119,7 @@ void test_single_scan(char const* file, std::vector const& column_order, std::vector const& null_precedence) { - SCOPED_TRACE("Original line of failure: " + std::to_string(line) + - ", file: " + std::string{file}); + SCOPED_TRACE("Original failure location: " + std::string{file} + ":" + std::to_string(line)); std::vector requests; requests.emplace_back(); From 1a7ac33f74daadb94dd43eeb6e866d29dfc412df Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Mon, 24 Nov 2025 14:57:58 -0800 Subject: [PATCH 04/10] Fix style Signed-off-by: Nghia Truong --- cpp/tests/groupby/groupby_test_util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/tests/groupby/groupby_test_util.cpp b/cpp/tests/groupby/groupby_test_util.cpp index 28f3edbcbf9..40e9ab71003 100644 --- a/cpp/tests/groupby/groupby_test_util.cpp +++ b/cpp/tests/groupby/groupby_test_util.cpp @@ -136,4 +136,4 @@ void test_single_scan(char const* file, CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(expect_vals, *result.second[0].results[0]); } -} // namespace cudf::test \ No newline at end of file +} // namespace cudf::test From 61d4f2b4d380d232b535e13090ffb7732c163ad7 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Mon, 1 Dec 2025 15:04:55 -0800 Subject: [PATCH 05/10] Rewrite functions using `std::source_location` Signed-off-by: Nghia Truong --- cpp/tests/groupby/groupby_test_util.cpp | 34 ++++++++++++------------- cpp/tests/groupby/groupby_test_util.hpp | 27 ++++++++------------ 2 files changed, 27 insertions(+), 34 deletions(-) diff --git a/cpp/tests/groupby/groupby_test_util.cpp b/cpp/tests/groupby/groupby_test_util.cpp index 40e9ab71003..d190517dbf3 100644 --- a/cpp/tests/groupby/groupby_test_util.cpp +++ b/cpp/tests/groupby/groupby_test_util.cpp @@ -19,9 +19,7 @@ namespace cudf ::test { -void test_single_agg(char const* file, - int line, - column_view const& keys, +void test_single_agg(column_view const& keys, column_view const& values, column_view const& expect_keys, column_view const& expect_vals, @@ -31,9 +29,11 @@ void test_single_agg(char const* file, sorted keys_are_sorted, std::vector const& column_order, std::vector const& null_precedence, - sorted reference_keys_are_sorted) + sorted reference_keys_are_sorted, + std::source_location const location) { - SCOPED_TRACE("Original failure location: " + std::string{file} + ":" + std::to_string(line)); + SCOPED_TRACE("Original failure location: " + std::string{location.file_name()} + ":" + + std::to_string(location.line())); auto const [sorted_expect_keys, sorted_expect_vals] = [&]() { if (reference_keys_are_sorted == sorted::NO) { @@ -85,31 +85,27 @@ void test_single_agg(char const* file, } } -void test_sum_agg(char const* file, - int line, - column_view const& keys, +void test_sum_agg(column_view const& keys, column_view const& values, column_view const& expected_keys, - column_view const& expected_values) + column_view const& expected_values, + std::source_location const location) { auto const do_test = [&](auto const use_sort_option) { - test_single_agg(file, - line, - keys, + test_single_agg(keys, values, expected_keys, expected_values, make_sum_aggregation(), use_sort_option, - null_policy::INCLUDE); + null_policy::INCLUDE, + location); }; do_test(force_use_sort_impl::YES); do_test(force_use_sort_impl::NO); } -void test_single_scan(char const* file, - int line, - column_view const& keys, +void test_single_scan(column_view const& keys, column_view const& values, column_view const& expect_keys, column_view const& expect_vals, @@ -117,9 +113,11 @@ void test_single_scan(char const* file, null_policy include_null_keys, sorted keys_are_sorted, std::vector const& column_order, - std::vector const& null_precedence) + std::vector const& null_precedence, + std::source_location const location) { - SCOPED_TRACE("Original failure location: " + std::string{file} + ":" + std::to_string(line)); + SCOPED_TRACE("Original failure location: " + std::string{location.file_name()} + ":" + + std::to_string(location.line())); std::vector requests; requests.emplace_back(); diff --git a/cpp/tests/groupby/groupby_test_util.hpp b/cpp/tests/groupby/groupby_test_util.hpp index 53e8d7d9148..b5356e1ea0f 100644 --- a/cpp/tests/groupby/groupby_test_util.hpp +++ b/cpp/tests/groupby/groupby_test_util.hpp @@ -8,13 +8,13 @@ #include #include +#include + enum class force_use_sort_impl : bool { NO, YES }; namespace cudf::test { -void test_single_agg(char const* file, - int line, - column_view const& keys, +void test_single_agg(column_view const& keys, column_view const& values, column_view const& expect_keys, column_view const& expect_vals, @@ -24,17 +24,15 @@ void test_single_agg(char const* file, sorted keys_are_sorted = sorted::NO, std::vector const& column_order = {}, std::vector const& null_precedence = {}, - sorted reference_keys_are_sorted = sorted::NO); -void test_sum_agg(char const* file, - int line, - column_view const& keys, + sorted reference_keys_are_sorted = sorted::NO, + std::source_location const location = std::source_location::current()); +void test_sum_agg(column_view const& keys, column_view const& values, column_view const& expected_keys, - column_view const& expected_values); + column_view const& expected_values, + std::source_location const location = std::source_location::current()); -void test_single_scan(char const* file, - int line, - column_view const& keys, +void test_single_scan(column_view const& keys, column_view const& values, column_view const& expect_keys, column_view const& expect_vals, @@ -42,10 +40,7 @@ void test_single_scan(char const* file, null_policy include_null_keys = null_policy::EXCLUDE, sorted keys_are_sorted = sorted::NO, std::vector const& column_order = {}, - std::vector const& null_precedence = {}); + std::vector const& null_precedence = {}, + std::source_location const location = std::source_location::current()); } // namespace cudf::test - -#define CUDF_TEST_SINGLE_AGG(...) cudf::test::test_single_agg(__FILE__, __LINE__, __VA_ARGS__) -#define CUDF_TEST_SUM_AGG(...) cudf::test::test_sum_agg(__FILE__, __LINE__, __VA_ARGS__) -#define CUDF_TEST_SINGLE_SCAN(...) cudf::test::test_single_scan(__FILE__, __LINE__, __VA_ARGS__) From 7b6d67612ec7fa03e366dcba234b767e7587b79d Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Mon, 1 Dec 2025 15:07:11 -0800 Subject: [PATCH 06/10] Revert "Rewrite `groupby_test_util.*`" Signed-off-by: Nghia Truong --- cpp/tests/groupby/argmax_tests.cpp | 60 +++---- cpp/tests/groupby/argmin_tests.cpp | 60 +++---- cpp/tests/groupby/collect_list_tests.cpp | 28 ++-- cpp/tests/groupby/correlation_tests.cpp | 35 ++-- cpp/tests/groupby/count_scan_tests.cpp | 32 ++-- cpp/tests/groupby/count_tests.cpp | 69 ++++---- cpp/tests/groupby/covariance_tests.cpp | 46 ++---- cpp/tests/groupby/keys_tests.cpp | 112 ++++++------- cpp/tests/groupby/lists_tests.cpp | 10 +- cpp/tests/groupby/max_scan_tests.cpp | 36 ++-- cpp/tests/groupby/max_tests.cpp | 139 ++++++++-------- cpp/tests/groupby/mean_tests.cpp | 18 +- cpp/tests/groupby/median_tests.cpp | 22 +-- cpp/tests/groupby/min_scan_tests.cpp | 36 ++-- cpp/tests/groupby/min_tests.cpp | 137 ++++++++-------- cpp/tests/groupby/nth_element_tests.cpp | 132 +++++++-------- cpp/tests/groupby/nunique_tests.cpp | 30 ++-- cpp/tests/groupby/product_scan_tests.cpp | 26 +-- cpp/tests/groupby/product_tests.cpp | 72 ++++---- cpp/tests/groupby/quantile_tests.cpp | 46 +++--- cpp/tests/groupby/rank_scan_tests.cpp | 154 +++++++++--------- cpp/tests/groupby/std_tests.cpp | 16 +- cpp/tests/groupby/structs_tests.cpp | 20 +-- cpp/tests/groupby/sum_of_squares_tests.cpp | 22 +-- cpp/tests/groupby/sum_scan_tests.cpp | 28 ++-- cpp/tests/groupby/sum_tests.cpp | 52 +++--- cpp/tests/groupby/sum_with_overflow_tests.cpp | 24 +-- cpp/tests/groupby/var_tests.cpp | 24 +-- 28 files changed, 711 insertions(+), 775 deletions(-) diff --git a/cpp/tests/groupby/argmax_tests.cpp b/cpp/tests/groupby/argmax_tests.cpp index 62986ac0874..db41219b00f 100644 --- a/cpp/tests/groupby/argmax_tests.cpp +++ b/cpp/tests/groupby/argmax_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -33,11 +33,10 @@ TYPED_TEST(groupby_argmax_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{0, 1, 2}; auto agg = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmax_test, zero_valid_keys) @@ -54,11 +53,10 @@ TYPED_TEST(groupby_argmax_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmax_test, zero_valid_values) @@ -75,11 +73,10 @@ TYPED_TEST(groupby_argmax_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmax_test, null_keys_and_values) @@ -102,11 +99,10 @@ TYPED_TEST(groupby_argmax_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({3, 4, 7, 0}, {1, 1, 1, 0}); auto agg = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_argmax_string_test : public cudf::test::BaseFixture {}; @@ -123,11 +119,10 @@ TEST_F(groupby_argmax_string_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({0, 4, 2}); auto agg = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_argmax_string_test, zero_valid_values) @@ -141,11 +136,10 @@ TEST_F(groupby_argmax_string_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_dictionary_argmax_test : public cudf::test::BaseFixture {}; @@ -162,17 +156,17 @@ TEST_F(groupby_dictionary_argmax_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({ 0, 4, 2 }); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_argmax_aggregation()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_argmax_aggregation(), - force_use_sort_impl::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_argmax_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_argmax_aggregation(), + force_use_sort_impl::YES); } struct groupby_argmax_struct_test : public cudf::test::BaseFixture {}; @@ -191,7 +185,7 @@ TEST_F(groupby_argmax_struct_test, basic) auto const expect_indices = cudf::test::fixed_width_column_wrapper{0, 4, 2}; auto agg = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); } TEST_F(groupby_argmax_struct_test, slice_input) @@ -224,7 +218,7 @@ TEST_F(groupby_argmax_struct_test, slice_input) auto const expect_indices = cudf::test::fixed_width_column_wrapper{0, 4, 2}; auto agg = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); } TEST_F(groupby_argmax_struct_test, null_keys_and_values) @@ -247,7 +241,7 @@ TEST_F(groupby_argmax_struct_test, null_keys_and_values) {0, 4, 2, null}, cudf::test::iterators::null_at(3)}; auto agg = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); } CUDF_TEST_PROGRAM_MAIN() diff --git a/cpp/tests/groupby/argmin_tests.cpp b/cpp/tests/groupby/argmin_tests.cpp index 6b0539e1616..b85337d952b 100644 --- a/cpp/tests/groupby/argmin_tests.cpp +++ b/cpp/tests/groupby/argmin_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -34,11 +34,10 @@ TYPED_TEST(groupby_argmin_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{6, 9, 8}; auto agg = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmin_test, zero_valid_keys) @@ -55,11 +54,10 @@ TYPED_TEST(groupby_argmin_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmin_test, zero_valid_values) @@ -76,11 +74,10 @@ TYPED_TEST(groupby_argmin_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_argmin_test, null_keys_and_values) @@ -102,12 +99,11 @@ TYPED_TEST(groupby_argmin_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({3, 9, 8, 0}, {1, 1, 1, 0}); auto agg = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); // TODO: explore making this a gtest parameter auto agg2 = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_argmin_string_test : public cudf::test::BaseFixture {}; @@ -124,11 +120,10 @@ TEST_F(groupby_argmin_string_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({3, 5, 7}); auto agg = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_argmin_string_test, zero_valid_values) @@ -142,11 +137,10 @@ TEST_F(groupby_argmin_string_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_dictionary_argmin_test : public cudf::test::BaseFixture {}; @@ -163,17 +157,17 @@ TEST_F(groupby_dictionary_argmin_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({ 3, 5, 7 }); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_argmin_aggregation()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_argmin_aggregation(), - force_use_sort_impl::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_argmin_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_argmin_aggregation(), + force_use_sort_impl::YES); } struct groupby_argmin_struct_test : public cudf::test::BaseFixture {}; @@ -192,7 +186,7 @@ TEST_F(groupby_argmin_struct_test, basic) auto const expect_indices = cudf::test::fixed_width_column_wrapper{3, 5, 7}; auto agg = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); } TEST_F(groupby_argmin_struct_test, slice_input) @@ -225,7 +219,7 @@ TEST_F(groupby_argmin_struct_test, slice_input) auto const expect_indices = cudf::test::fixed_width_column_wrapper{3, 5, 7}; auto agg = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); } TEST_F(groupby_argmin_struct_test, null_keys_and_values) @@ -247,5 +241,5 @@ TEST_F(groupby_argmin_struct_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper{{3, 1, 8, null}, null_at(3)}; auto agg = cudf::make_argmin_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg)); } diff --git a/cpp/tests/groupby/collect_list_tests.cpp b/cpp/tests/groupby/collect_list_tests.cpp index 1e542b7070e..b416b22b6a8 100644 --- a/cpp/tests/groupby/collect_list_tests.cpp +++ b/cpp/tests/groupby/collect_list_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -29,7 +29,7 @@ TYPED_TEST(groupby_collect_list_test, CollectWithoutNulls) cudf::test::lists_column_wrapper expect_vals{{1, 2, 3}, {4, 5, 6}}; auto agg = cudf::make_collect_list_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectWithNulls) @@ -48,7 +48,7 @@ TYPED_TEST(groupby_collect_list_test, CollectWithNulls) {{1, 2}, validity.begin()}, {{3, 4}, validity.begin()}, {{5, 6}, validity.begin()}}; auto agg = cudf::make_collect_list_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectWithNullExclusion) @@ -67,7 +67,7 @@ TYPED_TEST(groupby_collect_list_test, CollectWithNullExclusion) auto agg = cudf::make_collect_list_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInput) @@ -83,7 +83,7 @@ TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInput) auto agg = cudf::make_collect_list_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectLists) @@ -103,7 +103,7 @@ TYPED_TEST(groupby_collect_list_test, CollectLists) {{1, 2}, {3, 4}}, {{5, 6, 7}, LCW{}}, {{9, 10}, {11}}}; auto agg = cudf::make_collect_list_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectListsWithNullExclusion) @@ -124,7 +124,7 @@ TYPED_TEST(groupby_collect_list_test, CollectListsWithNullExclusion) auto agg = cudf::make_collect_list_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputLists) @@ -148,7 +148,7 @@ TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputLists) cudf::make_lists_column(0, cudf::make_empty_column(offsets), std::move(expect_child), 0, {}); auto agg = cudf::make_collect_list_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, values->view(), expect_keys, expect_values->view(), std::move(agg)); + test_single_agg(keys, values->view(), expect_keys, expect_values->view(), std::move(agg)); } TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputListsOfStructs) @@ -188,7 +188,7 @@ TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputListsOfStructs) {}); auto agg = cudf::make_collect_list_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, values->view(), expect_keys, expect_values->view(), std::move(agg)); + test_single_agg(keys, values->view(), expect_keys, expect_values->view(), std::move(agg)); } TYPED_TEST(groupby_collect_list_test, dictionary) @@ -209,9 +209,9 @@ TYPED_TEST(groupby_collect_list_test, dictionary) 0, rmm::device_buffer{}); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_collect_list_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_collect_list_aggregation()); } diff --git a/cpp/tests/groupby/correlation_tests.cpp b/cpp/tests/groupby/correlation_tests.cpp index 7d0690c934f..1a7bbc18f0c 100644 --- a/cpp/tests/groupby/correlation_tests.cpp +++ b/cpp/tests/groupby/correlation_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -43,8 +43,7 @@ TYPED_TEST(groupby_correlation_test, basic) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, empty_cols) @@ -61,8 +60,7 @@ TYPED_TEST(groupby_correlation_test, empty_cols) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, zero_valid_keys) @@ -79,8 +77,7 @@ TYPED_TEST(groupby_correlation_test, zero_valid_keys) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, zero_valid_values) @@ -98,8 +95,7 @@ TYPED_TEST(groupby_correlation_test, zero_valid_values) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, null_keys_and_values) @@ -123,8 +119,7 @@ TYPED_TEST(groupby_correlation_test, null_keys_and_values) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, null_values_same) @@ -149,8 +144,7 @@ TYPED_TEST(groupby_correlation_test, null_values_same) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } // keys=[1, 1, 1, 2, 2, 2, 2, 3, N, 3, 4] @@ -179,8 +173,7 @@ TYPED_TEST(groupby_correlation_test, null_values_different) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_correlation_test, min_periods) @@ -200,20 +193,17 @@ TYPED_TEST(groupby_correlation_test, min_periods) cudf::test::fixed_width_column_wrapper expect_vals1{{1.0, 0.6, nan}}; auto agg1 = cudf::make_correlation_aggregation( cudf::correlation_type::PEARSON, 3); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals2{{1.0, 0.6, nan}, {0, 1, 0}}; auto agg2 = cudf::make_correlation_aggregation( cudf::correlation_type::PEARSON, 4); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals3{{1.0, 0.6, nan}, {0, 0, 0}}; auto agg3 = cudf::make_correlation_aggregation( cudf::correlation_type::PEARSON, 5); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals3, std::move(agg3), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals3, std::move(agg3), force_use_sort_impl::YES); } struct groupby_dictionary_correlation_test : public cudf::test::BaseFixture {}; @@ -235,6 +225,5 @@ TEST_F(groupby_dictionary_correlation_test, basic) auto agg = cudf::make_correlation_aggregation(cudf::correlation_type::PEARSON); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } diff --git a/cpp/tests/groupby/count_scan_tests.cpp b/cpp/tests/groupby/count_scan_tests.cpp index 466e242828b..f5b10d6606d 100644 --- a/cpp/tests/groupby/count_scan_tests.cpp +++ b/cpp/tests/groupby/count_scan_tests.cpp @@ -39,11 +39,11 @@ TYPED_TEST(groupby_count_scan_test, basic) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_scan_test, empty_cols) @@ -58,11 +58,11 @@ TYPED_TEST(groupby_count_scan_test, empty_cols) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_scan_test, zero_valid_keys) @@ -77,11 +77,11 @@ TYPED_TEST(groupby_count_scan_test, zero_valid_keys) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_scan_test, zero_valid_values) @@ -96,12 +96,12 @@ TYPED_TEST(groupby_count_scan_test, zero_valid_values) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); expect_vals = result_wrapper{1, 2, 3}; auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_scan_test, null_keys_and_values) @@ -121,12 +121,12 @@ TYPED_TEST(groupby_count_scan_test, null_keys_and_values) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); expect_vals = result_wrapper{1, 2, 3, 1, 2, 3, 4, 1, 2, 1}; auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); } struct groupby_count_scan_string_test : public cudf::test::BaseFixture {}; @@ -146,11 +146,11 @@ TEST_F(groupby_count_scan_string_test, basic) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); } template @@ -177,11 +177,11 @@ TYPED_TEST(GroupByCountScanFixedPointTest, GroupByCountScan) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); } struct groupby_dictionary_count_scan_test : public cudf::test::BaseFixture {}; @@ -200,8 +200,8 @@ TEST_F(groupby_dictionary_count_scan_test, basic) auto agg1 = cudf::make_count_aggregation(cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg1)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg1)); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg2)); } diff --git a/cpp/tests/groupby/count_tests.cpp b/cpp/tests/groupby/count_tests.cpp index 9695762dbe5..ffcd3773959 100644 --- a/cpp/tests/groupby/count_tests.cpp +++ b/cpp/tests/groupby/count_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -30,14 +30,13 @@ TYPED_TEST(groupby_count_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{3, 4, 3}; auto agg = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_test, empty_cols) @@ -52,11 +51,10 @@ TYPED_TEST(groupby_count_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals; auto agg = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); } TYPED_TEST(groupby_count_test, zero_valid_keys) @@ -71,14 +69,13 @@ TYPED_TEST(groupby_count_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2)); } TYPED_TEST(groupby_count_test, zero_valid_values) @@ -93,15 +90,14 @@ TYPED_TEST(groupby_count_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals{0}; auto agg = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals2{3}; auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg2)); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2)); } TYPED_TEST(groupby_count_test, null_keys_and_values) @@ -123,15 +119,14 @@ TYPED_TEST(groupby_count_test, null_keys_and_values) // clang-format on auto agg = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals2{3, 4, 2, 1}; auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg2)); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2)); } struct groupby_count_string_test : public cudf::test::BaseFixture {}; @@ -150,11 +145,10 @@ TEST_F(groupby_count_string_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{1, 1, 2, 2}; auto agg = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); } // clang-format on @@ -181,14 +175,13 @@ TYPED_TEST(GroupByCountFixedPointTest, GroupByCount) auto const expect_vals = cudf::test::fixed_width_column_wrapper{3, 4, 3}; auto agg = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg1 = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg1), force_use_sort_impl::YES); auto agg2 = cudf::make_count_aggregation(cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg2)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2)); } struct groupby_dictionary_count_test : public cudf::test::BaseFixture {}; @@ -205,15 +198,15 @@ TEST_F(groupby_dictionary_count_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{1, 1, 2, 2}; // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_count_aggregation()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_count_aggregation(), - force_use_sort_impl::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_count_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_count_aggregation(), + force_use_sort_impl::YES); } diff --git a/cpp/tests/groupby/covariance_tests.cpp b/cpp/tests/groupby/covariance_tests.cpp index 9708baac770..b188f00479e 100644 --- a/cpp/tests/groupby/covariance_tests.cpp +++ b/cpp/tests/groupby/covariance_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -39,9 +39,8 @@ TYPED_TEST(groupby_covariance_test, invalid_types) auto vals = cudf::test::structs_column_wrapper{{member_0, member_1}}; auto agg = cudf::make_covariance_aggregation(); - EXPECT_THROW( - CUDF_TEST_SINGLE_AGG(keys, vals, keys, vals, std::move(agg), force_use_sort_impl::YES), - cudf::logic_error); + EXPECT_THROW(test_single_agg(keys, vals, keys, vals, std::move(agg), force_use_sort_impl::YES), + cudf::logic_error); } TYPED_TEST(groupby_covariance_test, basic) @@ -58,8 +57,7 @@ TYPED_TEST(groupby_covariance_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{{1.0, 1.0, 0.0}}; auto agg = cudf::make_covariance_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, empty_cols) @@ -75,8 +73,7 @@ TYPED_TEST(groupby_covariance_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_covariance_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, zero_valid_keys) @@ -92,8 +89,7 @@ TYPED_TEST(groupby_covariance_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_covariance_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, zero_valid_values) @@ -110,8 +106,7 @@ TYPED_TEST(groupby_covariance_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_covariance_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, null_keys_and_values) @@ -132,8 +127,7 @@ TYPED_TEST(groupby_covariance_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({0.5, 1.0, 0.0, -0.}, {1, 1, 1, 0}); auto agg = cudf::make_covariance_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, null_values_same) @@ -155,8 +149,7 @@ TYPED_TEST(groupby_covariance_test, null_values_same) cudf::test::fixed_width_column_wrapper expect_vals({0.5, 1.0, 0.0, -0.}, {1, 1, 1, 0}); auto agg = cudf::make_covariance_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, null_values_different) @@ -179,8 +172,7 @@ TYPED_TEST(groupby_covariance_test, null_values_different) {std::numeric_limits::quiet_NaN(), 1.5, 0.0, -0.}, {0, 1, 1, 0}); auto agg = cudf::make_covariance_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, min_periods) @@ -197,18 +189,15 @@ TYPED_TEST(groupby_covariance_test, min_periods) cudf::test::fixed_width_column_wrapper expect_vals1{{1.0, 1.0, 0.0}}; auto agg1 = cudf::make_covariance_aggregation(3); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals2{{1.0, 1.0, 0.0}, {0, 1, 0}}; auto agg2 = cudf::make_covariance_aggregation(4); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); cudf::test::fixed_width_column_wrapper expect_vals3{{1.0, 1.0, 0.0}, {0, 0, 0}}; auto agg3 = cudf::make_covariance_aggregation(5); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals3, std::move(agg3), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals3, std::move(agg3), force_use_sort_impl::YES); } TYPED_TEST(groupby_covariance_test, ddof) @@ -225,14 +214,12 @@ TYPED_TEST(groupby_covariance_test, ddof) cudf::test::fixed_width_column_wrapper expect_vals1{{2.0, 1.5, 0.0}}; auto agg1 = cudf::make_covariance_aggregation(1, 2); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg1), force_use_sort_impl::YES); auto const inf = std::numeric_limits::infinity(); cudf::test::fixed_width_column_wrapper expect_vals2{{inf, 3.0, 0.0}, {0, 1, 0}}; auto agg2 = cudf::make_covariance_aggregation(1, 3); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2), force_use_sort_impl::YES); } struct groupby_dictionary_covariance_test : public cudf::test::BaseFixture {}; @@ -251,6 +238,5 @@ TEST_F(groupby_dictionary_covariance_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{{1.0, -0.5, 0.0}}; auto agg = cudf::make_covariance_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), force_use_sort_impl::YES); } diff --git a/cpp/tests/groupby/keys_tests.cpp b/cpp/tests/groupby/keys_tests.cpp index ec2243b1c45..196945d22d5 100644 --- a/cpp/tests/groupby/keys_tests.cpp +++ b/cpp/tests/groupby/keys_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,7 @@ TYPED_TEST(groupby_keys_test, basic) // clang-format on auto agg = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_keys_test, zero_valid_keys) @@ -56,7 +56,7 @@ TYPED_TEST(groupby_keys_test, zero_valid_keys) // clang-format on auto agg = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_keys_test, some_null_keys) @@ -77,7 +77,7 @@ TYPED_TEST(groupby_keys_test, some_null_keys) // clang-format on auto agg = cudf::make_count_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_keys_test, include_null_keys) @@ -99,13 +99,13 @@ TYPED_TEST(groupby_keys_test, include_null_keys) // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::NO, - cudf::null_policy::INCLUDE); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::NO, + cudf::null_policy::INCLUDE); } TYPED_TEST(groupby_keys_test, pre_sorted_keys) @@ -123,14 +123,14 @@ TYPED_TEST(groupby_keys_test, pre_sorted_keys) // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::YES, - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::YES, + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_keys_test, pre_sorted_keys_descending) @@ -148,15 +148,15 @@ TYPED_TEST(groupby_keys_test, pre_sorted_keys_descending) // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::YES, - cudf::null_policy::EXCLUDE, - cudf::sorted::YES, - {cudf::order::DESCENDING}); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::YES, + cudf::null_policy::EXCLUDE, + cudf::sorted::YES, + {cudf::order::DESCENDING}); } TYPED_TEST(groupby_keys_test, pre_sorted_keys_nullable) @@ -175,14 +175,14 @@ TYPED_TEST(groupby_keys_test, pre_sorted_keys_nullable) // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::YES, - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::YES, + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_keys_test, pre_sorted_keys_nulls_before_include_nulls) @@ -203,14 +203,14 @@ TYPED_TEST(groupby_keys_test, pre_sorted_keys_nulls_before_include_nulls) // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::YES, - cudf::null_policy::INCLUDE, - cudf::sorted::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::YES, + cudf::null_policy::INCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_keys_test, mismatch_num_rows) @@ -223,9 +223,9 @@ TYPED_TEST(groupby_keys_test, mismatch_num_rows) // Verify that scan throws an error when given data of mismatched sizes. auto agg = cudf::make_count_aggregation(); - EXPECT_THROW(CUDF_TEST_SINGLE_AGG(keys, vals, keys, vals, std::move(agg)), cudf::logic_error); + EXPECT_THROW(test_single_agg(keys, vals, keys, vals, std::move(agg)), cudf::logic_error); auto agg2 = cudf::make_count_aggregation(); - EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, vals, keys, vals, std::move(agg2)), cudf::logic_error); + EXPECT_THROW(test_single_scan(keys, vals, keys, vals, std::move(agg2)), cudf::logic_error); } template @@ -280,7 +280,7 @@ TYPED_TEST(groupby_keys_test, structs) auto expect_vals = FWCW{6, 1, 8, 7}; auto agg = cudf::make_argmax_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } template @@ -299,7 +299,7 @@ TYPED_TEST(groupby_keys_test, lists) // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, values, expected_keys, expected_values, std::move(agg)); + test_single_agg(keys, values, expected_keys, expected_values, std::move(agg)); } struct groupby_string_keys_test : public cudf::test::BaseFixture {}; @@ -318,7 +318,7 @@ TEST_F(groupby_string_keys_test, basic) // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } // clang-format on @@ -337,14 +337,14 @@ TEST_F(groupby_dictionary_keys_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({ 9, 19, 17 }); // clang-format on - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals, cudf::make_sum_aggregation()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_sum_aggregation(), - force_use_sort_impl::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_sum_aggregation(), + force_use_sort_impl::YES); } struct groupby_cache_test : public cudf::test::BaseFixture {}; diff --git a/cpp/tests/groupby/lists_tests.cpp b/cpp/tests/groupby/lists_tests.cpp index abb831b4fc2..355be13fff1 100644 --- a/cpp/tests/groupby/lists_tests.cpp +++ b/cpp/tests/groupby/lists_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -49,7 +49,7 @@ TYPED_TEST(groupby_lists_test, basic) auto expected_values = fwcw{ 3, 5, 2 }; // clang-format on - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_lists_test, all_null_input) @@ -62,7 +62,7 @@ TYPED_TEST(groupby_lists_test, all_null_input) auto expected_values = fwcw{ 10 }; // clang-format on - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_lists_test, lists_with_nulls) @@ -75,7 +75,7 @@ TYPED_TEST(groupby_lists_test, lists_with_nulls) auto expected_values = fwcw{ 7, 3 }; // clang-format on - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_lists_test, lists_with_null_elements) @@ -92,5 +92,5 @@ TYPED_TEST(groupby_lists_test, lists_with_null_elements) {{}, lcw{{{1, 2, 3}, {}, {4, 5}, {}, {6, 0}}, nulls_at({1, 3})}}, null_at(0)}; auto expected_values = fwcw{9, 3}; - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } diff --git a/cpp/tests/groupby/max_scan_tests.cpp b/cpp/tests/groupby/max_scan_tests.cpp index 64b351f3e22..f7e10db7959 100644 --- a/cpp/tests/groupby/max_scan_tests.cpp +++ b/cpp/tests/groupby/max_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -41,7 +41,7 @@ TYPED_TEST(groupby_max_scan_test, basic) // clang-format on auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_max_scan_test, pre_sorted) @@ -58,13 +58,13 @@ TYPED_TEST(groupby_max_scan_test, pre_sorted) // clang-format on auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + test_single_scan(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_max_scan_test, empty_cols) @@ -78,7 +78,7 @@ TYPED_TEST(groupby_max_scan_test, empty_cols) result_wrapper expect_vals{}; auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_max_scan_test, zero_valid_keys) @@ -92,7 +92,7 @@ TYPED_TEST(groupby_max_scan_test, zero_valid_keys) result_wrapper expect_vals{}; auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_max_scan_test, zero_valid_values) @@ -106,7 +106,7 @@ TYPED_TEST(groupby_max_scan_test, zero_valid_values) result_wrapper expect_vals({-1, -1, -1}, all_nulls()); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_max_scan_test, null_keys_and_values) @@ -126,7 +126,7 @@ TYPED_TEST(groupby_max_scan_test, null_keys_and_values) // clang-format on auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } struct groupby_max_scan_string_test : public cudf::test::BaseFixture {}; @@ -142,7 +142,7 @@ TEST_F(groupby_max_scan_string_test, basic) {"año", "año", "año", "bit", "zit", "zit", "zit", "₹1", "₹1", "₹1"}); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } template @@ -169,7 +169,7 @@ TYPED_TEST(GroupByMaxScanFixedPointTest, GroupBySortMaxScanDecimalAsValue) // clang-format on auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals_max, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals_max, std::move(agg)); } } @@ -194,7 +194,7 @@ TEST_F(groupby_max_scan_struct_test, basic) }(); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_max_scan_struct_test, slice_input) @@ -231,7 +231,7 @@ TEST_F(groupby_max_scan_struct_test, slice_input) }(); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_max_scan_struct_test, null_keys_and_values) @@ -256,5 +256,5 @@ TEST_F(groupby_max_scan_struct_test, null_keys_and_values) }(); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } diff --git a/cpp/tests/groupby/max_tests.cpp b/cpp/tests/groupby/max_tests.cpp index 12722e7303d..62ead70a2de 100644 --- a/cpp/tests/groupby/max_tests.cpp +++ b/cpp/tests/groupby/max_tests.cpp @@ -38,11 +38,10 @@ TYPED_TEST(groupby_max_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({6, 9, 8}); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_max_test, empty_cols) @@ -57,11 +56,10 @@ TYPED_TEST(groupby_max_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_max_test, zero_valid_keys) @@ -76,11 +74,10 @@ TYPED_TEST(groupby_max_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_max_test, zero_valid_values) @@ -95,11 +92,10 @@ TYPED_TEST(groupby_max_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_max_test, null_keys_and_values) @@ -119,11 +115,10 @@ TYPED_TEST(groupby_max_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({3, 5, 8, 0}, {1, 1, 1, 0}); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_max_string_test : public cudf::test::BaseFixture {}; @@ -138,11 +133,10 @@ TEST_F(groupby_max_string_test, basic) cudf::test::strings_column_wrapper expect_vals({"año", "zit", "₹1"}); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_max_string_test, zero_valid_values) @@ -154,11 +148,10 @@ TEST_F(groupby_max_string_test, zero_valid_values) cudf::test::strings_column_wrapper expect_vals({""}, all_nulls()); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_max_string_test, max_sorted_strings) @@ -191,14 +184,14 @@ TEST_F(groupby_max_string_test, max_sorted_strings) // {6, 10, 14, 18, 22, 26, 30, 34, 38, 42, -1}, // {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::NO, - cudf::null_policy::INCLUDE, - cudf::sorted::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::NO, + cudf::null_policy::INCLUDE, + cudf::sorted::YES); } struct groupby_dictionary_max_test : public cudf::test::BaseFixture {}; @@ -216,17 +209,17 @@ TEST_F(groupby_dictionary_max_test, basic) auto expect_vals = cudf::dictionary::set_keys(expect_vals_w, vals.keys()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_max_aggregation()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_max_aggregation(), - force_use_sort_impl::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_max_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_max_aggregation(), + force_use_sort_impl::YES); } TEST_F(groupby_dictionary_max_test, fixed_width) @@ -240,17 +233,17 @@ TEST_F(groupby_dictionary_max_test, fixed_width) cudf::test::fixed_width_column_wrapper expect_vals_w({ 0xABC, 0xFFF, 0xF1 }); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals_w, - cudf::make_max_aggregation()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals_w, - cudf::make_max_aggregation(), - force_use_sort_impl::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals_w, + cudf::make_max_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals_w, + cudf::make_max_aggregation(), + force_use_sort_impl::YES); } template @@ -277,7 +270,7 @@ TYPED_TEST(GroupByMaxFixedPointTest, GroupBySortMaxDecimalAsValue) auto const expect_vals_max = fp_wrapper{{6, 9, 8}, scale}; auto agg3 = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals_max, std::move(agg3), force_use_sort_impl::YES); } } @@ -301,7 +294,7 @@ TYPED_TEST(GroupByMaxFixedPointTest, GroupByHashMaxDecimalAsValue) auto const expect_vals_max = fp_wrapper{{6, 9, 8}, scale}; auto agg7 = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals_max, std::move(agg7)); + test_single_agg(keys, vals, expect_keys, expect_vals_max, std::move(agg7)); } } @@ -325,7 +318,7 @@ TEST_F(groupby_max_struct_test, basic) }(); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_max_struct_test, slice_input) @@ -362,7 +355,7 @@ TEST_F(groupby_max_struct_test, slice_input) }(); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_max_struct_test, null_keys_and_values) @@ -387,7 +380,7 @@ TEST_F(groupby_max_struct_test, null_keys_and_values) }(); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_max_struct_test, values_with_null_child) @@ -409,7 +402,7 @@ TEST_F(groupby_max_struct_test, values_with_null_child) }(); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } { @@ -428,7 +421,7 @@ TEST_F(groupby_max_struct_test, values_with_null_child) }(); auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } } @@ -443,7 +436,7 @@ TEST_F(groupby_max_list_test, basic) auto const expect_keys = cudf::test::fixed_width_column_wrapper{1, 2, 3}; auto const expect_vals = lists{{1, 2}, {9, 10}, {5, 6, 7}}; - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals, cudf::make_max_aggregation()); } @@ -462,7 +455,7 @@ TEST_F(groupby_max_list_test, slice_input) auto const expect_keys = cudf::test::fixed_width_column_wrapper{1, 2, 3}; auto const expect_vals = lists{{1, 2}, {9, 10}, {5, 6, 7}}; - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals, cudf::make_max_aggregation()); } @@ -479,11 +472,11 @@ TEST_F(groupby_max_list_test, null_keys_and_values) { auto const vals = lists{{{} /*null*/, {1, 2}, {3, 4}, {5, 6, 7}, {0, 8}, {9, 10}}, null_at(0)}; auto const expect_vals = lists{{0, 8}, {9, 10}, {3, 4}}; - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_max_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_max_aggregation()); } // Null child element. @@ -495,11 +488,11 @@ TEST_F(groupby_max_list_test, null_keys_and_values) lists{0, 8}, lists{9, 10}}; auto const expect_vals = lists{{0, 8}, {9, 10}, {3, 4}}; - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_max_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_max_aggregation()); } } @@ -525,7 +518,7 @@ TYPED_TEST(groupby_max_floating_point_test, values_with_infinity) // Related issue: https://github.com/rapidsai/cudf/issues/11352 // The issue only occurs in sort-based cudf::aggregation. auto agg = cudf::make_max_aggregation(); - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expected_keys, expected_vals, std::move(agg), force_use_sort_impl::YES); } @@ -569,7 +562,7 @@ TEST_F(groupby_max_hash_based_gmem_fallback_kernel_test, all_block_fallback) auto agg = cudf::make_max_aggregation(); // Keys are the same as values. - CUDF_TEST_SINGLE_AGG(keys, keys, expect_keys, expect_keys, std::move(agg)); + test_single_agg(keys, keys, expect_keys, expect_keys, std::move(agg)); } TEST_F(groupby_max_hash_based_gmem_fallback_kernel_test, partial_fallback) @@ -597,5 +590,5 @@ TEST_F(groupby_max_hash_based_gmem_fallback_kernel_test, partial_fallback) auto agg = cudf::make_max_aggregation(); // Keys are the same as values. - CUDF_TEST_SINGLE_AGG(keys, keys, expect_keys, expect_keys, std::move(agg)); + test_single_agg(keys, keys, expect_keys, expect_keys, std::move(agg)); } diff --git a/cpp/tests/groupby/mean_tests.cpp b/cpp/tests/groupby/mean_tests.cpp index 678e4321f68..ec2049e9c6f 100644 --- a/cpp/tests/groupby/mean_tests.cpp +++ b/cpp/tests/groupby/mean_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -51,7 +51,7 @@ TYPED_TEST(groupby_mean_test, basic) // clang-format on auto agg = cudf::make_mean_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_mean_test, empty_cols) @@ -66,7 +66,7 @@ TYPED_TEST(groupby_mean_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_mean_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_mean_test, zero_valid_keys) @@ -81,7 +81,7 @@ TYPED_TEST(groupby_mean_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_mean_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_mean_test, zero_valid_values) @@ -96,7 +96,7 @@ TYPED_TEST(groupby_mean_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_mean_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_mean_test, null_keys_and_values) @@ -121,7 +121,7 @@ TYPED_TEST(groupby_mean_test, null_keys_and_values) expect_v.cbegin(), expect_v.cend(), {1, 1, 1, 0}); auto agg = cudf::make_mean_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } // clang-format on @@ -140,7 +140,7 @@ TEST_F(groupby_dictionary_mean_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({9. / 3, 19. / 4, 17. / 3}); // clang-format on - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals, cudf::make_mean_aggregation()); } @@ -167,7 +167,7 @@ TYPED_TEST(FixedPointTestBothReps, GroupBySortMeanDecimalAsValue) auto const expect_vals_min = fp_wrapper{{3, 4, 5}, scale}; auto agg = cudf::make_mean_aggregation(); - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals_min, std::move(agg), force_use_sort_impl::YES); } } @@ -191,6 +191,6 @@ TYPED_TEST(FixedPointTestBothReps, GroupByHashMeanDecimalAsValue) auto const expect_vals_min = fp_wrapper{{3, 4, 5}, scale}; auto agg = cudf::make_mean_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals_min, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals_min, std::move(agg)); } } diff --git a/cpp/tests/groupby/median_tests.cpp b/cpp/tests/groupby/median_tests.cpp index 1ab915284db..faa46874c42 100644 --- a/cpp/tests/groupby/median_tests.cpp +++ b/cpp/tests/groupby/median_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,7 @@ TYPED_TEST(groupby_median_test, basic) // clang-format on auto agg = cudf::make_median_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_median_test, empty_cols) @@ -54,7 +54,7 @@ TYPED_TEST(groupby_median_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_median_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_median_test, zero_valid_keys) @@ -70,7 +70,7 @@ TYPED_TEST(groupby_median_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_median_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_median_test, zero_valid_values) @@ -86,7 +86,7 @@ TYPED_TEST(groupby_median_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_median_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_median_test, null_keys_and_values) @@ -107,7 +107,7 @@ TYPED_TEST(groupby_median_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({4.5, 4., 5., 0.}, {1, 1, 1, 0}); auto agg = cudf::make_median_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_median_test, dictionary) @@ -126,9 +126,9 @@ TYPED_TEST(groupby_median_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({3., 4.5, 7. }, no_nulls()); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_median_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_median_aggregation()); } diff --git a/cpp/tests/groupby/min_scan_tests.cpp b/cpp/tests/groupby/min_scan_tests.cpp index 721597cd82b..6623f561a2b 100644 --- a/cpp/tests/groupby/min_scan_tests.cpp +++ b/cpp/tests/groupby/min_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,7 @@ TYPED_TEST(groupby_min_scan_test, basic) // clang-format on auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_min_scan_test, pre_sorted) @@ -55,13 +55,13 @@ TYPED_TEST(groupby_min_scan_test, pre_sorted) // clang-format on auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + test_single_scan(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_min_scan_test, empty_cols) @@ -75,7 +75,7 @@ TYPED_TEST(groupby_min_scan_test, empty_cols) result_wrapper expect_vals{}; auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_min_scan_test, zero_valid_keys) @@ -89,7 +89,7 @@ TYPED_TEST(groupby_min_scan_test, zero_valid_keys) result_wrapper expect_vals{}; auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_min_scan_test, zero_valid_values) @@ -103,7 +103,7 @@ TYPED_TEST(groupby_min_scan_test, zero_valid_values) result_wrapper expect_vals({-1, -1, -1}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_min_scan_test, null_keys_and_values) @@ -123,7 +123,7 @@ TYPED_TEST(groupby_min_scan_test, null_keys_and_values) // clang-format on auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } struct groupby_min_scan_string_test : public cudf::test::BaseFixture {}; @@ -139,7 +139,7 @@ TEST_F(groupby_min_scan_string_test, basic) {"año", "aaa", "aaa", "bit", "bit", "bat", "bat", "₹1", "$1", "$1"}); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } template @@ -167,7 +167,7 @@ TYPED_TEST(GroupByMinScanFixedPointTest, GroupBySortMinScanDecimalAsValue) // clang-format on auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals_min, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals_min, std::move(agg)); } } @@ -192,7 +192,7 @@ TEST_F(groupby_min_scan_struct_test, basic) }(); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_min_scan_struct_test, slice_input) @@ -229,7 +229,7 @@ TEST_F(groupby_min_scan_struct_test, slice_input) }(); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_min_scan_struct_test, null_keys_and_values) @@ -258,5 +258,5 @@ TEST_F(groupby_min_scan_struct_test, null_keys_and_values) }(); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } diff --git a/cpp/tests/groupby/min_tests.cpp b/cpp/tests/groupby/min_tests.cpp index 5c539c89d5b..ea444fabc38 100644 --- a/cpp/tests/groupby/min_tests.cpp +++ b/cpp/tests/groupby/min_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -35,11 +35,10 @@ TYPED_TEST(groupby_min_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({0, 1, 2}); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_min_test, empty_cols) @@ -54,11 +53,10 @@ TYPED_TEST(groupby_min_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_min_test, zero_valid_keys) @@ -73,11 +71,10 @@ TYPED_TEST(groupby_min_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_min_test, zero_valid_values) @@ -92,11 +89,10 @@ TYPED_TEST(groupby_min_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_min_test, null_keys_and_values) @@ -116,11 +112,10 @@ TYPED_TEST(groupby_min_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({3, 1, 2, 0}, {1, 1, 1, 0}); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } struct groupby_min_string_test : public cudf::test::BaseFixture {}; @@ -135,11 +130,10 @@ TEST_F(groupby_min_string_test, basic) cudf::test::strings_column_wrapper expect_vals({"aaa", "bat", "$1"}); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_min_string_test, zero_valid_values) @@ -151,11 +145,10 @@ TEST_F(groupby_min_string_test, zero_valid_values) cudf::test::strings_column_wrapper expect_vals({""}, all_nulls()); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TEST_F(groupby_min_string_test, min_sorted_strings) @@ -185,14 +178,14 @@ TEST_F(groupby_min_string_test, min_sorted_strings) {true, true, true, true, true, true, true, true, true, true, false}); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::NO, - cudf::null_policy::INCLUDE, - cudf::sorted::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::NO, + cudf::null_policy::INCLUDE, + cudf::sorted::YES); } struct groupby_dictionary_min_test : public cudf::test::BaseFixture {}; @@ -210,17 +203,17 @@ TEST_F(groupby_dictionary_min_test, basic) auto expect_vals = cudf::dictionary::set_keys(expect_vals_w, vals.keys()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_min_aggregation()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_min_aggregation(), - force_use_sort_impl::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_min_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_min_aggregation(), + force_use_sort_impl::YES); } TEST_F(groupby_dictionary_min_test, fixed_width) @@ -234,17 +227,17 @@ TEST_F(groupby_dictionary_min_test, fixed_width) cudf::test::fixed_width_column_wrapper expect_vals_w({ 0xAAA, 0xBAA, 0x01 }); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals_w, - cudf::make_min_aggregation()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals_w, - cudf::make_min_aggregation(), - force_use_sort_impl::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals_w, + cudf::make_min_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals_w, + cudf::make_min_aggregation(), + force_use_sort_impl::YES); } template @@ -270,7 +263,7 @@ TYPED_TEST(GroupByMinFixedPointTest, GroupBySortMinDecimalAsValue) auto const expect_vals_min = fp_wrapper{{0, 1, 2}, scale}; auto agg2 = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals_min, std::move(agg2), force_use_sort_impl::YES); } } @@ -294,7 +287,7 @@ TYPED_TEST(GroupByMinFixedPointTest, GroupByHashMinDecimalAsValue) auto const expect_vals_min = fp_wrapper{{0, 1, 2}, scale}; auto agg6 = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals_min, std::move(agg6)); + test_single_agg(keys, vals, expect_keys, expect_vals_min, std::move(agg6)); } } @@ -318,7 +311,7 @@ TEST_F(groupby_min_struct_test, basic) }(); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_min_struct_test, slice_input) @@ -355,7 +348,7 @@ TEST_F(groupby_min_struct_test, slice_input) }(); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_min_struct_test, null_keys_and_values) @@ -380,7 +373,7 @@ TEST_F(groupby_min_struct_test, null_keys_and_values) }(); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TEST_F(groupby_min_struct_test, values_with_null_child) @@ -402,7 +395,7 @@ TEST_F(groupby_min_struct_test, values_with_null_child) }(); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } { @@ -421,7 +414,7 @@ TEST_F(groupby_min_struct_test, values_with_null_child) }(); auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } } @@ -436,7 +429,7 @@ TEST_F(groupby_min_list_test, basic) auto const expect_keys = cudf::test::fixed_width_column_wrapper{1, 2, 3}; auto const expect_vals = lists{{0, 8}, {3, 4}, {5, 6, 7}}; - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals, cudf::make_min_aggregation()); } @@ -455,7 +448,7 @@ TEST_F(groupby_min_list_test, slice_input) auto const expect_keys = cudf::test::fixed_width_column_wrapper{1, 2, 3}; auto const expect_vals = lists{{0, 8}, {3, 4}, {5, 6, 7}}; - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals, cudf::make_min_aggregation()); } @@ -472,11 +465,11 @@ TEST_F(groupby_min_list_test, null_keys_and_values) { auto const vals = lists{{{} /*null*/, {1, 2}, {3, 4}, {5, 6, 7}, {0, 8}, {9, 10}}, null_at(0)}; auto const expect_vals = lists{{0, 8}, {1, 2}, {3, 4}}; - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_min_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_min_aggregation()); } // Null child element. @@ -488,11 +481,11 @@ TEST_F(groupby_min_list_test, null_keys_and_values) lists{0, 8}, lists{9, 10}}; auto const expect_vals = lists{lists{{0, null}, null_at(1)}, {1, 2}, {3, 4}}; - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_min_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_min_aggregation()); } } @@ -518,7 +511,7 @@ TYPED_TEST(groupby_min_floating_point_test, values_with_infinity) // Related issue: https://github.com/rapidsai/cudf/issues/11352 // The issue only occurs in sort-based aggregation. auto agg = cudf::make_min_aggregation(); - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expected_keys, expected_vals, std::move(agg), force_use_sort_impl::YES); } diff --git a/cpp/tests/groupby/nth_element_tests.cpp b/cpp/tests/groupby/nth_element_tests.cpp index b760f653676..e55ce32ebcb 100644 --- a/cpp/tests/groupby/nth_element_tests.cpp +++ b/cpp/tests/groupby/nth_element_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -37,15 +37,15 @@ TYPED_TEST(groupby_nth_element_test, basic) //groupby.first() auto agg = cudf::make_nth_element_aggregation(0); cudf::test::fixed_width_column_wrapper expect_vals0({0, 1, 2}); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals0, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals0, std::move(agg)); agg = cudf::make_nth_element_aggregation(1); cudf::test::fixed_width_column_wrapper expect_vals1({3, 4, 7}); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg)); agg = cudf::make_nth_element_aggregation(2); cudf::test::fixed_width_column_wrapper expect_vals2({6, 5, 8}); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, empty_cols) @@ -61,7 +61,7 @@ TYPED_TEST(groupby_nth_element_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_nth_element_aggregation(0); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, basic_out_of_bounds) @@ -77,7 +77,7 @@ TYPED_TEST(groupby_nth_element_test, basic_out_of_bounds) auto agg = cudf::make_nth_element_aggregation(3); cudf::test::fixed_width_column_wrapper expect_vals({0, 9, 0}, {0, 1, 0}); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, negative) @@ -96,15 +96,15 @@ TYPED_TEST(groupby_nth_element_test, negative) //groupby.last() auto agg = cudf::make_nth_element_aggregation(-1); cudf::test::fixed_width_column_wrapper expect_vals0({6, 9, 8}); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals0, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals0, std::move(agg)); agg = cudf::make_nth_element_aggregation(-2); cudf::test::fixed_width_column_wrapper expect_vals1({3, 5, 7}); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg)); agg = cudf::make_nth_element_aggregation(-3); cudf::test::fixed_width_column_wrapper expect_vals2({0, 4, 2}); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, negative_out_of_bounds) @@ -120,7 +120,7 @@ TYPED_TEST(groupby_nth_element_test, negative_out_of_bounds) auto agg = cudf::make_nth_element_aggregation(-4); cudf::test::fixed_width_column_wrapper expect_vals({0, 1, 0}, {0, 1, 0}); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, zero_valid_keys) @@ -136,7 +136,7 @@ TYPED_TEST(groupby_nth_element_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_nth_element_aggregation(0); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, zero_valid_values) @@ -152,7 +152,7 @@ TYPED_TEST(groupby_nth_element_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({3}, all_nulls()); auto agg = cudf::make_nth_element_aggregation(0); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, null_keys_and_values) @@ -172,7 +172,7 @@ TYPED_TEST(groupby_nth_element_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({-1, 1, 2, -1}, {0, 1, 1, 0}); auto agg = cudf::make_nth_element_aggregation(0); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, null_keys_and_values_out_of_bounds) @@ -192,7 +192,7 @@ TYPED_TEST(groupby_nth_element_test, null_keys_and_values_out_of_bounds) cudf::test::fixed_width_column_wrapper expect_vals({6, -1, -1, -1}, {1, 0, 0, 0}); auto agg = cudf::make_nth_element_aggregation(2); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, exclude_nulls) @@ -223,18 +223,18 @@ TYPED_TEST(groupby_nth_element_test, exclude_nulls) cudf::test::fixed_width_column_wrapper expect_vals2({-1, 9, 8, -1}, {0, 1, 1, 0}); auto agg = cudf::make_nth_element_aggregation(0, cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls0, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_nuls0, std::move(agg)); agg = cudf::make_nth_element_aggregation(1, cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls1, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_nuls1, std::move(agg)); agg = cudf::make_nth_element_aggregation(2, cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls2, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_nuls2, std::move(agg)); agg = cudf::make_nth_element_aggregation(0, cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals0, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals0, std::move(agg)); agg = cudf::make_nth_element_aggregation(1, cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg)); agg = cudf::make_nth_element_aggregation(2, cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg)); } TYPED_TEST(groupby_nth_element_test, exclude_nulls_negative_index) @@ -268,18 +268,18 @@ TYPED_TEST(groupby_nth_element_test, exclude_nulls_negative_index) cudf::test::fixed_width_column_wrapper expect_vals2({-1, 1, 2, -1}, {0, 1, 1, 0}); auto agg = cudf::make_nth_element_aggregation(-1, cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls0, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_nuls0, std::move(agg)); agg = cudf::make_nth_element_aggregation(-2, cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls1, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_nuls1, std::move(agg)); agg = cudf::make_nth_element_aggregation(-3, cudf::null_policy::INCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_nuls2, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_nuls2, std::move(agg)); agg = cudf::make_nth_element_aggregation(-1, cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals0, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals0, std::move(agg)); agg = cudf::make_nth_element_aggregation(-2, cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg)); agg = cudf::make_nth_element_aggregation(-3, cudf::null_policy::EXCLUDE); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg)); } struct groupby_nth_element_string_test : public cudf::test::BaseFixture { @@ -297,38 +297,38 @@ TEST_F(groupby_nth_element_string_test, basic_string) //groupby.first() auto agg = cudf::make_nth_element_aggregation(0); cudf::test::strings_column_wrapper expect_vals0{"ABCD", "1", "2"}; - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals0, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals0, std::move(agg)); agg = cudf::make_nth_element_aggregation(1); cudf::test::strings_column_wrapper expect_vals1{"3", "4", "7"}; - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg)); agg = cudf::make_nth_element_aggregation(2); cudf::test::strings_column_wrapper expect_vals2{"6", "5", "8"}; - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg)); //+ve out of bounds agg = cudf::make_nth_element_aggregation(3); cudf::test::strings_column_wrapper expect_vals3{{"", "9", ""}, {false, true, false}}; - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals3, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals3, std::move(agg)); //groupby.last() agg = cudf::make_nth_element_aggregation(-1); cudf::test::strings_column_wrapper expect_vals4{"6", "9", "8"}; - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals4, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals4, std::move(agg)); agg = cudf::make_nth_element_aggregation(-2); cudf::test::strings_column_wrapper expect_vals5{"3", "5", "7"}; - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals5, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals5, std::move(agg)); agg = cudf::make_nth_element_aggregation(-3); cudf::test::strings_column_wrapper expect_vals6{"ABCD", "4", "2"}; - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals6, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals6, std::move(agg)); //-ve out of bounds agg = cudf::make_nth_element_aggregation(-4); cudf::test::strings_column_wrapper expect_vals7{{"", "1", ""}, {false, true, false}}; - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals7, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals7, std::move(agg)); } // clang-format on @@ -344,11 +344,11 @@ TEST_F(groupby_nth_element_string_test, dictionary) auto expect_vals = cudf::dictionary::set_keys(expect_vals_w, vals.keys()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals->view(), - cudf::make_nth_element_aggregation(2)); + test_single_agg(keys, + vals, + expect_keys, + expect_vals->view(), + cudf::make_nth_element_aggregation(2)); } template @@ -369,11 +369,11 @@ TYPED_TEST(groupby_nth_element_lists_test, Basics) auto expected_keys = cudf::test::fixed_width_column_wrapper{1, 2, 3}; auto expected_values = lists{{1, 2}, {5, 6, 7}, {9, 10}}; - CUDF_TEST_SINGLE_AGG(keys, - values, - expected_keys, - expected_values, - cudf::make_nth_element_aggregation(0)); + test_single_agg(keys, + values, + expected_keys, + expected_values, + cudf::make_nth_element_aggregation(0)); } TYPED_TEST(groupby_nth_element_lists_test, EmptyInput) @@ -389,11 +389,11 @@ TYPED_TEST(groupby_nth_element_lists_test, EmptyInput) auto expected_keys = cudf::test::fixed_width_column_wrapper{}; auto expected_values = lists{}; - CUDF_TEST_SINGLE_AGG(keys, - values, - expected_keys, - expected_values, - cudf::make_nth_element_aggregation(2)); + test_single_agg(keys, + values, + expected_keys, + expected_values, + cudf::make_nth_element_aggregation(2)); } struct groupby_nth_element_structs_test : cudf::test::BaseFixture {}; @@ -418,18 +418,18 @@ TEST_F(groupby_nth_element_structs_test, Basics) auto expected_ch2 = strings{"a", "d", "g", ""}; auto expected_values = structs{{expected_ch0, expected_ch1, expected_ch2}, {false, true, true, false}}; - CUDF_TEST_SINGLE_AGG(keys, - values, - expected_keys, - expected_values, - cudf::make_nth_element_aggregation(1)); + test_single_agg(keys, + values, + expected_keys, + expected_values, + cudf::make_nth_element_aggregation(1)); expected_keys = ints{0, 1, 2, 3}; expected_ch0 = ints{0, 4, 6, 9}; expected_ch1 = doubles{0.1, 4.51, 6.3231, 9.999}; expected_ch2 = strings{"", "d", "f", "JJJ"}; expected_values = structs{{expected_ch0, expected_ch1, expected_ch2}, {true, true, true, true}}; - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, values, expected_keys, @@ -461,11 +461,11 @@ TEST_F(groupby_nth_element_structs_test, NestedStructs) auto expected_ch2 = lists{{1, 2, 3}, {5, 6}, {7}, {}}; auto expected_values = structs{{expected_ch0, expected_ch1, expected_ch2}, {false, true, true, false}}; - CUDF_TEST_SINGLE_AGG(keys, - values, - expected_keys, - expected_values, - cudf::make_nth_element_aggregation(1)); + test_single_agg(keys, + values, + expected_keys, + expected_values, + cudf::make_nth_element_aggregation(1)); expected_keys = ints{0, 1, 2, 3}; expected_ch0 = ints{0, 4, 6, 9}; @@ -474,7 +474,7 @@ TEST_F(groupby_nth_element_structs_test, NestedStructs) expected_ch1 = structs{expected_ch0_of_ch1, expected_ch1_of_ch1}; expected_ch2 = lists{{0}, {5, 6}, {}, {}}; expected_values = structs{{expected_ch0, expected_ch1, expected_ch2}, {true, true, true, true}}; - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, values, expected_keys, @@ -500,9 +500,9 @@ TEST_F(groupby_nth_element_structs_test, EmptyInput) auto expected_ch1 = doubles{}; auto expected_ch2 = strings{}; auto expected_values = structs{{expected_ch0, expected_ch1, expected_ch2}}; - CUDF_TEST_SINGLE_AGG(keys, - values, - expected_keys, - expected_values, - cudf::make_nth_element_aggregation(0)); + test_single_agg(keys, + values, + expected_keys, + expected_values, + cudf::make_nth_element_aggregation(0)); } diff --git a/cpp/tests/groupby/nunique_tests.cpp b/cpp/tests/groupby/nunique_tests.cpp index b317d0e6117..fad4c0ef45c 100644 --- a/cpp/tests/groupby/nunique_tests.cpp +++ b/cpp/tests/groupby/nunique_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -35,9 +35,9 @@ TYPED_TEST(groupby_nunique_test, basic) auto agg = cudf::make_nunique_aggregation(); if (std::is_same()) - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); else - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, empty_cols) @@ -53,7 +53,7 @@ TYPED_TEST(groupby_nunique_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_nunique_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, basic_duplicates) @@ -71,9 +71,9 @@ TYPED_TEST(groupby_nunique_test, basic_duplicates) auto agg = cudf::make_nunique_aggregation(); if (std::is_same()) - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); else - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, zero_valid_keys) @@ -89,7 +89,7 @@ TYPED_TEST(groupby_nunique_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_nunique_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, zero_valid_values) @@ -105,7 +105,7 @@ TYPED_TEST(groupby_nunique_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals{0}; auto agg = cudf::make_nunique_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, null_keys_and_values) @@ -129,9 +129,9 @@ TYPED_TEST(groupby_nunique_test, null_keys_and_values) auto agg = cudf::make_nunique_aggregation(); if (std::is_same()) - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); else - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, null_keys_and_values_with_duplicates) @@ -156,9 +156,9 @@ TYPED_TEST(groupby_nunique_test, null_keys_and_values_with_duplicates) auto agg = cudf::make_nunique_aggregation(); if (std::is_same()) - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); else - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, include_nulls) @@ -183,9 +183,9 @@ TYPED_TEST(groupby_nunique_test, include_nulls) auto agg = cudf::make_nunique_aggregation(cudf::null_policy::INCLUDE); if (std::is_same()) - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_bool_vals, std::move(agg)); else - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_nunique_test, dictionary) @@ -211,7 +211,7 @@ TYPED_TEST(groupby_nunique_test, dictionary) cudf::column_view expect_vals = (std::is_same()) ? cudf::column_view{expect_bool_vals} : cudf::column_view{expect_fixed_vals}; - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, diff --git a/cpp/tests/groupby/product_scan_tests.cpp b/cpp/tests/groupby/product_scan_tests.cpp index c5d3c4e8a82..3b4b45bc172 100644 --- a/cpp/tests/groupby/product_scan_tests.cpp +++ b/cpp/tests/groupby/product_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -41,7 +41,7 @@ TYPED_TEST(groupby_product_scan_test, basic) result_wrapper expect_vals{0, 0, 0, 1, 4, 20, 180, 2, 14, 112}; // clang-format on auto agg = cudf::make_product_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_product_scan_test, pre_sorted) @@ -58,13 +58,13 @@ TYPED_TEST(groupby_product_scan_test, pre_sorted) // clang-format on auto agg = cudf::make_product_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + test_single_scan(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_product_scan_test, empty_cols) @@ -79,7 +79,7 @@ TYPED_TEST(groupby_product_scan_test, empty_cols) result_wrapper expect_vals{}; auto agg = cudf::make_product_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_product_scan_test, zero_valid_keys) @@ -93,7 +93,7 @@ TYPED_TEST(groupby_product_scan_test, zero_valid_keys) result_wrapper expect_vals{}; auto agg = cudf::make_product_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_product_scan_test, zero_valid_values) @@ -107,7 +107,7 @@ TYPED_TEST(groupby_product_scan_test, zero_valid_values) result_wrapper expect_vals({3, 4, 5}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_product_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_product_scan_test, null_keys_and_values) @@ -127,5 +127,5 @@ TYPED_TEST(groupby_product_scan_test, null_keys_and_values) // clang-format on auto agg = cudf::make_product_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } diff --git a/cpp/tests/groupby/product_tests.cpp b/cpp/tests/groupby/product_tests.cpp index 88f4b5bb5ef..87b728f18cb 100644 --- a/cpp/tests/groupby/product_tests.cpp +++ b/cpp/tests/groupby/product_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -37,11 +37,11 @@ TYPED_TEST(groupby_product_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({ 0., 180., 112. }, no_nulls()); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, empty_cols) @@ -56,11 +56,11 @@ TYPED_TEST(groupby_product_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_keys{}; cudf::test::fixed_width_column_wrapper expect_vals{}; - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, zero_valid_keys) @@ -75,11 +75,11 @@ TYPED_TEST(groupby_product_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_keys{}; cudf::test::fixed_width_column_wrapper expect_vals{}; - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, zero_valid_values) @@ -94,11 +94,11 @@ TYPED_TEST(groupby_product_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_keys{1}; cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, null_keys_and_values) @@ -120,11 +120,11 @@ TYPED_TEST(groupby_product_test, null_keys_and_values) { 1, 1, 1, 0}); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, dictionary) @@ -143,11 +143,11 @@ TYPED_TEST(groupby_product_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({ 0., 180., 112. }, no_nulls()); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } TYPED_TEST(groupby_product_test, dictionary_with_nulls) @@ -167,9 +167,9 @@ TYPED_TEST(groupby_product_test, dictionary_with_nulls) cudf::test::fixed_width_column_wrapper expect_vals({ 0., 180., 56. }, no_nulls()); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_product_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_product_aggregation()); } diff --git a/cpp/tests/groupby/quantile_tests.cpp b/cpp/tests/groupby/quantile_tests.cpp index 02182b799de..0bb2ca52eb2 100644 --- a/cpp/tests/groupby/quantile_tests.cpp +++ b/cpp/tests/groupby/quantile_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -39,7 +39,7 @@ TYPED_TEST(groupby_quantile_test, basic) auto agg = cudf::make_quantile_aggregation({0.5}, cudf::interpolation::LINEAR); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_quantile_test, empty_cols) @@ -55,7 +55,7 @@ TYPED_TEST(groupby_quantile_test, empty_cols) auto agg = cudf::make_quantile_aggregation({0.5}, cudf::interpolation::LINEAR); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_quantile_test, zero_valid_keys) @@ -71,7 +71,7 @@ TYPED_TEST(groupby_quantile_test, zero_valid_keys) auto agg = cudf::make_quantile_aggregation({0.5}, cudf::interpolation::LINEAR); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_quantile_test, zero_valid_values) @@ -87,7 +87,7 @@ TYPED_TEST(groupby_quantile_test, zero_valid_values) auto agg = cudf::make_quantile_aggregation({0.5}, cudf::interpolation::LINEAR); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_quantile_test, null_keys_and_values) @@ -108,7 +108,7 @@ TYPED_TEST(groupby_quantile_test, null_keys_and_values) auto agg = cudf::make_quantile_aggregation({0.5}, cudf::interpolation::LINEAR); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_quantile_test, multiple_quantile) @@ -128,17 +128,17 @@ TYPED_TEST(groupby_quantile_test, multiple_quantile) auto agg = cudf::make_quantile_aggregation( {0.25, 0.75}, cudf::interpolation::LINEAR); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - force_use_sort_impl::YES, - cudf::null_policy::EXCLUDE, - cudf::sorted::NO, - {}, - {}, - cudf::sorted::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + force_use_sort_impl::YES, + cudf::null_policy::EXCLUDE, + cudf::sorted::NO, + {}, + {}, + cudf::sorted::YES); } TYPED_TEST(groupby_quantile_test, interpolation_types) @@ -156,27 +156,27 @@ TYPED_TEST(groupby_quantile_test, interpolation_types) // {0, 3, 6, 1, 4, 5, 9, 2, 7} cudf::test::fixed_width_column_wrapper expect_vals1({2.4, 4.2, 4.}, no_nulls()); auto agg1 = cudf::make_quantile_aggregation({0.4}, cudf::interpolation::LINEAR); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals1, std::move(agg1)); + test_single_agg(keys, vals, expect_keys, expect_vals1, std::move(agg1)); // {0, 3, 6, 1, 4, 5, 9, 2, 7} cudf::test::fixed_width_column_wrapper expect_vals2({3, 4, 2}, no_nulls()); auto agg2 = cudf::make_quantile_aggregation({0.4}, cudf::interpolation::NEAREST); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals2, std::move(agg2)); + test_single_agg(keys, vals, expect_keys, expect_vals2, std::move(agg2)); // {0, 3, 6, 1, 4, 5, 9, 2, 7} cudf::test::fixed_width_column_wrapper expect_vals3({0, 4, 2}, no_nulls()); auto agg3 = cudf::make_quantile_aggregation({0.4}, cudf::interpolation::LOWER); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals3, std::move(agg3)); + test_single_agg(keys, vals, expect_keys, expect_vals3, std::move(agg3)); // {0, 3, 6, 1, 4, 5, 9, 2, 7} cudf::test::fixed_width_column_wrapper expect_vals4({3, 5, 7}, no_nulls()); auto agg4 = cudf::make_quantile_aggregation({0.4}, cudf::interpolation::HIGHER); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals4, std::move(agg4)); + test_single_agg(keys, vals, expect_keys, expect_vals4, std::move(agg4)); // {0, 3, 6, 1, 4, 5, 9, 2, 7} cudf::test::fixed_width_column_wrapper expect_vals5({1.5, 4.5, 4.5}, no_nulls()); auto agg5 = cudf::make_quantile_aggregation({0.4}, cudf::interpolation::MIDPOINT); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals5, std::move(agg5)); + test_single_agg(keys, vals, expect_keys, expect_vals5, std::move(agg5)); // clang-format on } @@ -195,7 +195,7 @@ TYPED_TEST(groupby_quantile_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({3., 4.5, 7.}, no_nulls()); // clang-format on - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, diff --git a/cpp/tests/groupby/rank_scan_tests.cpp b/cpp/tests/groupby/rank_scan_tests.cpp index 29551957ac1..a123093fd52 100644 --- a/cpp/tests/groupby/rank_scan_tests.cpp +++ b/cpp/tests/groupby/rank_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -28,34 +28,34 @@ void test_rank_scans(cudf::column_view const& keys, cudf::column_view const& expected_rank, cudf::column_view const& expected_percent_rank) { - CUDF_TEST_SINGLE_SCAN(keys, - order, - keys, - expected_dense, - cudf::make_rank_aggregation( - cudf::rank_method::DENSE, {}, cudf::null_policy::INCLUDE), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); - CUDF_TEST_SINGLE_SCAN(keys, - order, - keys, - expected_rank, - cudf::make_rank_aggregation( - cudf::rank_method::MIN, {}, cudf::null_policy::INCLUDE), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); - CUDF_TEST_SINGLE_SCAN(keys, - order, - keys, - expected_percent_rank, - cudf::make_rank_aggregation( - cudf::rank_method::MIN, - {}, - cudf::null_policy::INCLUDE, - {}, - cudf::rank_percentage::ONE_NORMALIZED), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); + test_single_scan(keys, + order, + keys, + expected_dense, + cudf::make_rank_aggregation( + cudf::rank_method::DENSE, {}, cudf::null_policy::INCLUDE), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); + test_single_scan(keys, + order, + keys, + expected_rank, + cudf::make_rank_aggregation( + cudf::rank_method::MIN, {}, cudf::null_policy::INCLUDE), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); + test_single_scan(keys, + order, + keys, + expected_percent_rank, + cudf::make_rank_aggregation( + cudf::rank_method::MIN, + {}, + cudf::null_policy::INCLUDE, + {}, + cudf::rank_percentage::ONE_NORMALIZED), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); } struct groupby_rank_scan_test : public cudf::test::BaseFixture {}; @@ -521,63 +521,63 @@ TEST_F(groupby_rank_scan_test_failures, DISABLED_test_exception_triggers) auto const col = input{3, 3, 1}; // All of these aggregations raise exceptions unless provided presorted keys - EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::DENSE), - cudf::null_policy::INCLUDE, - cudf::sorted::NO), + EXPECT_THROW(test_single_scan(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::DENSE), + cudf::null_policy::INCLUDE, + cudf::sorted::NO), cudf::logic_error); - EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::MIN), - cudf::null_policy::INCLUDE, - cudf::sorted::NO), + EXPECT_THROW(test_single_scan(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::MIN), + cudf::null_policy::INCLUDE, + cudf::sorted::NO), cudf::logic_error); - EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::DENSE), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES), + EXPECT_THROW(test_single_scan(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::DENSE), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES), cudf::logic_error); - EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::MIN), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES), + EXPECT_THROW(test_single_scan(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::MIN), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES), cudf::logic_error); - EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::DENSE), - cudf::null_policy::EXCLUDE, - cudf::sorted::NO), + EXPECT_THROW(test_single_scan(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::DENSE), + cudf::null_policy::EXCLUDE, + cudf::sorted::NO), cudf::logic_error); - EXPECT_THROW(CUDF_TEST_SINGLE_SCAN(keys, - col, - keys, - col, - cudf::make_rank_aggregation( - cudf::rank_method::MIN), - cudf::null_policy::EXCLUDE, - cudf::sorted::NO), + EXPECT_THROW(test_single_scan(keys, + col, + keys, + col, + cudf::make_rank_aggregation( + cudf::rank_method::MIN), + cudf::null_policy::EXCLUDE, + cudf::sorted::NO), cudf::logic_error); } diff --git a/cpp/tests/groupby/std_tests.cpp b/cpp/tests/groupby/std_tests.cpp index 8c7d603ff69..2d5d21509df 100644 --- a/cpp/tests/groupby/std_tests.cpp +++ b/cpp/tests/groupby/std_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,7 @@ TYPED_TEST(groupby_std_test, basic) // clang-format on auto agg = cudf::make_std_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, empty_cols) @@ -54,7 +54,7 @@ TYPED_TEST(groupby_std_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_std_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, zero_valid_keys) @@ -70,7 +70,7 @@ TYPED_TEST(groupby_std_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_std_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, zero_valid_values) @@ -86,7 +86,7 @@ TYPED_TEST(groupby_std_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_std_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, null_keys_and_values) @@ -108,7 +108,7 @@ TYPED_TEST(groupby_std_test, null_keys_and_values) {1, 1, 1, 0}); auto agg = cudf::make_std_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, ddof_non_default) @@ -130,7 +130,7 @@ TYPED_TEST(groupby_std_test, ddof_non_default) {0, 1, 0, 0}); auto agg = cudf::make_std_aggregation(2); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_std_test, dictionary) @@ -149,6 +149,6 @@ TYPED_TEST(groupby_std_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({3., sqrt(131./12), sqrt(31./3)}, no_nulls()); // clang-format on - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals, cudf::make_std_aggregation()); } diff --git a/cpp/tests/groupby/structs_tests.cpp b/cpp/tests/groupby/structs_tests.cpp index 8fcfcfd0527..34fcb7e0380 100644 --- a/cpp/tests/groupby/structs_tests.cpp +++ b/cpp/tests/groupby/structs_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -79,7 +79,7 @@ TYPED_TEST(groupby_structs_test, basic) auto expected_keys = cudf::test::structs_column_wrapper{expected_member_0, expected_member_1, expected_member_2}; // clang-format on - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, structs_with_nulls_in_members) @@ -107,7 +107,7 @@ TYPED_TEST(groupby_structs_test, structs_with_nulls_in_members) auto expected_keys = cudf::test::structs_column_wrapper{expected_member_0, expected_member_1, expected_member_2}; // clang-format on - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, structs_with_null_rows) @@ -133,7 +133,7 @@ TYPED_TEST(groupby_structs_test, structs_with_null_rows) print_agg_results(keys, values); - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, structs_with_nulls_in_rows_and_members) @@ -162,7 +162,7 @@ TYPED_TEST(groupby_structs_test, structs_with_nulls_in_rows_and_members) // clang-format on print_agg_results(keys, values); - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, null_members_differ_from_null_structs) @@ -196,7 +196,7 @@ TYPED_TEST(groupby_structs_test, null_members_differ_from_null_structs) auto expected_keys = cudf::test::structs_column_wrapper{{expected_member_0, expected_member_1, expected_member_2}, null_at(4)}; // clang-format on - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, structs_of_structs) @@ -232,7 +232,7 @@ TYPED_TEST(groupby_structs_test, structs_of_structs) auto expected_keys = cudf::test::structs_column_wrapper{{expected_structs, expected_struct_1_member_1}}; // clang-format on - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, empty_input) @@ -256,7 +256,7 @@ TYPED_TEST(groupby_structs_test, empty_input) auto expected_keys = cudf::test::structs_column_wrapper{expected_member_0, expected_member_1, expected_member_2}; // clang-format on - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, all_null_input) @@ -280,7 +280,7 @@ TYPED_TEST(groupby_structs_test, all_null_input) auto expected_keys = cudf::test::structs_column_wrapper{{expected_member_0, expected_member_1, expected_member_2}, all_nulls()}; // clang-format on - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } TYPED_TEST(groupby_structs_test, lists_as_keys) @@ -304,5 +304,5 @@ TYPED_TEST(groupby_structs_test, lists_as_keys) // clang-format on auto expected_keys = cudf::test::structs_column_wrapper{{expected_member_0, expected_member_1}}; - CUDF_TEST_SUM_AGG(keys, values, expected_keys, expected_values); + test_sum_agg(keys, values, expected_keys, expected_values); } diff --git a/cpp/tests/groupby/sum_of_squares_tests.cpp b/cpp/tests/groupby/sum_of_squares_tests.cpp index 789be4096e9..e4da29128bc 100644 --- a/cpp/tests/groupby/sum_of_squares_tests.cpp +++ b/cpp/tests/groupby/sum_of_squares_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -36,7 +36,7 @@ TYPED_TEST(groupby_sum_of_squares_test, basic) cudf::test::fixed_width_column_wrapper expect_vals({45., 123., 117.}, no_nulls()); auto agg = cudf::make_sum_of_squares_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_of_squares_test, empty_cols) @@ -52,7 +52,7 @@ TYPED_TEST(groupby_sum_of_squares_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_sum_of_squares_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_of_squares_test, zero_valid_keys) @@ -68,7 +68,7 @@ TYPED_TEST(groupby_sum_of_squares_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_sum_of_squares_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_of_squares_test, zero_valid_values) @@ -84,7 +84,7 @@ TYPED_TEST(groupby_sum_of_squares_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_sum_of_squares_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_of_squares_test, null_keys_and_values) @@ -105,7 +105,7 @@ TYPED_TEST(groupby_sum_of_squares_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({45., 98., 68., 9.}, {1, 1, 1, 0}); auto agg = cudf::make_sum_of_squares_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_of_squares_test, dictionary) @@ -124,9 +124,9 @@ TYPED_TEST(groupby_sum_of_squares_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({45., 123., 117. }, no_nulls()); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_sum_of_squares_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_sum_of_squares_aggregation()); } diff --git a/cpp/tests/groupby/sum_scan_tests.cpp b/cpp/tests/groupby/sum_scan_tests.cpp index b7fb832d616..bcb2f0233b5 100644 --- a/cpp/tests/groupby/sum_scan_tests.cpp +++ b/cpp/tests/groupby/sum_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -42,7 +42,7 @@ TYPED_TEST(groupby_sum_scan_test, basic) result_wrapper expect_vals{0, 3, 9, 1, 5, 10, 19, 2, 9, 17}; // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_scan_test, pre_sorted) @@ -59,13 +59,13 @@ TYPED_TEST(groupby_sum_scan_test, pre_sorted) // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, - vals, - expect_keys, - expect_vals, - std::move(agg), - cudf::null_policy::EXCLUDE, - cudf::sorted::YES); + test_single_scan(keys, + vals, + expect_keys, + expect_vals, + std::move(agg), + cudf::null_policy::EXCLUDE, + cudf::sorted::YES); } TYPED_TEST(groupby_sum_scan_test, empty_cols) @@ -82,7 +82,7 @@ TYPED_TEST(groupby_sum_scan_test, empty_cols) // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_scan_test, zero_valid_keys) @@ -96,7 +96,7 @@ TYPED_TEST(groupby_sum_scan_test, zero_valid_keys) result_wrapper expect_vals{}; auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_scan_test, zero_valid_values) @@ -110,7 +110,7 @@ TYPED_TEST(groupby_sum_scan_test, zero_valid_values) result_wrapper expect_vals({3, 4, 5}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_sum_scan_test, null_keys_and_values) @@ -130,7 +130,7 @@ TYPED_TEST(groupby_sum_scan_test, null_keys_and_values) // clang-format on auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_scan(keys, vals, expect_keys, expect_vals, std::move(agg)); } template @@ -156,6 +156,6 @@ TYPED_TEST(GroupBySumScanFixedPointTest, GroupBySortSumScanDecimalAsValue) // clang-format on auto agg2 = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_SCAN(keys, vals, expect_keys, expect_vals_sum, std::move(agg2)); + test_single_scan(keys, vals, expect_keys, expect_vals_sum, std::move(agg2)); } } diff --git a/cpp/tests/groupby/sum_tests.cpp b/cpp/tests/groupby/sum_tests.cpp index 7ee0406b428..3938547ad2a 100644 --- a/cpp/tests/groupby/sum_tests.cpp +++ b/cpp/tests/groupby/sum_tests.cpp @@ -36,11 +36,10 @@ TYPED_TEST(groupby_sum_test, basic) cudf::test::fixed_width_column_wrapper expect_vals{9, 19, 17}; auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_sum_test, empty_cols) @@ -55,11 +54,10 @@ TYPED_TEST(groupby_sum_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_sum_test, zero_valid_keys) @@ -74,11 +72,10 @@ TYPED_TEST(groupby_sum_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_sum_test, zero_valid_values) @@ -93,11 +90,10 @@ TYPED_TEST(groupby_sum_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, cudf::test::iterators::all_nulls()); auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_sum_test, null_keys_and_values) @@ -118,11 +114,10 @@ TYPED_TEST(groupby_sum_test, null_keys_and_values) cudf::test::fixed_width_column_wrapper expect_vals({9, 14, 10, 0}, {1, 1, 1, 0}); auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); auto agg2 = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG( - keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES); } TYPED_TEST(groupby_sum_test, dictionary) @@ -135,14 +130,14 @@ TYPED_TEST(groupby_sum_test, dictionary) cudf::test::fixed_width_column_wrapper expect_keys{1, 2, 3}; cudf::test::fixed_width_column_wrapper expect_vals{9, 19, 17}; - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals, cudf::make_sum_aggregation()); - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_sum_aggregation(), - force_use_sort_impl::YES); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_sum_aggregation(), + force_use_sort_impl::YES); } struct overflow_test : public cudf::test::BaseFixture {}; @@ -158,7 +153,7 @@ TEST_F(overflow_test, overflow_integer) auto test_sum = [&](auto const use_sort) { auto agg = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg), use_sort); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg), use_sort); }; test_sum(force_use_sort_impl::NO); @@ -189,12 +184,12 @@ TYPED_TEST(GroupBySumFixedPointTest, GroupBySortSumDecimalAsValue) auto const expect_vals_sum = fp_wrapper{{9, 19, 17}, scale}; auto agg1 = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals_sum, std::move(agg1), force_use_sort_impl::YES); auto agg4 = cudf::make_product_aggregation(); EXPECT_THROW( - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, {}, std::move(agg4), force_use_sort_impl::YES), + test_single_agg(keys, vals, expect_keys, {}, std::move(agg4), force_use_sort_impl::YES), cudf::logic_error); } } @@ -218,14 +213,13 @@ TYPED_TEST(GroupBySumFixedPointTest, GroupByHashSumDecimalAsValue) auto const expect_vals_sum = fp_wrapper{{9, 19, 17}, scale}; auto agg5 = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals_sum, std::move(agg5)); + test_single_agg(keys, vals, expect_keys, expect_vals_sum, std::move(agg5)); auto agg6 = cudf::make_sum_aggregation(); - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, expect_vals_sum, std::move(agg6), force_use_sort_impl::NO); auto agg8 = cudf::make_product_aggregation(); - EXPECT_THROW(CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, {}, std::move(agg8)), - cudf::logic_error); + EXPECT_THROW(test_single_agg(keys, vals, expect_keys, {}, std::move(agg8)), cudf::logic_error); } } diff --git a/cpp/tests/groupby/sum_with_overflow_tests.cpp b/cpp/tests/groupby/sum_with_overflow_tests.cpp index b28eb373d3f..a320f4c1f64 100644 --- a/cpp/tests/groupby/sum_with_overflow_tests.cpp +++ b/cpp/tests/groupby/sum_with_overflow_tests.cpp @@ -54,12 +54,12 @@ TYPED_TEST(groupby_sum_with_overflow_test, basic) auto expect_vals = cudf::create_structs_hierarchy(3, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); // SUM_WITH_OVERFLOW should throw with sort-based groupby auto agg_sort = cudf::make_sum_with_overflow_aggregation(); EXPECT_THROW( - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, *expect_vals, std::move(agg_sort), force_use_sort_impl::YES), cudf::logic_error); } else { @@ -76,12 +76,12 @@ TYPED_TEST(groupby_sum_with_overflow_test, basic) auto expect_vals = cudf::create_structs_hierarchy(3, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); // SUM_WITH_OVERFLOW should throw with sort-based groupby auto agg_sort = cudf::make_sum_with_overflow_aggregation(); EXPECT_THROW( - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, *expect_vals, std::move(agg_sort), force_use_sort_impl::YES), cudf::logic_error); } @@ -109,7 +109,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, empty_cols) auto expect_vals = cudf::create_structs_hierarchy(0, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); // Note: SUM_WITH_OVERFLOW only works with hash groupby, not sort groupby } @@ -134,7 +134,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, zero_valid_keys) auto expect_vals = cudf::create_structs_hierarchy(0, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); // Note: SUM_WITH_OVERFLOW only works with hash groupby, not sort groupby } @@ -163,7 +163,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, zero_valid_values) cudf::create_structs_hierarchy(1, std::move(children), null_count, std::move(validity_mask)); auto agg = cudf::make_sum_with_overflow_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); // Note: SUM_WITH_OVERFLOW only works with hash groupby, not sort groupby } @@ -198,7 +198,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, null_keys_and_values) cudf::create_structs_hierarchy(4, std::move(children), null_count, std::move(validity_mask)); auto agg = cudf::make_sum_with_overflow_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); // Note: SUM_WITH_OVERFLOW only works with hash groupby, not sort groupby } @@ -273,12 +273,12 @@ TYPED_TEST(groupby_sum_with_overflow_test, overflow_detection) auto expect_vals = cudf::create_structs_hierarchy(4, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); // Verify that sort-based groupby throws for decimals auto agg2 = cudf::make_sum_with_overflow_aggregation(); EXPECT_THROW( - CUDF_TEST_SINGLE_AGG( + test_single_agg( keys, vals, expect_keys, *expect_vals, std::move(agg2), force_use_sort_impl::YES), cudf::logic_error); } else { @@ -343,7 +343,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, overflow_detection) auto expect_vals = cudf::create_structs_hierarchy(4, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); } else { // For unsigned types: only test positive overflow cudf::test::fixed_width_column_wrapper vals{ @@ -380,7 +380,7 @@ TYPED_TEST(groupby_sum_with_overflow_test, overflow_detection) auto expect_vals = cudf::create_structs_hierarchy(4, std::move(children), 0, {}); auto agg = cudf::make_sum_with_overflow_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, *expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, *expect_vals, std::move(agg)); } // Note: SUM_WITH_OVERFLOW only works with hash groupby, not sort groupby diff --git a/cpp/tests/groupby/var_tests.cpp b/cpp/tests/groupby/var_tests.cpp index 90cf6d15190..2de32181638 100644 --- a/cpp/tests/groupby/var_tests.cpp +++ b/cpp/tests/groupby/var_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,7 @@ TYPED_TEST(groupby_var_test, basic) // clang-format on auto agg = cudf::make_variance_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, empty_cols) @@ -54,7 +54,7 @@ TYPED_TEST(groupby_var_test, empty_cols) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_variance_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, zero_valid_keys) @@ -70,7 +70,7 @@ TYPED_TEST(groupby_var_test, zero_valid_keys) cudf::test::fixed_width_column_wrapper expect_vals{}; auto agg = cudf::make_variance_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, zero_valid_values) @@ -86,7 +86,7 @@ TYPED_TEST(groupby_var_test, zero_valid_values) cudf::test::fixed_width_column_wrapper expect_vals({0}, all_nulls()); auto agg = cudf::make_variance_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, null_keys_and_values) @@ -109,7 +109,7 @@ TYPED_TEST(groupby_var_test, null_keys_and_values) // clang-format on auto agg = cudf::make_variance_aggregation(); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, ddof_non_default) @@ -133,7 +133,7 @@ TYPED_TEST(groupby_var_test, ddof_non_default) // clang-format on auto agg = cudf::make_variance_aggregation(2); - CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg)); + test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); } TYPED_TEST(groupby_var_test, dictionary) @@ -152,11 +152,11 @@ TYPED_TEST(groupby_var_test, dictionary) cudf::test::fixed_width_column_wrapper expect_vals({9., 131./12, 31./3 }, no_nulls()); // clang-format on - CUDF_TEST_SINGLE_AGG(keys, - vals, - expect_keys, - expect_vals, - cudf::make_variance_aggregation()); + test_single_agg(keys, + vals, + expect_keys, + expect_vals, + cudf::make_variance_aggregation()); } // This test ensures that the same results are produced by the sort-based and From ebedcf6f59570c44a749030d73199b0ccd7b8c07 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Mon, 1 Dec 2025 15:07:24 -0800 Subject: [PATCH 07/10] Fix some issues Signed-off-by: Nghia Truong --- cpp/tests/groupby/groupby_test_util.cpp | 4 ++ cpp/tests/groupby/rank_scan_tests.cpp | 56 ++++++++++++------------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/cpp/tests/groupby/groupby_test_util.cpp b/cpp/tests/groupby/groupby_test_util.cpp index d190517dbf3..aca6724f33c 100644 --- a/cpp/tests/groupby/groupby_test_util.cpp +++ b/cpp/tests/groupby/groupby_test_util.cpp @@ -99,6 +99,10 @@ void test_sum_agg(column_view const& keys, make_sum_aggregation(), use_sort_option, null_policy::INCLUDE, + sorted::NO, + {}, + {}, + sorted::NO, location); }; do_test(force_use_sort_impl::YES); diff --git a/cpp/tests/groupby/rank_scan_tests.cpp b/cpp/tests/groupby/rank_scan_tests.cpp index a123093fd52..12100b98cbd 100644 --- a/cpp/tests/groupby/rank_scan_tests.cpp +++ b/cpp/tests/groupby/rank_scan_tests.cpp @@ -28,34 +28,34 @@ void test_rank_scans(cudf::column_view const& keys, cudf::column_view const& expected_rank, cudf::column_view const& expected_percent_rank) { - test_single_scan(keys, - order, - keys, - expected_dense, - cudf::make_rank_aggregation( - cudf::rank_method::DENSE, {}, cudf::null_policy::INCLUDE), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); - test_single_scan(keys, - order, - keys, - expected_rank, - cudf::make_rank_aggregation( - cudf::rank_method::MIN, {}, cudf::null_policy::INCLUDE), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); - test_single_scan(keys, - order, - keys, - expected_percent_rank, - cudf::make_rank_aggregation( - cudf::rank_method::MIN, - {}, - cudf::null_policy::INCLUDE, - {}, - cudf::rank_percentage::ONE_NORMALIZED), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); + cudf::test::test_single_scan(keys, + order, + keys, + expected_dense, + cudf::make_rank_aggregation( + cudf::rank_method::DENSE, {}, cudf::null_policy::INCLUDE), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); + cudf::test::test_single_scan(keys, + order, + keys, + expected_rank, + cudf::make_rank_aggregation( + cudf::rank_method::MIN, {}, cudf::null_policy::INCLUDE), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); + cudf::test::test_single_scan(keys, + order, + keys, + expected_percent_rank, + cudf::make_rank_aggregation( + cudf::rank_method::MIN, + {}, + cudf::null_policy::INCLUDE, + {}, + cudf::rank_percentage::ONE_NORMALIZED), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); } struct groupby_rank_scan_test : public cudf::test::BaseFixture {}; From 999804fa53207b17345050a0fcc0297ce50b23f3 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Mon, 1 Dec 2025 15:12:26 -0800 Subject: [PATCH 08/10] Use const ref for parameter Signed-off-by: Nghia Truong --- cpp/tests/groupby/groupby_test_util.cpp | 6 +++--- cpp/tests/groupby/groupby_test_util.hpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/tests/groupby/groupby_test_util.cpp b/cpp/tests/groupby/groupby_test_util.cpp index aca6724f33c..38f548bcefb 100644 --- a/cpp/tests/groupby/groupby_test_util.cpp +++ b/cpp/tests/groupby/groupby_test_util.cpp @@ -30,7 +30,7 @@ void test_single_agg(column_view const& keys, std::vector const& column_order, std::vector const& null_precedence, sorted reference_keys_are_sorted, - std::source_location const location) + std::source_location const& location) { SCOPED_TRACE("Original failure location: " + std::string{location.file_name()} + ":" + std::to_string(location.line())); @@ -89,7 +89,7 @@ void test_sum_agg(column_view const& keys, column_view const& values, column_view const& expected_keys, column_view const& expected_values, - std::source_location const location) + std::source_location const& location) { auto const do_test = [&](auto const use_sort_option) { test_single_agg(keys, @@ -118,7 +118,7 @@ void test_single_scan(column_view const& keys, sorted keys_are_sorted, std::vector const& column_order, std::vector const& null_precedence, - std::source_location const location) + std::source_location const& location) { SCOPED_TRACE("Original failure location: " + std::string{location.file_name()} + ":" + std::to_string(location.line())); diff --git a/cpp/tests/groupby/groupby_test_util.hpp b/cpp/tests/groupby/groupby_test_util.hpp index b5356e1ea0f..66eda4f9cc3 100644 --- a/cpp/tests/groupby/groupby_test_util.hpp +++ b/cpp/tests/groupby/groupby_test_util.hpp @@ -25,12 +25,12 @@ void test_single_agg(column_view const& keys, std::vector const& column_order = {}, std::vector const& null_precedence = {}, sorted reference_keys_are_sorted = sorted::NO, - std::source_location const location = std::source_location::current()); + std::source_location const& location = std::source_location::current()); void test_sum_agg(column_view const& keys, column_view const& values, column_view const& expected_keys, column_view const& expected_values, - std::source_location const location = std::source_location::current()); + std::source_location const& location = std::source_location::current()); void test_single_scan(column_view const& keys, column_view const& values, @@ -41,6 +41,6 @@ void test_single_scan(column_view const& keys, sorted keys_are_sorted = sorted::NO, std::vector const& column_order = {}, std::vector const& null_precedence = {}, - std::source_location const location = std::source_location::current()); + std::source_location const& location = std::source_location::current()); } // namespace cudf::test From 1e09a6b6591fb55bcbe9157921e192a68b64329e Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Mon, 1 Dec 2025 15:16:06 -0800 Subject: [PATCH 09/10] Fix copyright year Signed-off-by: Nghia Truong --- cpp/tests/groupby/rank_scan_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/tests/groupby/rank_scan_tests.cpp b/cpp/tests/groupby/rank_scan_tests.cpp index 12100b98cbd..14f1aab6c14 100644 --- a/cpp/tests/groupby/rank_scan_tests.cpp +++ b/cpp/tests/groupby/rank_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ From 02f498a807bb3fb6fc9c3fb525021d18e4d70bf0 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Tue, 2 Dec 2025 09:38:41 -0800 Subject: [PATCH 10/10] Remove namespace Signed-off-by: Nghia Truong --- cpp/tests/groupby/groupby_test_util.cpp | 114 ++++++++++++------------ cpp/tests/groupby/groupby_test_util.hpp | 52 +++++------ cpp/tests/groupby/rank_scan_tests.cpp | 58 ++++++------ 3 files changed, 110 insertions(+), 114 deletions(-) diff --git a/cpp/tests/groupby/groupby_test_util.cpp b/cpp/tests/groupby/groupby_test_util.cpp index 38f548bcefb..d6a0608c3e9 100644 --- a/cpp/tests/groupby/groupby_test_util.cpp +++ b/cpp/tests/groupby/groupby_test_util.cpp @@ -17,67 +17,69 @@ #include #include -namespace cudf ::test { - -void test_single_agg(column_view const& keys, - column_view const& values, - column_view const& expect_keys, - column_view const& expect_vals, - std::unique_ptr&& agg, +void test_single_agg(cudf::column_view const& keys, + cudf::column_view const& values, + cudf::column_view const& expect_keys, + cudf::column_view const& expect_vals, + std::unique_ptr&& agg, force_use_sort_impl use_sort, - null_policy include_null_keys, - sorted keys_are_sorted, - std::vector const& column_order, - std::vector const& null_precedence, - sorted reference_keys_are_sorted, + cudf::null_policy include_null_keys, + cudf::sorted keys_are_sorted, + std::vector const& column_order, + std::vector const& null_precedence, + cudf::sorted reference_keys_are_sorted, std::source_location const& location) { SCOPED_TRACE("Original failure location: " + std::string{location.file_name()} + ":" + std::to_string(location.line())); auto const [sorted_expect_keys, sorted_expect_vals] = [&]() { - if (reference_keys_are_sorted == sorted::NO) { + if (reference_keys_are_sorted == cudf::sorted::NO) { auto const sort_expect_order = - sorted_order(table_view{{expect_keys}}, column_order, null_precedence); - auto sorted_expect_keys = gather(table_view{{expect_keys}}, *sort_expect_order); - auto sorted_expect_vals = gather(table_view{{expect_vals}}, *sort_expect_order); + cudf::sorted_order(cudf::table_view{{expect_keys}}, column_order, null_precedence); + auto sorted_expect_keys = cudf::gather(cudf::table_view{{expect_keys}}, *sort_expect_order); + auto sorted_expect_vals = cudf::gather(cudf::table_view{{expect_vals}}, *sort_expect_order); + return std::make_pair(std::move(sorted_expect_keys), std::move(sorted_expect_vals)); + } else { + auto sorted_expect_keys = std::make_unique(cudf::table_view{{expect_keys}}); + auto sorted_expect_vals = std::make_unique(cudf::table_view{{expect_vals}}); return std::make_pair(std::move(sorted_expect_keys), std::move(sorted_expect_vals)); } - auto sorted_expect_keys = std::make_unique
(table_view{{expect_keys}}); - auto sorted_expect_vals = std::make_unique
(table_view{{expect_vals}}); - return std::make_pair(std::move(sorted_expect_keys), std::move(sorted_expect_vals)); }(); - std::vector requests; + std::vector requests; requests.emplace_back(); requests[0].values = values; requests[0].aggregations.push_back(std::move(agg)); if (use_sort == force_use_sort_impl::YES) { - // WAR to force groupby to use sort implementation - requests[0].aggregations.push_back(make_nth_element_aggregation(0)); + // WAR to force cudf::groupby to use sort implementation + requests[0].aggregations.push_back( + cudf::make_nth_element_aggregation(0)); } - // since the default behavior of groupby(...) for an empty null_precedence vector is - // null_order::AFTER whereas for sorted_order(...) it's null_order::BEFORE - auto const precedence = - null_precedence.empty() ? std::vector(1, null_order::BEFORE) : null_precedence; + // since the default behavior of cudf::groupby(...) for an empty null_precedence vector is + // null_order::AFTER whereas for cudf::sorted_order(...) it's null_order::BEFORE + auto const precedence = null_precedence.empty() + ? std::vector(1, cudf::null_order::BEFORE) + : null_precedence; - groupby::groupby gb_obj( - table_view({keys}), include_null_keys, keys_are_sorted, column_order, precedence); + cudf::groupby::groupby gb_obj( + cudf::table_view({keys}), include_null_keys, keys_are_sorted, column_order, precedence); - auto result = gb_obj.aggregate(requests, test::get_default_stream()); + auto result = gb_obj.aggregate(requests, cudf::test::get_default_stream()); - if (use_sort == force_use_sort_impl::YES && keys_are_sorted == sorted::NO) { + if (use_sort == force_use_sort_impl::YES && keys_are_sorted == cudf::sorted::NO) { CUDF_TEST_EXPECT_TABLES_EQUAL(*sorted_expect_keys, result.first->view()); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(sorted_expect_vals->get_column(0), *result.second[0].results[0]); } else { - auto const sort_order = sorted_order(result.first->view(), column_order, precedence); - auto const sorted_keys = gather(result.first->view(), *sort_order); - auto const sorted_vals = gather(table_view({result.second[0].results[0]->view()}), *sort_order); + auto const sort_order = cudf::sorted_order(result.first->view(), column_order, precedence); + auto const sorted_keys = cudf::gather(result.first->view(), *sort_order); + auto const sorted_vals = + cudf::gather(cudf::table_view({result.second[0].results[0]->view()}), *sort_order); CUDF_TEST_EXPECT_TABLES_EQUAL(*sorted_expect_keys, *sorted_keys); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(sorted_expect_vals->get_column(0), @@ -85,10 +87,10 @@ void test_single_agg(column_view const& keys, } } -void test_sum_agg(column_view const& keys, - column_view const& values, - column_view const& expected_keys, - column_view const& expected_values, +void test_sum_agg(cudf::column_view const& keys, + cudf::column_view const& values, + cudf::column_view const& expected_keys, + cudf::column_view const& expected_values, std::source_location const& location) { auto const do_test = [&](auto const use_sort_option) { @@ -96,46 +98,44 @@ void test_sum_agg(column_view const& keys, values, expected_keys, expected_values, - make_sum_aggregation(), + cudf::make_sum_aggregation(), use_sort_option, - null_policy::INCLUDE, - sorted::NO, + cudf::null_policy::INCLUDE, + cudf::sorted::NO, {}, {}, - sorted::NO, + cudf::sorted::NO, location); }; do_test(force_use_sort_impl::YES); do_test(force_use_sort_impl::NO); } -void test_single_scan(column_view const& keys, - column_view const& values, - column_view const& expect_keys, - column_view const& expect_vals, - std::unique_ptr&& agg, - null_policy include_null_keys, - sorted keys_are_sorted, - std::vector const& column_order, - std::vector const& null_precedence, +void test_single_scan(cudf::column_view const& keys, + cudf::column_view const& values, + cudf::column_view const& expect_keys, + cudf::column_view const& expect_vals, + std::unique_ptr&& agg, + cudf::null_policy include_null_keys, + cudf::sorted keys_are_sorted, + std::vector const& column_order, + std::vector const& null_precedence, std::source_location const& location) { SCOPED_TRACE("Original failure location: " + std::string{location.file_name()} + ":" + std::to_string(location.line())); - std::vector requests; + std::vector requests; requests.emplace_back(); requests[0].values = values; requests[0].aggregations.push_back(std::move(agg)); - groupby::groupby gb_obj( - table_view({keys}), include_null_keys, keys_are_sorted, column_order, null_precedence); + cudf::groupby::groupby gb_obj( + cudf::table_view({keys}), include_null_keys, keys_are_sorted, column_order, null_precedence); - // groupby scan uses sort implementation + // cudf::groupby scan uses sort implementation auto result = gb_obj.scan(requests); - CUDF_TEST_EXPECT_TABLES_EQUAL(table_view({expect_keys}), result.first->view()); + CUDF_TEST_EXPECT_TABLES_EQUAL(cudf::table_view({expect_keys}), result.first->view()); CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(expect_vals, *result.second[0].results[0]); } - -} // namespace cudf::test diff --git a/cpp/tests/groupby/groupby_test_util.hpp b/cpp/tests/groupby/groupby_test_util.hpp index 66eda4f9cc3..f581db75ab7 100644 --- a/cpp/tests/groupby/groupby_test_util.hpp +++ b/cpp/tests/groupby/groupby_test_util.hpp @@ -12,35 +12,31 @@ enum class force_use_sort_impl : bool { NO, YES }; -namespace cudf::test { - -void test_single_agg(column_view const& keys, - column_view const& values, - column_view const& expect_keys, - column_view const& expect_vals, - std::unique_ptr&& agg, - force_use_sort_impl use_sort = force_use_sort_impl::NO, - null_policy include_null_keys = null_policy::EXCLUDE, - sorted keys_are_sorted = sorted::NO, - std::vector const& column_order = {}, - std::vector const& null_precedence = {}, - sorted reference_keys_are_sorted = sorted::NO, +void test_single_agg(cudf::column_view const& keys, + cudf::column_view const& values, + cudf::column_view const& expect_keys, + cudf::column_view const& expect_vals, + std::unique_ptr&& agg, + force_use_sort_impl use_sort = force_use_sort_impl::NO, + cudf::null_policy include_null_keys = cudf::null_policy::EXCLUDE, + cudf::sorted keys_are_sorted = cudf::sorted::NO, + std::vector const& column_order = {}, + std::vector const& null_precedence = {}, + cudf::sorted reference_keys_are_sorted = cudf::sorted::NO, std::source_location const& location = std::source_location::current()); -void test_sum_agg(column_view const& keys, - column_view const& values, - column_view const& expected_keys, - column_view const& expected_values, +void test_sum_agg(cudf::column_view const& keys, + cudf::column_view const& values, + cudf::column_view const& expected_keys, + cudf::column_view const& expected_values, std::source_location const& location = std::source_location::current()); -void test_single_scan(column_view const& keys, - column_view const& values, - column_view const& expect_keys, - column_view const& expect_vals, - std::unique_ptr&& agg, - null_policy include_null_keys = null_policy::EXCLUDE, - sorted keys_are_sorted = sorted::NO, - std::vector const& column_order = {}, - std::vector const& null_precedence = {}, +void test_single_scan(cudf::column_view const& keys, + cudf::column_view const& values, + cudf::column_view const& expect_keys, + cudf::column_view const& expect_vals, + std::unique_ptr&& agg, + cudf::null_policy include_null_keys = cudf::null_policy::EXCLUDE, + cudf::sorted keys_are_sorted = cudf::sorted::NO, + std::vector const& column_order = {}, + std::vector const& null_precedence = {}, std::source_location const& location = std::source_location::current()); - -} // namespace cudf::test diff --git a/cpp/tests/groupby/rank_scan_tests.cpp b/cpp/tests/groupby/rank_scan_tests.cpp index 14f1aab6c14..a123093fd52 100644 --- a/cpp/tests/groupby/rank_scan_tests.cpp +++ b/cpp/tests/groupby/rank_scan_tests.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION. * SPDX-License-Identifier: Apache-2.0 */ @@ -28,34 +28,34 @@ void test_rank_scans(cudf::column_view const& keys, cudf::column_view const& expected_rank, cudf::column_view const& expected_percent_rank) { - cudf::test::test_single_scan(keys, - order, - keys, - expected_dense, - cudf::make_rank_aggregation( - cudf::rank_method::DENSE, {}, cudf::null_policy::INCLUDE), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); - cudf::test::test_single_scan(keys, - order, - keys, - expected_rank, - cudf::make_rank_aggregation( - cudf::rank_method::MIN, {}, cudf::null_policy::INCLUDE), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); - cudf::test::test_single_scan(keys, - order, - keys, - expected_percent_rank, - cudf::make_rank_aggregation( - cudf::rank_method::MIN, - {}, - cudf::null_policy::INCLUDE, - {}, - cudf::rank_percentage::ONE_NORMALIZED), - cudf::null_policy::INCLUDE, - cudf::sorted::YES); + test_single_scan(keys, + order, + keys, + expected_dense, + cudf::make_rank_aggregation( + cudf::rank_method::DENSE, {}, cudf::null_policy::INCLUDE), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); + test_single_scan(keys, + order, + keys, + expected_rank, + cudf::make_rank_aggregation( + cudf::rank_method::MIN, {}, cudf::null_policy::INCLUDE), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); + test_single_scan(keys, + order, + keys, + expected_percent_rank, + cudf::make_rank_aggregation( + cudf::rank_method::MIN, + {}, + cudf::null_policy::INCLUDE, + {}, + cudf::rank_percentage::ONE_NORMALIZED), + cudf::null_policy::INCLUDE, + cudf::sorted::YES); } struct groupby_rank_scan_test : public cudf::test::BaseFixture {};