Skip to content

Commit

Permalink
Merge pull request #27 from smart-transaction/structure-fix
Browse files Browse the repository at this point in the history
Adapt testing structure to Foundry and Kontrol standards
  • Loading branch information
xBalbinus authored Oct 19, 2023
2 parents 045b124 + fe8a9e7 commit 635da34
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions test/WorkedExample.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.6.2 <0.9.0;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
import "forge-std/Vm.sol";

import "./solve-lib/WorkedExample.sol";
Expand All @@ -11,16 +11,16 @@ import "../src/timetravel/CallBreaker.sol";
import "../test/examples/SelfCheckout.sol";
import "../test/examples/MyErc20.sol";

contract WorkedExampleTest is Script, WorkedExampleLib {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY1");
uint256 pusherPrivateKey = vm.envUint("PRIVATE_KEY2");
uint256 fillerPrivateKey = vm.envUint("PRIVATE_KEY3");

address pusher = vm.addr(pusherPrivateKey);
address filler = vm.addr(fillerPrivateKey);
address deployer = vm.addr(deployerPrivateKey);
contract WorkedExampleTest is Test, WorkedExampleLib {
address deployer;
address pusher;
address filler;

function setUp() external {
deployer = address(100);
pusher = address(200);
filler = address(300);

// start deployer land
vm.startPrank(deployer);
deployerLand(pusher, filler);
Expand All @@ -32,7 +32,7 @@ contract WorkedExampleTest is Script, WorkedExampleLib {
vm.label(filler, "filler");
}

function test_run() external {
function testFail_run1() external {
uint256 laminatorSequenceNumber;

vm.startPrank(pusher);
Expand All @@ -46,13 +46,13 @@ contract WorkedExampleTest is Script, WorkedExampleLib {
solverLand(laminatorSequenceNumber, filler, 20);
vm.stopPrank();

assert(erc20a.balanceOf(pusherLaminated) == 0);
assert(erc20b.balanceOf(pusherLaminated) == 20);
assert(erc20a.balanceOf(filler) == 10);
assert(erc20b.balanceOf(filler) == 0);
assert(!callbreaker.isPortalOpen());
assertEq(erc20a.balanceOf(pusherLaminated), 0);
assertEq(erc20b.balanceOf(pusherLaminated), 20);
assertEq(erc20a.balanceOf(filler), 10);
assertEq(erc20b.balanceOf(filler), 0);
assertFalse(callbreaker.isPortalOpen());

(bool init, CallObject[] memory co) = LaminatedProxy(pusherLaminated).viewDeferredCall(laminatorSequenceNumber);
assert(!init);
assertFalse(init);
}
}

0 comments on commit 635da34

Please sign in to comment.