infrastructure-upgrade/lib/v3-core/contracts/test/UnsafeMathEchidnaTest.sol
T-Hax 735546619e
init
Signed-off-by: T-Hax <>
2023-04-08 18:46:18 +00:00

18 lines
441 B
Solidity

// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
import '../libraries/UnsafeMath.sol';
contract UnsafeMathEchidnaTest {
function checkDivRoundingUp(uint256 x, uint256 d) external pure {
require(d > 0);
uint256 z = UnsafeMath.divRoundingUp(x, d);
uint256 diff = z - (x / d);
if (x % d == 0) {
assert(diff == 0);
} else {
assert(diff == 1);
}
}
}