Zaharid commented on code in PR #15208:
URL: https://github.com/apache/arrow/pull/15208#discussion_r1063276951
##########
cpp/src/gandiva/precompiled/arithmetic_ops_test.cc:
##########
@@ -629,6 +629,45 @@ TEST(TestArithmeticOps, TestSignIntFloatDouble) {
EXPECT_EQ(sign_float64(-2147483647), -1.0);
}
+TEST(TestArithmeticOps, TestAbsIntFloatDouble) {
+ // abs from int32
+ EXPECT_EQ(abs_int32(43), 43);
+ EXPECT_EQ(abs_int32(-54), 54);
+ EXPECT_EQ(abs_int32(63), 63);
+ EXPECT_EQ(abs_int32(INT32_MAX), INT32_MAX);
+ // Overflow
+ // EXPECT_EQ(abs_int32(INT32_MIN), -INT32_MIN);
+
+ // abs from int64
+ EXPECT_EQ(abs_int64(90), 90);
+ EXPECT_EQ(abs_int64(-7), 7);
+ EXPECT_EQ(abs_int64(INT64_MAX), INT64_MAX);
+ // Overflow
+ // EXPECT_EQ(abs_int64(INT64_MIN), -INT64_MIN);
+
+ // abs from floats
+ EXPECT_EQ(abs_float32(6.6f), 6.6f);
+ EXPECT_EQ(abs_float32(-6.6f), 6.6f);
+ EXPECT_EQ(abs_float32(-6.3f), 6.3f);
Review Comment:
I mostly copied the tests from the sign function. Will clean these.
--
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]