Skip to content

Commit

Permalink
Decimal/256: Add one more testcase to increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ueco-jb committed Jul 11, 2022
1 parent 94002c2 commit fa4d63c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/std/src/math/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,10 @@ mod tests {

#[test]
fn decimal_saturating_pow() {
assert_eq!(
Decimal::percent(400).saturating_pow(2u32),
Decimal::percent(1600)
);
assert_eq!(Decimal::MAX.saturating_pow(2u32), Decimal::MAX);
}
}
4 changes: 4 additions & 0 deletions packages/std/src/math/decimal256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2016,6 +2016,10 @@ mod tests {

#[test]
fn decimal_saturating_pow() {
assert_eq!(
Decimal::percent(400).saturating_pow(2u32),
Decimal::percent(1600)
);
assert_eq!(Decimal::MAX.saturating_pow(2u32), Decimal::MAX);
}
}

0 comments on commit fa4d63c

Please sign in to comment.