Skip to content

Commit

Permalink
Add a second test to ExternalLibTest
Browse files Browse the repository at this point in the history
  • Loading branch information
palinatolmach committed Dec 15, 2024
1 parent 84ea0b0 commit 76fe7c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tests/integration/test-data/foundry-prove-all
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ ExpectRevertTest.testFail_ExpectRevert_failAndSuccess()
ExpectRevertTest.testFail_expectRevert_false()
ExpectRevertTest.testFail_expectRevert_multipleReverts()
ExternalLibTest.testSquare(uint256)
ExternalLibTest.testSum(uint256,uint256)
FeeTest.test_fee_setup()
FfiTest.testffi()
FfiTest.testFFIFOO()
Expand Down
1 change: 1 addition & 0 deletions src/tests/integration/test-data/foundry-prove-skip-legacy
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ ExpectRevertTest.testFail_ExpectRevert_failAndSuccess()
ExpectRevertTest.testFail_expectRevert_false()
ExpectRevertTest.testFail_expectRevert_multipleReverts()
ExternalLibTest.testSquare(uint256)
ExternalLibTest.testSum(uint256,uint256)
FeeTest.test_fee_setup()
FfiTest.testffi()
FfiTest.testFFIFOO()
Expand Down
10 changes: 10 additions & 0 deletions src/tests/integration/test-data/foundry/test/ExternalLibTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ library SimpleMath {
function square(uint256 x) public pure returns (uint256) {
return x * x;
}

function sum(uint256 a, uint256 b) external pure returns (uint256 res) {
res = a + b;
}
}

contract ExternalLibTest is Test {
Expand All @@ -24,4 +28,10 @@ contract ExternalLibTest is Test {
vm.assume(n <= type(uint128).max);
assertEq(SimpleMath.square(n), n * n);
}

function testSum(uint256 x, uint256 y) public {
vm.assume(x <= type(uint128).max);
vm.assume(y <= type(uint128).max);
assertEq(SimpleMath.sum(x, y), 10);
}
}

0 comments on commit 76fe7c8

Please sign in to comment.