Skip to content

Commit

Permalink
rename many-strings-test to replace-test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwendt committed Jun 13, 2024
1 parent 746ea82 commit 494a119
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ ConfigureTest(
large_strings/concatenate_tests.cpp
large_strings/case_tests.cpp
large_strings/large_strings_fixture.cpp
large_strings/many_strings_tests.cpp
large_strings/merge_tests.cpp
large_strings/parquet_tests.cpp
large_strings/replace_tests.cpp
large_strings/reshape_tests.cpp
large_strings/split_strings_tests.cpp
GPUS 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@
#include <cudf/concatenate.hpp>
#include <cudf/copying.hpp>
#include <cudf/scalar/scalar.hpp>
#include <cudf/strings/combine.hpp>
#include <cudf/strings/replace.hpp>
#include <cudf/strings/strings_column_view.hpp>
#include <cudf/table/table_view.hpp>

#include <limits>
#include <vector>

struct StringsManyTest : public cudf::test::StringsLargeTest {};
struct ReplaceTest : public cudf::test::StringsLargeTest {};

TEST_F(StringsManyTest, Replace)
TEST_F(ReplaceTest, ReplaceLong)
{
auto const expected = this->very_long_column();
auto const view = cudf::column_view(expected);
Expand Down Expand Up @@ -65,3 +66,22 @@ TEST_F(StringsManyTest, Replace)
CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(c, expected);
}
}

TEST_F(ReplaceTest, ReplaceWide)
{
auto const expected = this->long_column();
auto const view = cudf::column_view(expected);
auto const multiplier = 10;
auto const separator = cudf::string_scalar("|");
auto const input = cudf::strings::concatenate(
cudf::table_view(std::vector<cudf::column_view>(multiplier, view)), separator);

auto const input_view = cudf::strings_column_view(input->view());
auto const target = cudf::string_scalar("3"); // fake the actual replace;
auto const repl = cudf::string_scalar("3"); // logic still builds the output
auto result = cudf::strings::replace(input_view, target, repl);

auto sv = cudf::strings_column_view(result->view());
EXPECT_EQ(sv.offsets().type(), cudf::data_type{cudf::type_id::INT64});
CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(input->view(), result->view());
}

0 comments on commit 494a119

Please sign in to comment.