mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Improves peephole_truthy_and test case
This commit is contained in:
parent
172e208c6a
commit
804eb3ef9d
@ -970,13 +970,26 @@ BOOST_AUTO_TEST_CASE(peephole_swap_comparison)
|
||||
BOOST_AUTO_TEST_CASE(peephole_truthy_and)
|
||||
{
|
||||
AssemblyItems items{
|
||||
AssemblyItem(Tag, 1),
|
||||
Instruction::BALANCE,
|
||||
u256(0),
|
||||
Instruction::NOT,
|
||||
Instruction::AND
|
||||
Instruction::AND,
|
||||
AssemblyItem(PushTag, 1),
|
||||
Instruction::JUMPI
|
||||
};
|
||||
AssemblyItems expectation{
|
||||
AssemblyItem(Tag, 1),
|
||||
Instruction::BALANCE,
|
||||
AssemblyItem(PushTag, 1),
|
||||
Instruction::JUMPI
|
||||
};
|
||||
PeepholeOptimiser peepOpt(items);
|
||||
BOOST_REQUIRE(peepOpt.optimise());
|
||||
BOOST_CHECK(items.empty());
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||
items.begin(), items.end(),
|
||||
expectation.begin(), expectation.end()
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jumpdest_removal)
|
||||
|
Loading…
Reference in New Issue
Block a user