pitrou commented on code in PR #46815:
URL: https://github.com/apache/arrow/pull/46815#discussion_r2153861190
##########
cpp/src/arrow/compute/kernels/scalar_string_test.cc:
##########
@@ -2241,6 +2241,32 @@ TYPED_TEST(TestStringKernels, PadUTF8) {
CallFunction("utf8_lpad", {input},
&options_bad));
}
+TYPED_TEST(TestStringKernels, Utf8ZFill) {
+ PadOptions options{/*width=*/3, "0"};
+ this->CheckUnary("utf8_zfill", R"(["A", "AB", "ABC", null])", this->type(),
+ R"(["00A", "0AB", "ABC", null])", &options);
+
+ options.width = 4;
+ this->CheckUnary("utf8_zfill", R"(["-1", "+1", "1"])", this->type(),
+ R"(["-001", "+001", "0001"])", &options);
+
+ // width smaller than string → no padding
+ options.width = 2;
+ this->CheckUnary("utf8_zfill", R"(["AB", "-12", "+12", "XYZ"])",
this->type(),
+ R"(["AB", "-12", "+12", "XYZ"])", &options);
+
Review Comment:
Also, can you add tests with non-ASCII characters (both in padding string
and input strings)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]