Skip to content

Commit

Permalink
Add test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Tai Le Manh <[email protected]>
  • Loading branch information
tlm365 committed Dec 28, 2024
1 parent 7b7af02 commit 5f2a5a6
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions arrow-string/src/regexp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,40 +717,64 @@ mod tests {

test_match_scalar_pattern!(
match_scalar_pattern_string_with_flags,
vec![Some("abc-005-def"), Some("X-7-5"), Some("X545"), None],
vec![
Some("abc-005-def"),
Some("x-7-5"),
Some("X-0-Y"),
Some("X545"),
None
],
r"x.*-(\d*)-.*",
Some("i"),
StringArray,
GenericStringBuilder<i32>,
[None, Some("7"), None, None]
[None, Some("7"), Some("0"), None, None]
);
test_match_scalar_pattern!(
match_scalar_pattern_stringview_with_flags,
vec![Some("abc-005-def"), Some("X-7-5"), Some("X545"), None],
vec![
Some("abc-005-def"),
Some("x-7-5"),
Some("X-0-Y"),
Some("X545"),
None
],
r"x.*-(\d*)-.*",
Some("i"),
StringViewArray,
StringViewBuilder,
[None, Some("7"), None, None]
[None, Some("7"), Some("0"), None, None]
);

test_match_scalar_pattern!(
match_scalar_pattern_string_no_flags,
vec![Some("abc-005-def"), Some("x-7-5"), Some("X545"), None],
vec![
Some("abc-005-def"),
Some("x-7-5"),
Some("X-0-Y"),
Some("X545"),
None
],
r"x.*-(\d*)-.*",
None::<&str>,
StringArray,
GenericStringBuilder<i32>,
[None, Some("7"), None, None]
[None, Some("7"), None, None, None]
);
test_match_scalar_pattern!(
match_scalar_pattern_stringview_no_flags,
vec![Some("abc-005-def"), Some("x-7-5"), Some("X545"), None],
vec![
Some("abc-005-def"),
Some("x-7-5"),
Some("X-0-Y"),
Some("X545"),
None
],
r"x.*-(\d*)-.*",
None::<&str>,
StringViewArray,
StringViewBuilder,
[None, Some("7"), None, None]
[None, Some("7"), None, None, None]
);

macro_rules! test_match_scalar_no_pattern {
Expand Down

0 comments on commit 5f2a5a6

Please sign in to comment.