aboutsummaryrefslogtreecommitdiffstats
path: root/test/liblll/Compiler.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-10-13 09:04:36 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-10-13 09:04:36 +0800
commit15517b571d3ac4ee01af3e2e2f3fff7c5b2296c5 (patch)
tree6f89e072754834bac5f6b27c0d590c39635695fd /test/liblll/Compiler.cpp
parent81f9f86ce51d2e9b54bf76b1169f12e193c79745 (diff)
downloaddexon-solidity-15517b571d3ac4ee01af3e2e2f3fff7c5b2296c5.tar.gz
dexon-solidity-15517b571d3ac4ee01af3e2e2f3fff7c5b2296c5.tar.zst
dexon-solidity-15517b571d3ac4ee01af3e2e2f3fff7c5b2296c5.zip
lll: disallow useless PUSHn in assembly
Diffstat (limited to 'test/liblll/Compiler.cpp')
-rw-r--r--test/liblll/Compiler.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/liblll/Compiler.cpp b/test/liblll/Compiler.cpp
index 2d66bce1..77d263b8 100644
--- a/test/liblll/Compiler.cpp
+++ b/test/liblll/Compiler.cpp
@@ -121,6 +121,23 @@ BOOST_AUTO_TEST_CASE(switch_inconsistent_return_count)
BOOST_CHECK(!successCompile(sourceCode));
}
+BOOST_AUTO_TEST_CASE(disallowed_asm_instructions)
+{
+ for (unsigned i = 1; i <= 32; i++)
+ BOOST_CHECK(!successCompile("(asm PUSH" + boost::lexical_cast<string>(i) + ")"));
+}
+
+BOOST_AUTO_TEST_CASE(disallowed_functional_asm_instructions)
+{
+ for (unsigned i = 1; i <= 32; i++)
+ BOOST_CHECK(!successCompile("(PUSH" + boost::lexical_cast<string>(i) + ")"));
+ for (unsigned i = 1; i <= 16; i++)
+ BOOST_CHECK(!successCompile("(DUP" + boost::lexical_cast<string>(i) + ")"));
+ for (unsigned i = 1; i <= 16; i++)
+ BOOST_CHECK(!successCompile("(SWAP" + boost::lexical_cast<string>(i) + ")"));
+ BOOST_CHECK(!successCompile("(JUMPDEST)"));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}