aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul/ObjectParser.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-21 00:39:52 +0800
committerchriseth <chris@ethereum.org>2019-01-08 00:23:38 +0800
commitace601b8f6ebe8097b9c587c96494058d51b3e8f (patch)
tree9e4827959c1b977b9f986ab72d79b8a3573fe854 /test/libyul/ObjectParser.cpp
parent5b73c2ae3bce09442572b5401a7bcccc2ffe7590 (diff)
downloaddexon-solidity-ace601b8f6ebe8097b9c587c96494058d51b3e8f.tar
dexon-solidity-ace601b8f6ebe8097b9c587c96494058d51b3e8f.tar.gz
dexon-solidity-ace601b8f6ebe8097b9c587c96494058d51b3e8f.tar.bz2
dexon-solidity-ace601b8f6ebe8097b9c587c96494058d51b3e8f.tar.lz
dexon-solidity-ace601b8f6ebe8097b9c587c96494058d51b3e8f.tar.xz
dexon-solidity-ace601b8f6ebe8097b9c587c96494058d51b3e8f.tar.zst
dexon-solidity-ace601b8f6ebe8097b9c587c96494058d51b3e8f.zip
Tests.
Diffstat (limited to 'test/libyul/ObjectParser.cpp')
-rw-r--r--test/libyul/ObjectParser.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/libyul/ObjectParser.cpp b/test/libyul/ObjectParser.cpp
index bb88e4da..13a95788 100644
--- a/test/libyul/ObjectParser.cpp
+++ b/test/libyul/ObjectParser.cpp
@@ -250,6 +250,36 @@ BOOST_AUTO_TEST_CASE(to_string)
BOOST_CHECK_EQUAL(asmStack.print(), expectation);
}
+BOOST_AUTO_TEST_CASE(arg_to_dataoffset_must_be_literal)
+{
+ string code = R"(
+ object "outer" {
+ code { let x := "outer" let y := dataoffset(x) }
+ }
+ )";
+ CHECK_ERROR(code, TypeError, "Function expects direct literals as arguments.");
+}
+
+BOOST_AUTO_TEST_CASE(arg_to_datasize_must_be_literal)
+{
+ string code = R"(
+ object "outer" {
+ code { let x := "outer" let y := datasize(x) }
+ }
+ )";
+ CHECK_ERROR(code, TypeError, "Function expects direct literals as arguments.");
+}
+
+BOOST_AUTO_TEST_CASE(args_to_datacopy_are_arbitrary)
+{
+ string code = R"(
+ object "outer" {
+ code { let x := 0 let y := 2 let s := 3 datacopy(x, y, s) }
+ }
+ )";
+ BOOST_CHECK(successParse(code));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}