Skip to content

Commit

Permalink
add zero-length match gtest
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwendt committed May 2, 2022
1 parent ba417d4 commit f287381
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cpp/tests/strings/replace_regex_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ TEST_F(StringsReplaceRegexTest, WordBoundary)
CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*results, expected);
}

TEST_F(StringsReplaceRegexTest, ZeroLengthMatch)
{
cudf::test::strings_column_wrapper input({"DD", "zéz", "DsDs", ""});
auto repl = cudf::string_scalar("_");
auto results = cudf::strings::replace_re(cudf::strings_column_view(input), "D*", repl);
auto expected = cudf::test::strings_column_wrapper({"__", "_z_é_z_", "__s__s_", "_"});
CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*results, expected);
results = cudf::strings::replace_re(cudf::strings_column_view(input), "D?s?", repl);
expected = cudf::test::strings_column_wrapper({"___", "_z_é_z_", "___", "_"});
CUDF_TEST_EXPECT_COLUMNS_EQUIVALENT(*results, expected);
}

TEST_F(StringsReplaceRegexTest, Multiline)
{
auto const multiline = cudf::strings::regex_flags::MULTILINE;
Expand Down

0 comments on commit f287381

Please sign in to comment.