AdamGS commented on code in PR #10363:
URL: https://github.com/apache/arrow-rs/pull/10363#discussion_r3601834878
##########
arrow-buffer/src/bigint/mod.rs:
##########
@@ -1443,6 +1532,41 @@ mod tests {
}
#[test]
+ fn test_overflowing_add() {
+ const POSITIVE_OVERFLOW: (i256, bool) =
i256::MAX.overflowing_add(i256::ONE);
+ const NEGATIVE_OVERFLOW: (i256, bool) =
i256::MIN.overflowing_add(i256::MINUS_ONE);
+
+ assert_eq!(POSITIVE_OVERFLOW, (i256::MIN, true));
+ assert_eq!(NEGATIVE_OVERFLOW, (i256::MAX, true));
+ assert_eq!(
+ i256::from_parts(u128::MAX, 0).overflowing_add(i256::ONE),
+ (i256::from_parts(0, 1), false)
+ );
+ assert_eq!(
+ i256::ONE.overflowing_add(i256::from_i128(2)),
+ (i256::from_i128(3), false)
+ );
+ }
+
+ #[test]
+ fn test_overflowing_sub() {
+ const NEGATIVE_OVERFLOW: (i256, bool) =
i256::MIN.overflowing_sub(i256::ONE);
+ const POSITIVE_OVERFLOW: (i256, bool) =
i256::MAX.overflowing_sub(i256::MINUS_ONE);
+
+ assert_eq!(NEGATIVE_OVERFLOW, (i256::MAX, true));
+ assert_eq!(POSITIVE_OVERFLOW, (i256::MIN, true));
+ assert_eq!(
+ i256::from_parts(0, 1).overflowing_sub(i256::ONE),
+ (i256::from_parts(u128::MAX, 0), false)
+ );
+ assert_eq!(
+ i256::from_i128(3).overflowing_sub(i256::from_i128(2)),
+ (i256::ONE, false)
+ );
+ }
+
+ #[test]
+ #[cfg_attr(miri, ignore)]
Review Comment:
This takes a very long time locally, I'm trying to figure out how long so
maybe a partial version of it will be useful and still usable with miri.
--
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]