bkmgit commented on a change in pull request #11882: URL: https://github.com/apache/arrow/pull/11882#discussion_r767473378
########## File path: cpp/src/arrow/compute/kernels/scalar_compare_test.cc ########## @@ -1850,5 +1851,154 @@ TEST(TestMaxElementWiseMinElementWise, CommonTemporal) { ResultWith(ScalarFromJSON(date64(), "86400000"))); } +template <typename ArrowType> +static void ValidateBetween(const Datum& val, const Datum& lhs, const Datum& rhs, + const Datum& expected) { + ASSERT_OK_AND_ASSIGN(Datum result, Between(val, lhs, rhs)); + AssertArraysEqual(*expected.make_array(), *result.make_array(), + /*verbose=*/true); +} + +template <typename ArrowType> +static void ValidateBetween(const char* value_str, const Datum& lhs, const Datum& rhs, + const char* expected_str) { + auto value = ArrayFromJSON(TypeTraits<ArrowType>::type_singleton(), value_str); + auto expected = ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), expected_str); + ValidateBetween<ArrowType>(value, lhs, rhs, expected); +} + +template <> +void ValidateBetween<StringType>(const char* value_str, const Datum& lhs, + const Datum& rhs, const char* expected_str) { + auto value = ArrayFromJSON(utf8(), value_str); + auto expected = ArrayFromJSON(TypeTraits<BooleanType>::type_singleton(), expected_str); + ValidateBetween<StringType>(value, lhs, rhs, expected); +} + +template <typename ArrowType> +class TestNumericBetweenKernel : public ::testing::Test {}; + +TYPED_TEST_SUITE(TestNumericBetweenKernel, NumericArrowTypes); +TYPED_TEST(TestNumericBetweenKernel, SimpleBetweenArrayScalarScalar) { Review comment: Ok -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org