New tests for switch and if.

This commit is contained in:
chriseth 2022-03-16 18:58:43 +01:00
parent 98dbfa783e
commit bfaaf6c2f3
8 changed files with 191 additions and 0 deletions

View File

@ -0,0 +1,26 @@
{
let x := calldataload(1)
mstore(0, x)
if calldataload(0)
{ x := 7 mstore(0, 2) }
sstore(0, mload(0))
}
// ----
// step: loadResolver
//
// {
// {
// let x := calldataload(1)
// let _2 := 0
// mstore(_2, x)
// if calldataload(_2)
// {
// x := 7
// mstore(_2, 2)
// }
// sstore(_2, mload(_2))
// }
// }

View File

@ -0,0 +1,27 @@
{
let x := calldataload(1)
mstore(0, x)
if calldataload(0)
{ x := 7 mstore(0, 2) revert(0, 0x20) }
sstore(0, mload(0))
}
// ----
// step: loadResolver
//
// {
// {
// let x := calldataload(1)
// let _2 := 0
// mstore(_2, x)
// if calldataload(_2)
// {
// x := 7
// mstore(_2, 2)
// revert(_2, 0x20)
// }
// sstore(_2, x)
// }
// }

View File

@ -0,0 +1,25 @@
{
let x := calldataload(1)
switch calldataload(0)
case 0 { revert(0, 0) }
default { mstore(0, x) x := 7 }
sstore(0, mload(0))
}
// ----
// step: loadResolver
//
// {
// {
// let x := calldataload(1)
// let _2 := 0
// switch calldataload(_2)
// case 0 { revert(_2, _2) }
// default {
// mstore(_2, x)
// x := 7
// }
// sstore(_2, mload(_2))
// }
// }

View File

@ -0,0 +1,25 @@
{
let x := calldataload(1)
switch calldataload(0)
case 0 { x := 7 revert(0, 0) }
default { mstore(0, x) }
sstore(0, mload(0))
}
// ----
// step: loadResolver
//
// {
// {
// let x := calldataload(1)
// let _2 := 0
// switch calldataload(_2)
// case 0 {
// x := 7
// revert(_2, _2)
// }
// default { mstore(_2, x) }
// sstore(_2, x)
// }
// }

View File

@ -0,0 +1,22 @@
{
let x := calldataload(1)
switch calldataload(0)
case 0 { mstore(0, x) }
default { mstore(0, x) }
sstore(0, mload(0))
}
// ----
// step: loadResolver
//
// {
// {
// let x := calldataload(1)
// let _2 := 0
// switch calldataload(_2)
// case 0 { mstore(_2, x) }
// default { mstore(_2, x) }
// sstore(_2, x)
// }
// }

View File

@ -0,0 +1,22 @@
{
let x := calldataload(1)
switch calldataload(0)
case 0 { revert(0, 0) }
default { mstore(0, x) }
sstore(0, mload(0))
}
// ----
// step: loadResolver
//
// {
// {
// let x := calldataload(1)
// let _2 := 0
// switch calldataload(_2)
// case 0 { revert(_2, _2) }
// default { mstore(_2, x) }
// sstore(_2, x)
// }
// }

View File

@ -0,0 +1,22 @@
{
let x := calldataload(1)
switch calldataload(0)
case 0 { mstore(0, x) }
case 1 { mstore(0, x) }
sstore(0, mload(0))
}
// ----
// step: loadResolver
//
// {
// {
// let x := calldataload(1)
// let _2 := 0
// switch calldataload(_2)
// case 0 { mstore(_2, x) }
// case 1 { mstore(_2, x) }
// sstore(_2, mload(_2))
// }
// }

View File

@ -0,0 +1,22 @@
{
let x := calldataload(1)
switch calldataload(0)
case 0 { revert(0, 0) }
case 1 { mstore(0, x) }
sstore(0, mload(0))
}
// ----
// step: loadResolver
//
// {
// {
// let x := calldataload(1)
// let _2 := 0
// switch calldataload(_2)
// case 0 { revert(_2, _2) }
// case 1 { mstore(_2, x) }
// sstore(_2, mload(_2))
// }
// }