mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7977 from imapp-pl/yul-ewasm-tests-imapp
Add comparison test cases for most of EVM->Ewasm translator
This commit is contained in:
commit
b53629d3d0
28
test/libyul/ewasmTranslationTests/comparison_eq.yul
Normal file
28
test/libyul/ewasmTranslationTests/comparison_eq.yul
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
sstore(0, eq(0, 0))
|
||||
sstore(1, eq(not(0), not(0)))
|
||||
sstore(2, eq(0, not(0)))
|
||||
sstore(3, eq(not(0), 0xffffffffffffffff))
|
||||
sstore(4, eq(0xfffffffffffffff000000000000000, 0xfffffffffffffff000000000000000))
|
||||
sstore(5, eq(0x000000000000000fffffffffffffff, 0xfffffffffffffff000000000000000))
|
||||
sstore(6, eq(0xfffffffffffffff000000000000000fffffffffffffff, 0xfffffffffffffff000000000000000fffffffffffffff))
|
||||
sstore(7, eq(0xfffffffffffffff000000000000000fffffffffffffff, 0x000000000000000ffffffffffffffffffffffffffffff))
|
||||
sstore(8, eq(
|
||||
0xaaaaaaaaaaaaaaaa5555555555555555ffffffffffffffff0000000000000000,
|
||||
0xaaaaaaaaaaaaaaaa5555555555555555ffffffffffffffff0000000000000000
|
||||
))
|
||||
sstore(9, eq(
|
||||
0xaaaaaaaaaaaaaaaa6666666666666666ffffffffffffffff0000000000000000,
|
||||
0xaaaaaaaaaaaaaaaa5555555555555555ffffffffffffffff0000000000000000
|
||||
))
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000000000000000000000000000000000009
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000006: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000008: 0000000000000000000000000000000000000000000000000000000000000001
|
36
test/libyul/ewasmTranslationTests/comparison_gt.yul
Normal file
36
test/libyul/ewasmTranslationTests/comparison_gt.yul
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
sstore(0, gt(1, 0))
|
||||
sstore(1, gt(0, 1))
|
||||
sstore(2, gt(0, 0))
|
||||
sstore(3, gt(not(0), 0xffffffffffffffff))
|
||||
sstore(4, gt(0xffffffffffffffff, not(0)))
|
||||
sstore(5, gt(not(0), not(0)))
|
||||
sstore(6, gt(not(0), 0xffffffffffffffff0000000000000000))
|
||||
sstore(7, gt(0xffffffffffffffff0000000000000000, not(0)))
|
||||
sstore(8, gt(0xffffffffffffffff0000000000000000, 0xffffffffffffffff0000000000000000))
|
||||
sstore(9, gt(not(0), 0xffffffffffffffff0000000000000000ffffffffffffffff))
|
||||
sstore(10, gt(0xffffffffffffffff0000000000000000ffffffffffffffff, not(0)))
|
||||
sstore(11, gt(0xffffffffffffffff0000000000000000ffffffffffffffff, 0xffffffffffffffff0000000000000000ffffffffffffffff))
|
||||
sstore(12, gt(not(0), 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000))
|
||||
sstore(13, gt(0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000, not(0)))
|
||||
sstore(14, gt(
|
||||
0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000,
|
||||
0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000)
|
||||
)
|
||||
sstore(15, gt(
|
||||
0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000001,
|
||||
0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000)
|
||||
)
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// Memory dump:
|
||||
// 0: 000000000000000000000000000000000000000000000000000000000000000f
|
||||
// 20: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000006: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000009: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000c: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000f: 0000000000000000000000000000000000000000000000000000000000000001
|
36
test/libyul/ewasmTranslationTests/comparison_lt.yul
Normal file
36
test/libyul/ewasmTranslationTests/comparison_lt.yul
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
sstore(0, lt(1, 0))
|
||||
sstore(1, lt(0, 1))
|
||||
sstore(2, lt(0, 0))
|
||||
sstore(3, lt(not(0), 0xffffffffffffffff))
|
||||
sstore(4, lt(0xffffffffffffffff, not(0)))
|
||||
sstore(5, lt(not(0), not(0)))
|
||||
sstore(6, lt(not(0), 0xffffffffffffffff0000000000000000))
|
||||
sstore(7, lt(0xffffffffffffffff0000000000000000, not(0)))
|
||||
sstore(8, lt(0xffffffffffffffff0000000000000000, 0xffffffffffffffff0000000000000000))
|
||||
sstore(9, lt(not(0), 0xffffffffffffffff0000000000000000ffffffffffffffff))
|
||||
sstore(10, lt(0xffffffffffffffff0000000000000000ffffffffffffffff, not(0)))
|
||||
sstore(11, lt(0xffffffffffffffff0000000000000000ffffffffffffffff, 0xffffffffffffffff0000000000000000ffffffffffffffff))
|
||||
sstore(12, lt(not(0), 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000))
|
||||
sstore(13, lt(0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000, not(0)))
|
||||
sstore(14, lt(
|
||||
0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000,
|
||||
0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000)
|
||||
)
|
||||
sstore(15, lt(
|
||||
0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000,
|
||||
0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000001)
|
||||
)
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// Memory dump:
|
||||
// 0: 000000000000000000000000000000000000000000000000000000000000000f
|
||||
// 20: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000007: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000a: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000d: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000f: 0000000000000000000000000000000000000000000000000000000000000001
|
54
test/libyul/ewasmTranslationTests/comparison_sgt.yul
Normal file
54
test/libyul/ewasmTranslationTests/comparison_sgt.yul
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
sstore(0, sgt(0, 1))
|
||||
sstore(1, sgt(0, not(0)))
|
||||
sstore(2, sgt(0, 0))
|
||||
sstore(3, sgt(1, 2))
|
||||
sstore(4, sgt(not(0), 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe))
|
||||
sstore(5, sgt(0x8000000000000000000000000000000000000000000000000000000000000000, not(0)))
|
||||
sstore(6, sgt(not(0), 0x8000000000000000000000000000000000000000000000000000000000000000))
|
||||
sstore(7, sgt(0x7000000000000000000000000000000000000000000000000000000000000000, 1))
|
||||
sstore(8, sgt(1, 0x7000000000000000000000000000000000000000000000000000000000000000))
|
||||
sstore(9, sgt(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, not(0)))
|
||||
sstore(10, sgt(not(0), 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff))
|
||||
sstore(11, sgt(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, 1))
|
||||
sstore(12, sgt(1, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff))
|
||||
sstore(13, sgt(
|
||||
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
))
|
||||
sstore(14, sgt(
|
||||
0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
))
|
||||
sstore(15, sgt(
|
||||
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
not(0)
|
||||
))
|
||||
sstore(16, sgt(
|
||||
not(0),
|
||||
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
))
|
||||
sstore(17, sgt(
|
||||
not(0),
|
||||
0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
))
|
||||
sstore(18, sgt(
|
||||
0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
not(0)
|
||||
))
|
||||
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000000000000000000000000000000000012
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000006: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000007: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000009: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000b: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000d: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000f: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000011: 0000000000000000000000000000000000000000000000000000000000000001
|
55
test/libyul/ewasmTranslationTests/comparison_slt.yul
Normal file
55
test/libyul/ewasmTranslationTests/comparison_slt.yul
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
sstore(0, slt(0, 1))
|
||||
sstore(1, slt(0, not(0)))
|
||||
sstore(2, slt(0, 0))
|
||||
sstore(3, slt(1, 2))
|
||||
sstore(4, slt(not(0), 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe))
|
||||
sstore(5, slt(0x8000000000000000000000000000000000000000000000000000000000000000, not(0)))
|
||||
sstore(6, slt(not(0), 0x8000000000000000000000000000000000000000000000000000000000000000))
|
||||
sstore(7, slt(0x7000000000000000000000000000000000000000000000000000000000000000, 1))
|
||||
sstore(8, slt(1, 0x7000000000000000000000000000000000000000000000000000000000000000))
|
||||
sstore(9, slt(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, not(0)))
|
||||
sstore(10, slt(not(0), 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff))
|
||||
sstore(11, slt(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, 1))
|
||||
sstore(12, slt(1, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff))
|
||||
sstore(13, slt(
|
||||
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
))
|
||||
sstore(14, slt(
|
||||
0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
))
|
||||
sstore(15, slt(
|
||||
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
not(0)
|
||||
))
|
||||
sstore(16, slt(
|
||||
not(0),
|
||||
0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
))
|
||||
sstore(17, slt(
|
||||
not(0),
|
||||
0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
))
|
||||
sstore(18, slt(
|
||||
0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
not(0)
|
||||
))
|
||||
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000000000000000000000000000000000012
|
||||
// 20: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000005: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000008: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000a: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000c: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 000000000000000000000000000000000000000000000000000000000000000e: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000010: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 0000000000000000000000000000000000000000000000000000000000000012: 0000000000000000000000000000000000000000000000000000000000000001
|
Loading…
Reference in New Issue
Block a user