Some tests.

This commit is contained in:
chriseth 2022-04-13 17:46:46 +02:00
parent c40c619daa
commit dc6eecd4ba
5 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,22 @@
{
let y := calldataload(0)
let sum := 0
let x := 0
for {} lt(x, y) { } {
// overflow check
if not(x) { revert(0, 0) }
// different way to do overflow check
if lt(add(x, 1), x) { revert(0, 0) }
sum := calldataload(add(0x20, mul(x, 0x20)))
x := add(x, 1)
}
sstore(0, sum)
}
// ----
// step: reasoningBasedSimplifier
//
// {
// let y := calldataload(0)
// let t := calldataload(32)
// if sgt(sub(y, 1), y) { if 1 { sstore(0, 1) } }
// }

View File

@ -0,0 +1,13 @@
{
let y := calldataload(0)
let x := calldataload(1)
if and(lt(x, y), iszero(not(x))) { }
}
// ----
// step: reasoningBasedSimplifier
//
// {
// let y := calldataload(0)
// let x := calldataload(1)
// if 0 { }
// }

View File

@ -0,0 +1,13 @@
{
let y := calldataload(0)
let x := calldataload(1)
if and(lt(x, y), eq(x, sub(0, 1))) { }
}
// ----
// step: reasoningBasedSimplifier
//
// {
// let y := calldataload(0)
// let x := calldataload(1)
// if 0 { }
// }

View File

@ -0,0 +1,17 @@
{
let y := calldataload(0)
let x := calldataload(1)
let _1 := lt(x, y)
let _2 := not(x)
if and(_1, _2) { }
}
// ----
// step: reasoningBasedSimplifier
//
// {
// let y := calldataload(0)
// let x := calldataload(1)
// let _1 := lt(x, y)
// let _2 := not(x)
// if and(_1, _2) { }
// }

View File

@ -0,0 +1,13 @@
{
// let y := calldataload(0)
// let x := calldataload(1)
let x := 0
if x { }
}
// ----
// step: reasoningBasedSimplifier
//
// {
// let x := 0
// if 0 { }
// }