pitrou commented on a change in pull request #7784:
URL: https://github.com/apache/arrow/pull/7784#discussion_r467869720
##########
File path: cpp/src/arrow/compute/kernels/test_util.cc
##########
@@ -33,68 +33,109 @@ namespace compute {
namespace {
-void CheckScalarUnaryNonRecursive(const std::string& func_name,
- const std::shared_ptr<Array>& input,
- const std::shared_ptr<Array>& expected,
- const FunctionOptions* options) {
- ASSERT_OK_AND_ASSIGN(Datum out, CallFunction(func_name, {input}, options));
+template <typename T>
+std::vector<Datum> GetDatums(const std::vector<T>& inputs) {
+ std::vector<Datum> datums;
+ for (const auto& input : inputs) {
+ datums.emplace_back(input);
+ }
+ return datums;
+}
+
+void CheckScalarNonRecursive(const std::string& func_name,
+ const std::vector<std::shared_ptr<Array>>& inputs,
+ const std::shared_ptr<Array>& expected,
+ const FunctionOptions* options) {
+ ASSERT_OK_AND_ASSIGN(Datum out, CallFunction(func_name, GetDatums(inputs),
options));
std::shared_ptr<Array> actual = std::move(out).make_array();
ASSERT_OK(actual->ValidateFull());
AssertArraysEqual(*expected, *actual, /*verbose=*/true);
}
-} // namespace
+template <typename... SliceArgs>
+std::vector<std::shared_ptr<Array>> SliceAll(
+ const std::vector<std::shared_ptr<Array>>& inputs, SliceArgs...
slice_args) {
+ std::vector<std::shared_ptr<Array>> sliced;
Review comment:
Good idea, thank you.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]