Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
dwightguth committed Aug 26, 2024
1 parent c7b643e commit 4f9c6be
Show file tree
Hide file tree
Showing 9 changed files with 371 additions and 0 deletions.
95 changes: 95 additions & 0 deletions test/regression/block.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<solidity>
<k>
.K
</k>
<current-body>
BlockTest
</current-body>
<ifaces>
.IfaceCellMap
</ifaces>
<contracts>
<contract>
<contract-id>
BlockTest
</contract-id>
<contract-state>
.Map
</contract-state>
<contract-init>
.List
</contract-init>
<contract-fns>
<contract-fn>
<contract-fn-id>
constructor
</contract-fn-id>
<contract-fn-visibility>
public
</contract-fn-visibility>
<contract-fn-arg-types>
.List
</contract-fn-arg-types>
<contract-fn-param-names>
.List
</contract-fn-param-names>
<contract-fn-return-types>
.List
</contract-fn-return-types>
<contract-fn-return-names>
.List
</contract-fn-return-names>
<contract-fn-body>
bool x = false ; { bool x = true ; require ( x , "" , .TypedVals ) ; .Statements } if ( x ) { require ( false , "" , .TypedVals ) ; .Statements } .Statements
</contract-fn-body>
</contract-fn>
</contract-fns>
<contract-events>
.ContractEventCellMap
</contract-events>
</contract>
</contracts>
<exec>
<msg-sender>
1p160
</msg-sender>
<msg-value>
0p256
</msg-value>
<tx-origin>
1p160
</tx-origin>
<this>
2p160
</this>
<this-type>
BlockTest
</this-type>
<env>
x |-> var ( 0 , bool )
</env>
<store>
0 |-> false
1 |-> true
</store>
<call-stack>
.List
</call-stack>
<live-contracts>
<live-contract>
<contract-address>
2p160
</contract-address>
<contract-type>
BlockTest
</contract-type>
<contract-storage>
.Map
</contract-storage>
</live-contract>
</live-contracts>
<next-address>
3p160
</next-address>
</exec>
</solidity>
15 changes: 15 additions & 0 deletions test/regression/block.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pragma solidity ^0.8.24;

contract BlockTest {

constructor() {
bool x = false;
{
bool x = true;
require(x, "");
}
if (x) {
require(false, "");
}
}
}
1 change: 1 addition & 0 deletions test/regression/block.txn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
create(1, 0, BlockTest, )
116 changes: 116 additions & 0 deletions test/regression/boolean.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<solidity>
<k>
.K
</k>
<current-body>
BoolTest
</current-body>
<ifaces>
.IfaceCellMap
</ifaces>
<contracts>
<contract>
<contract-id>
BoolTest
</contract-id>
<contract-state>
.Map
</contract-state>
<contract-init>
.List
</contract-init>
<contract-fns>
<contract-fn>
<contract-fn-id>
constructor
</contract-fn-id>
<contract-fn-visibility>
public
</contract-fn-visibility>
<contract-fn-arg-types>
.List
</contract-fn-arg-types>
<contract-fn-param-names>
.List
</contract-fn-param-names>
<contract-fn-return-types>
.List
</contract-fn-return-types>
<contract-fn-return-names>
.List
</contract-fn-return-names>
<contract-fn-body>
bool x = true ; if ( x || fail ( .TypedVals ) ) { .Statements } else { require ( false , "" , .TypedVals ) ; .Statements } if ( x && true ) { .Statements } else { require ( false , "" , .TypedVals ) ; .Statements } x = false ; if ( x && fail ( .TypedVals ) ) { require ( false , "" , .TypedVals ) ; .Statements } if ( x || true ) { .Statements } else { require ( false , "" , .TypedVals ) ; .Statements } .Statements
</contract-fn-body>
</contract-fn> <contract-fn>
<contract-fn-id>
fail
</contract-fn-id>
<contract-fn-visibility>
private
</contract-fn-visibility>
<contract-fn-arg-types>
.List
</contract-fn-arg-types>
<contract-fn-param-names>
.List
</contract-fn-param-names>
<contract-fn-return-types>
.List
</contract-fn-return-types>
<contract-fn-return-names>
.List
</contract-fn-return-names>
<contract-fn-body>
require ( false , "" , .TypedVals ) ; .Statements
</contract-fn-body>
</contract-fn>
</contract-fns>
<contract-events>
.ContractEventCellMap
</contract-events>
</contract>
</contracts>
<exec>
<msg-sender>
1p160
</msg-sender>
<msg-value>
0p256
</msg-value>
<tx-origin>
1p160
</tx-origin>
<this>
2p160
</this>
<this-type>
BoolTest
</this-type>
<env>
x |-> var ( 0 , bool )
</env>
<store>
0 |-> false
</store>
<call-stack>
.List
</call-stack>
<live-contracts>
<live-contract>
<contract-address>
2p160
</contract-address>
<contract-type>
BoolTest
</contract-type>
<contract-storage>
.Map
</contract-storage>
</live-contract>
</live-contracts>
<next-address>
3p160
</next-address>
</exec>
</solidity>
28 changes: 28 additions & 0 deletions test/regression/boolean.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pragma solidity ^0.8.24;

contract BoolTest {

function fail() private {
require(false, "");
}

constructor() {
bool x = true;
if (x || fail()) {
} else {
require(false, "");
}
if (x && true) {
} else {
require(false, "");
}
x = false;
if (x && fail()) {
require(false, "");
}
if (x || true) {
} else {
require(false, "");
}
}
}
1 change: 1 addition & 0 deletions test/regression/boolean.txn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
create(1, 0, BoolTest, )
94 changes: 94 additions & 0 deletions test/regression/if.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<solidity>
<k>
.K
</k>
<current-body>
IfTest
</current-body>
<ifaces>
.IfaceCellMap
</ifaces>
<contracts>
<contract>
<contract-id>
IfTest
</contract-id>
<contract-state>
.Map
</contract-state>
<contract-init>
.List
</contract-init>
<contract-fns>
<contract-fn>
<contract-fn-id>
constructor
</contract-fn-id>
<contract-fn-visibility>
public
</contract-fn-visibility>
<contract-fn-arg-types>
.List
</contract-fn-arg-types>
<contract-fn-param-names>
.List
</contract-fn-param-names>
<contract-fn-return-types>
.List
</contract-fn-return-types>
<contract-fn-return-names>
.List
</contract-fn-return-names>
<contract-fn-body>
bool x = true ; if ( x ) { .Statements } else { require ( false , "" , .TypedVals ) ; .Statements } x = false ; if ( x ) { require ( false , "" , .TypedVals ) ; .Statements } else { .Statements } if ( x ) { require ( false , "" , .TypedVals ) ; .Statements } .Statements
</contract-fn-body>
</contract-fn>
</contract-fns>
<contract-events>
.ContractEventCellMap
</contract-events>
</contract>
</contracts>
<exec>
<msg-sender>
1p160
</msg-sender>
<msg-value>
0p256
</msg-value>
<tx-origin>
1p160
</tx-origin>
<this>
2p160
</this>
<this-type>
IfTest
</this-type>
<env>
x |-> var ( 0 , bool )
</env>
<store>
0 |-> false
</store>
<call-stack>
.List
</call-stack>
<live-contracts>
<live-contract>
<contract-address>
2p160
</contract-address>
<contract-type>
IfTest
</contract-type>
<contract-storage>
.Map
</contract-storage>
</live-contract>
</live-contracts>
<next-address>
3p160
</next-address>
</exec>
</solidity>
20 changes: 20 additions & 0 deletions test/regression/if.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pragma solidity ^0.8.24;

contract IfTest {

constructor() {
bool x = true;
if (x) {
} else {
require(false, "");
}
x = false;
if (x) {
require(false, "");
} else {
}
if (x) {
require(false, "");
}
}
}
1 change: 1 addition & 0 deletions test/regression/if.txn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
create(1, 0, IfTest, )

0 comments on commit 4f9c6be

Please sign in to comment.