Adjust and add more tests

This commit is contained in:
Alex Beregszaszi
2020-08-05 11:37:04 +01:00
parent 3a617f9cf2
commit 6e381326fe
6 changed files with 68 additions and 3 deletions
+20
View File
@@ -258,6 +258,16 @@ BOOST_AUTO_TEST_CASE(arg_to_dataoffset_must_be_literal)
CHECK_ERROR(code, TypeError, "Function expects direct literals as arguments.");
}
BOOST_AUTO_TEST_CASE(arg_to_dataoffset_must_be_string_literal)
{
string code = R"(
object "outer" {
code { let y := dataoffset(0) }
}
)";
CHECK_ERROR(code, TypeError, "Function expects string literal.");
}
BOOST_AUTO_TEST_CASE(arg_to_datasize_must_be_literal)
{
string code = R"(
@@ -268,6 +278,16 @@ BOOST_AUTO_TEST_CASE(arg_to_datasize_must_be_literal)
CHECK_ERROR(code, TypeError, "Function expects direct literals as arguments.");
}
BOOST_AUTO_TEST_CASE(arg_to_datasize_must_be_string_literal)
{
string code = R"(
object "outer" {
code { let y := datasize(0) }
}
)";
CHECK_ERROR(code, TypeError, "Function expects string literal.");
}
BOOST_AUTO_TEST_CASE(args_to_datacopy_are_arbitrary)
{
string code = R"(