js8544 commented on code in PR #36289:
URL: https://github.com/apache/arrow/pull/36289#discussion_r1276116743
##########
cpp/src/arrow/compute/kernels/scalar_round_arithmetic_test.cc:
##########
@@ -1014,21 +1031,70 @@ TYPED_TEST(TestUnaryRoundSigned, Round) {
this->SetRoundNdigits(0);
for (const auto& round_mode : kRoundModes) {
this->SetRoundMode(round_mode);
- this->AssertUnaryOp(Round, values, ArrayFromJSON(float64(), values));
+ this->AssertUnaryOp(Round, values, ArrayFromJSON(this->type_singleton(),
values));
}
// Test different round N-digits for nearest rounding mode
std::vector<std::pair<int64_t, std::string>> ndigits_and_expected{{
- {-2, "[0.0, 0.0, -0.0, -100, 100]"},
- {-1, "[0.0, 0.0, -10, -50, 120]"},
+ {-2, "[0, 0, -0, -100, 100]"},
+ {-1, "[0, 0, -10, -50, 120]"},
{0, values},
{1, values},
{2, values},
}};
this->SetRoundMode(RoundMode::HALF_TOWARDS_INFINITY);
for (const auto& pair : ndigits_and_expected) {
this->SetRoundNdigits(pair.first);
- this->AssertUnaryOp(Round, values, ArrayFromJSON(float64(), pair.second));
+ this->AssertUnaryOp(Round, values,
+ ArrayFromJSON(this->type_singleton(), pair.second));
+ }
+
+ // Test different rounding mode
+ // skip int8 because of its small range
+ if constexpr (!std::is_same_v<TypeParam, Int8Type>) {
+ std::string values("[0, 1, -13, -50, 115, -176, 200, 250]");
Review Comment:
I kept -50 and added -150, so that no two options result in identical
results. (Changing -50 to -150 would make HALF_TO_ODD and HALF_UP the same).
--
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]