Skip to content

Commit

Permalink
Add zero abs test
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Sep 4, 2023
1 parent 034ade9 commit b57b8ce
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/std/src/math/int128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,8 @@ mod tests {

let b = Int128::from(-42i32);
assert_eq!(b.abs(), a);

assert_eq!(Int128::zero().abs(), Int128::zero());
assert_eq!((Int128::MIN + Int128::one()).abs(), Int128::MAX);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/std/src/math/int256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,8 @@ mod tests {

let b = Int256::from(-42i32);
assert_eq!(b.abs(), a);

assert_eq!(Int256::zero().abs(), Int256::zero());
assert_eq!((Int256::MIN + Int256::one()).abs(), Int256::MAX);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/std/src/math/int512.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,8 @@ mod tests {

let b = Int512::from(-42i32);
assert_eq!(b.abs(), a);

assert_eq!(Int512::zero().abs(), Int512::zero());
assert_eq!((Int512::MIN + Int512::one()).abs(), Int512::MAX);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/std/src/math/int64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,8 @@ mod tests {

let b = Int64::from(-42i32);
assert_eq!(b.abs(), a);

assert_eq!(Int64::zero().abs(), Int64::zero());
assert_eq!((Int64::MIN + Int64::one()).abs(), Int64::MAX);
}

Expand Down

0 comments on commit b57b8ce

Please sign in to comment.