mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-11-02 04:17:02 +00:00
Closes #52. Fix test error "attempt to shift right with overflow".
Use wrapping function to directly disable integer overflow protection.
This commit is contained in:
@@ -656,9 +656,9 @@ mod test {
|
|||||||
for i in 0..60 {
|
for i in 0..60 {
|
||||||
let num = rng.gen();
|
let num = rng.gen();
|
||||||
let a = UInt32::constant(num).shr(i);
|
let a = UInt32::constant(num).shr(i);
|
||||||
let b = UInt32::constant(num >> i);
|
let b = UInt32::constant(num.wrapping_shr(i as u32));
|
||||||
|
|
||||||
assert_eq!(a.value.unwrap(), num >> i);
|
assert_eq!(a.value.unwrap(), num.wrapping_shr(i as u32));
|
||||||
|
|
||||||
assert_eq!(a.bits.len(), b.bits.len());
|
assert_eq!(a.bits.len(), b.bits.len());
|
||||||
for (a, b) in a.bits.iter().zip(b.bits.iter()) {
|
for (a, b) in a.bits.iter().zip(b.bits.iter()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user