Files
smom-dbis-138/test/hybx-omnl/PolicyMath.t.sol

25 lines
771 B
Solidity
Raw Normal View History

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Test} from "forge-std/Test.sol";
import {PolicyMath} from "../../contracts/hybx-omnl/PolicyMath.sol";
contract PolicyMathTest is Test {
function testMinReservesCeil() public pure {
// ceil(1.2 * 10) = 12
assertEq(PolicyMath.minReservesForM0(10), 12);
// ceil(1.2 * 1) = 2 (1.2 rounded up)
assertEq(PolicyMath.minReservesForM0(1), 2);
}
function testMaxM1() public pure {
assertEq(PolicyMath.maxM1ForM0(100), 500);
}
function testCompliant() public pure {
assertTrue(PolicyMath.isCompliant(100, 400, 120));
assertFalse(PolicyMath.isCompliant(100, 600, 120));
assertFalse(PolicyMath.isCompliant(100, 400, 119));
}
}