Add Halmos support for formal verification (#5034)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
@ -8,18 +8,18 @@ import {Math} from "../../../contracts/utils/math/Math.sol";
|
||||
import {SignedMath} from "../../../contracts/utils/math/SignedMath.sol";
|
||||
|
||||
contract SignedMathTest is Test {
|
||||
function testSelect(bool f, int256 a, int256 b) public {
|
||||
function testSymbolicTernary(bool f, int256 a, int256 b) public {
|
||||
assertEq(SignedMath.ternary(f, a, b), f ? a : b);
|
||||
}
|
||||
|
||||
// MIN & MAX
|
||||
function testMinMax(int256 a, int256 b) public {
|
||||
function testSymbolicMinMax(int256 a, int256 b) public {
|
||||
assertEq(SignedMath.min(a, b), a < b ? a : b);
|
||||
assertEq(SignedMath.max(a, b), a > b ? a : b);
|
||||
}
|
||||
|
||||
// MIN
|
||||
function testMin(int256 a, int256 b) public {
|
||||
function testSymbolicMin(int256 a, int256 b) public {
|
||||
int256 result = SignedMath.min(a, b);
|
||||
|
||||
assertLe(result, a);
|
||||
@ -28,7 +28,7 @@ contract SignedMathTest is Test {
|
||||
}
|
||||
|
||||
// MAX
|
||||
function testMax(int256 a, int256 b) public {
|
||||
function testSymbolicMax(int256 a, int256 b) public {
|
||||
int256 result = SignedMath.max(a, b);
|
||||
|
||||
assertGe(result, a);
|
||||
@ -69,7 +69,7 @@ contract SignedMathTest is Test {
|
||||
}
|
||||
|
||||
// ABS
|
||||
function testAbs(int256 a) public {
|
||||
function testSymbolicAbs(int256 a) public {
|
||||
uint256 result = SignedMath.abs(a);
|
||||
|
||||
unchecked {
|
||||
|
||||
Reference in New Issue
Block a user