Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit fixed_point merge test #7635

Merged
merged 1 commit into from
Mar 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions cpp/tests/merge/merge_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,4 +729,36 @@ TEST_F(MergeTest, KeysWithNulls)
}
}

template <typename T>
struct FixedPointTestBothReps : public cudf::test::BaseFixture {
};

template <typename T>
using fp_wrapper = cudf::test::fixed_point_column_wrapper<T>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this using stmt outside the test and the rest are inside?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't declare template inside GTEST macros:

../../../../tests/merge/merge_test.cpp:740:3: error: a template declaration cannot appear at block scope
   template <typename T>


TYPED_TEST_CASE(FixedPointTestBothReps, cudf::test::FixedPointTypes);

TYPED_TEST(FixedPointTestBothReps, FixedPointMerge)
{
using namespace numeric;
using decimalXX = TypeParam;
using RepType = cudf::device_storage_type_t<decimalXX>;

auto const a = fp_wrapper<RepType>{{4, 22, 33, 44, 55}, scale_type{-1}};
auto const b = fp_wrapper<RepType>{{5, 7, 10}, scale_type{-1}};
auto const table_a = cudf::table_view(std::vector<cudf::column_view>{a});
auto const table_b = cudf::table_view(std::vector<cudf::column_view>{b});
auto const tables = std::vector<cudf::table_view>{table_a, table_b};

auto const key_cols = std::vector<cudf::size_type>{0};
auto const order = std::vector<cudf::order>{cudf::order::ASCENDING};

auto const exp = fp_wrapper<RepType>{{4, 5, 7, 10, 22, 33, 44, 55}, scale_type{-1}};
auto const exp_table = cudf::table_view(std::vector<cudf::column_view>{exp});

auto const result = cudf::merge(tables, key_cols, order);

CUDF_TEST_EXPECT_COLUMNS_EQUAL(exp_table.column(0), result->view().column(0));
}

CUDF_TEST_PROGRAM_MAIN()