This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/main/pr-11455-45605003b8d541e008983b80d7383d5fd81bd787
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git

commit 42aae335ebc666a5ef52e14477a51d13be3d025e
Author: Matt Butrovich <[email protected]>
AuthorDate: Thu Oct 8 18:02:51 2026 +0000

    test(arrow-buffer): generate negative operands in `test_i256_fuzz` (#11455)
    
    # Which issue does this PR close?
    
    - Closes #11452.
    
    # Rationale for this change
    
    See #11452.
    
    # What changes are included in this PR?
    
    The length range is now `0..=32`, and each operand is negated with
    probability 1/2. The negation covers small negative values, which random
    bytes almost never produce.
    
    # Are these changes tested?
    
    This PR only changes a test. With `i256::div_rem` changed to return a
    floored remainder, the old `test_i256_fuzz` passes and the new one
    fails. On `main` the new test passes.
    
    # Are there any significant user-facing changes?
    
    No.
    
    ## AI Disclosure
    
    I wrote this PR with help from Claude but understand and support the
    core approach, implementation, and test coverage.
---
 arrow-buffer/src/bigint/mod.rs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arrow-buffer/src/bigint/mod.rs b/arrow-buffer/src/bigint/mod.rs
index 21f7664207..d9c16087d5 100644
--- a/arrow-buffer/src/bigint/mod.rs
+++ b/arrow-buffer/src/bigint/mod.rs
@@ -1739,14 +1739,20 @@ mod tests {
 
         for _ in 0..1000 {
             let mut l = [0_u8; 32];
-            let len = rng.random_range(0..32);
+            let len = rng.random_range(0..=32);
             l.iter_mut().take(len).for_each(|x| *x = rng.random());
 
             let mut r = [0_u8; 32];
-            let len = rng.random_range(0..32);
+            let len = rng.random_range(0..=32);
             r.iter_mut().take(len).for_each(|x| *x = rng.random());
 
-            test_ops(i256::from_le_bytes(l), i256::from_le_bytes(r))
+            // Random bytes almost never produce a negative value of small 
magnitude
+            let l = i256::from_le_bytes(l);
+            let r = i256::from_le_bytes(r);
+            let l = if rng.random() { l.wrapping_neg() } else { l };
+            let r = if rng.random() { r.wrapping_neg() } else { r };
+
+            test_ops(l, r)
         }
     }
 

Reply via email to