Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Commit 84f5cf3

Browse files
Merge pull request #91 from morpho-dao/fix/test-safe-cast
Correct testing behavior for safe cast
2 parents 0775956 + c963b33 commit 84f5cf3

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

test-foundry/TestCommonHeapOrdering.t.sol

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,17 @@ abstract contract TestCommonHeapOrdering is Test {
336336
assertEq(heap.indexOf(accounts[3]), 3);
337337
}
338338

339-
function testOverflowNewValue() public {
339+
function testOverflowNewValue(uint256 value) public {
340+
vm.assume(value > type(uint96).max);
341+
340342
vm.expectRevert("SafeCast: value doesn't fit in 96 bits");
341-
update(accounts[0], 0, uint256(type(uint128).max));
343+
update(accounts[0], 0, value);
342344
}
343345

344-
function testOverflowFormerValue() public {
346+
function testOverflowFormerValue(uint256 value) public {
347+
vm.assume(value > type(uint96).max);
348+
345349
vm.expectRevert("SafeCast: value doesn't fit in 96 bits");
346-
update(accounts[0], uint256(type(uint128).max), 0);
350+
update(accounts[0], value, 0);
347351
}
348352
}

0 commit comments

Comments
 (0)