Skip to content

Commit

Permalink
add ufix64<->uint256 zero conversion test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Apr 30, 2024
1 parent 0bf337c commit 11c1d24
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cadence/tests/flow_evm_bridge_utils_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,21 @@ fun testDustUFix64ToUInt256Succeeds() {
let actualUIntAmount = ufix64ToUInt256(dustUFixAmount, decimals: 18)
Test.assert(actualUIntAmount == dustUIntAmount && actualUIntAmount > 0)
}

access(all)
fun testZeroUInt256ToUFix64Succeeds() {
let zeroUFixAmount: UFix64 = 0.0
let zeroUIntAmount: UInt256 = 0

let actualUFixAmount = uint256ToUFix64(zeroUIntAmount, decimals: 18)
Test.assertEqual(zeroUFixAmount, actualUFixAmount)
}

access(all)
fun testZeroUFix64ToUInt256Succeeds() {
let zeroUFixAmount: UFix64 = 0.00002547
let zeroUIntAmount: UInt256 = 25_470_000_000_000

let actualUIntAmount = ufix64ToUInt256(zeroUFixAmount, decimals: 18)
Test.assertEqual(zeroUIntAmount, actualUIntAmount)
}

0 comments on commit 11c1d24

Please sign in to comment.