Skip to content

Commit

Permalink
Fix markdown text; remove infiniteGas in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
palinatolmach committed Jul 25, 2023
1 parent 3ea7732 commit b433541
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 11 deletions.
3 changes: 2 additions & 1 deletion include/kframework/foundry.md
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,8 @@ function setGas(uint256 newGas) external;
function infiniteGas() external;
```

`infiniteGas` is useful for running tests without them running out of gas. It is applied by default.
`infiniteGas` is useful for running tests without them running out of gas.
It is applied by default.

```{.k .bytes .symbolic}
rule [foundry.call.infiniteGas]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ contract CounterTest is Test, KEVMCheats {
// }

function testIncrement() public {
kevm.infiniteGas();
counter = new Counter();
counter.setNumber(0);
counter.increment();
Expand All @@ -34,7 +33,6 @@ contract CounterTest is Test, KEVMCheats {

function testSetNumber(uint256 x) public {
//setUp();
kevm.infiniteGas();
counter = new Counter();
counter.setNumber(0);
counter.setNumber(x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "../src/KEVMCheats.sol";

contract GasTest is Test, KEVMCheats {
function testInfiniteGas() public {
kevm.infiniteGas();
// Infinite gas is used by default
uint256 gasLeftBefore = gasleft();
uint256 x = 345;
uint256 y = 928;
Expand Down
2 changes: 0 additions & 2 deletions tests/foundry/test/CounterTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ contract CounterTest is Test, KEVMCheats {
// }

function testIncrement() public {
kevm.infiniteGas();
counter = new Counter();
counter.setNumber(0);
counter.increment();
Expand All @@ -34,7 +33,6 @@ contract CounterTest is Test, KEVMCheats {

function testSetNumber(uint256 x) public {
//setUp();
kevm.infiniteGas();
counter = new Counter();
counter.setNumber(0);
counter.setNumber(x);
Expand Down
4 changes: 0 additions & 4 deletions tests/foundry/test/FreshInt.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,24 @@ contract FreshIntTest is Test, KEVMCheats {
int128 constant max = 170141183460469231731687303715884105727;

function test_uint128() public {
kevm.infiniteGas();
uint256 fresh_uint128 = uint256(kevm.freshUInt(32));
assertGe(fresh_uint128, type(uint128).min);
assertLe(fresh_uint128, type(uint128).max);
}

function test_bool() public {
kevm.infiniteGas();
uint256 fresh_uint256 = kevm.freshBool();
assertGe(fresh_uint256, 0);
assertLe(fresh_uint256, 1);
}

function test_int128() public {
kevm.infiniteGas();
int128 val = int128(uint128(kevm.freshUInt(16)));
assertGe(val, min);
assertLe(val, max);
}

function testFail_int128() public {
kevm.infiniteGas();
int128 val = int128(uint128(kevm.freshUInt(16)));
assertGt(val, max);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/foundry/test/GasTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "../src/KEVMCheats.sol";

contract GasTest is Test, KEVMCheats {
function testInfiniteGas() public {
kevm.infiniteGas();
// Infinite gas is used by default
uint256 gasLeftBefore = gasleft();
uint256 x = 345;
uint256 y = 928;
Expand Down

0 comments on commit b433541

Please sign in to comment.