Skip to content

Commit

Permalink
test: fuzzed test
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhwu committed Oct 1, 2024
1 parent 3e72d1a commit ae5ee11
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/lib/MathExt.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ contract MathExtTest is Test {
assertEq(UINT256_MAX.boundedSub(-1, 0, type(uint256).max), type(uint256).max);
}

function testBoundedSubRequiresMinLessThanMax() public {
uint256 a = 3;
int256 b = 2;
vm.expectRevert();
a.boundedSub(b, 2, 0);
function testBoundedSubRequiresMinLessThanEqualMax(uint256 a, int256 b, uint256 min, uint256 max) public {
vm.assume(min > max);
vm.expectRevert("MathExt: min must be less than or equal to max");
a.boundedSub(b, min, max);
}

/* sub(uint256 a, uint256 b) tests */
Expand Down

0 comments on commit ae5ee11

Please sign in to comment.