Skip to content

Commit

Permalink
added test (don't know if it works yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
samalws-tob committed Jan 9, 2024
1 parent b78e6a7 commit 5142202
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/Tests/Integration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ integrationTests = testGroup "Solidity Integration Testing"
, ("echidna_timestamp passed", solved "echidna_timestamp") ]
, testContractV "basic/immutable.sol" (Just (>= solcV (0,6,0))) Nothing
[ ("echidna_test passed", solved "echidna_test") ]
, testContractV "basic/immutable-2.sol" (Just (>= solcV (0,6,0))) Nothing
[ ("echidna_test passed", solved "echidna_test") ]
, testContract "basic/construct.sol" Nothing
[ ("echidna_construct passed", solved "echidna_construct") ]
, testContract "basic/gasprice.sol" (Just "basic/gasprice.yaml")
Expand Down
15 changes: 15 additions & 0 deletions tests/solidity/basic/immutable-2.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "./immutable-3.sol";

contract C {
D d;
constructor() {
d = new D(0);
}
function set(uint256 n, uint256 m) external {
d = new D(n);
d.set(m);
}
function echidna_test() public returns (bool) {
return d.state();
}
}
12 changes: 12 additions & 0 deletions tests/solidity/basic/immutable-3.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
contract D {
uint256 public immutable n;
bool public state = true;
constructor(uint256 _n) {
n = _n;
}
function set(uint256 m) external {
if (n+1 != 101) revert();
if (m+1 != 104) revert();
state = false;
}
}

0 comments on commit 5142202

Please sign in to comment.