Skip to content

Commit

Permalink
Audited Release v1.0.0 w/ full passing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
clowestab committed Feb 14, 2025
1 parent f60a38b commit 317c58c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unruggable/gateways",
"version": "0.1.5",
"version": "1.0.0",
"description": "Trustless Ethereum Multichain CCIP-Read Gateway",
"publishConfig": {
"access": "public"
Expand Down
20 changes: 16 additions & 4 deletions test/components/GatewayFetcher.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,25 @@ contract TestGatewayFetcher is Test {
evalUint256(R(1).push(a).push(b).times(), a * b);
}
}
// https://book.getfoundry.sh/cheatcodes/expect-revert
// https://book.getfoundry.sh/forge/forge-std?highlight=panic#standard-libraries
function testFuzz_divide(uint256 a, uint256 b) external {
if (b == 0) vm.expectRevert();
evalUint256(R(1).push(a).push(b).divide(), a / b);
GatewayRequest memory r = R(1).push(a).push(b).divide();
if (b == 0) {
vm.expectRevert(stdError.divisionError);
evalRequest(r.setOutput(0));
} else {
evalUint256(r, a/b);
}
}
function testFuzz_mod(uint256 a, uint256 b) external {
if (b == 0) vm.expectRevert();
evalUint256(R(1).push(a).push(b).mod(), a % b);
GatewayRequest memory r = R(1).push(a).push(b).mod();
if (b == 0) {
vm.expectRevert(stdError.divisionError);
evalRequest(r.setOutput(0));
} else {
evalUint256(r, a % b);
}
}
function testFuzz_pow(uint256 a, uint256 b) external view {
unchecked {
Expand Down

0 comments on commit 317c58c

Please sign in to comment.