diff options
author | Nicolás Venturo <nicolas.venturo@gmail.com> | 2018-06-18 21:49:06 +0800 |
---|---|---|
committer | Nicolás Venturo <nicolas.venturo@gmail.com> | 2018-06-20 04:09:50 +0800 |
commit | 804eb3ef9d45cd9e4f57ba9b4bd60fea36135ca2 (patch) | |
tree | a8e25aa5fb39106cd2cac98847d85b25713d951a /test | |
parent | 172e208c6aa70956389ce7efb90b64ac32140588 (diff) | |
download | dexon-solidity-804eb3ef9d45cd9e4f57ba9b4bd60fea36135ca2.tar dexon-solidity-804eb3ef9d45cd9e4f57ba9b4bd60fea36135ca2.tar.gz dexon-solidity-804eb3ef9d45cd9e4f57ba9b4bd60fea36135ca2.tar.bz2 dexon-solidity-804eb3ef9d45cd9e4f57ba9b4bd60fea36135ca2.tar.lz dexon-solidity-804eb3ef9d45cd9e4f57ba9b4bd60fea36135ca2.tar.xz dexon-solidity-804eb3ef9d45cd9e4f57ba9b4bd60fea36135ca2.tar.zst dexon-solidity-804eb3ef9d45cd9e4f57ba9b4bd60fea36135ca2.zip |
Improves peephole_truthy_and test case
Diffstat (limited to 'test')
-rw-r--r-- | test/libevmasm/Optimiser.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp index 8e4946c3..5687ffcc 100644 --- a/test/libevmasm/Optimiser.cpp +++ b/test/libevmasm/Optimiser.cpp @@ -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) |