Remove old boost tests from libyul/ObjectParser

This commit is contained in:
Alex Beregszaszi 2020-08-05 00:15:05 +01:00
parent 291c359ee9
commit 0a8bc861b2

View File

@ -118,21 +118,6 @@ BOOST_AUTO_TEST_CASE(empty_code)
BOOST_CHECK(successParse("{ }"));
}
BOOST_AUTO_TEST_CASE(object_with_empty_code)
{
BOOST_CHECK(successParse("object \"a\" { code { } }"));
}
BOOST_AUTO_TEST_CASE(non_object)
{
CHECK_ERROR("code {}", ParserError, "Expected keyword \"object\"");
}
BOOST_AUTO_TEST_CASE(empty_name)
{
CHECK_ERROR("object \"\" { code {} }", ParserError, "Object name cannot be empty");
}
BOOST_AUTO_TEST_CASE(recursion_depth)
{
string input;
@ -144,77 +129,6 @@ BOOST_AUTO_TEST_CASE(recursion_depth)
CHECK_ERROR(input, ParserError, "recursion");
}
BOOST_AUTO_TEST_CASE(object_with_code)
{
BOOST_CHECK(successParse("object \"a\" { code { let x := mload(0) sstore(0, x) } }"));
}
BOOST_AUTO_TEST_CASE(object_with_code_and_data)
{
BOOST_CHECK(successParse("object \"a\" { code { let x := mload(0) sstore(0, x) } data \"b\" hex\"01010202\" }"));
}
BOOST_AUTO_TEST_CASE(object_with_non_code_at_start)
{
CHECK_ERROR("object \"a\" { data \"d\" hex\"0102\" code { } }", ParserError, "Expected keyword \"code\"");
}
BOOST_AUTO_TEST_CASE(nested_object)
{
string code = R"(
object "outer" {
code { let x := mload(0) }
data "x" "stringdata"
object "inner" {
code { mstore(0, 1) }
object "inner inner" { code {} }
data "innerx" "abc"
data "innery" "def"
}
}
)";
BOOST_CHECK(successParse(code));
}
BOOST_AUTO_TEST_CASE(incomplete)
{
CHECK_ERROR("object \"abc\" { code {} } object", ParserError, "Expected end of source");
}
BOOST_AUTO_TEST_CASE(reuse_object_name)
{
string code = R"(
object "outer" {
code { }
data "outer" "stringdata"
}
)";
CHECK_ERROR(code, ParserError, "Object name cannot be the same as the name of the containing object");
}
BOOST_AUTO_TEST_CASE(reuse_object_in_subobject)
{
string code = R"(
object "outer" {
code { }
object "outer" { code {} }
}
)";
CHECK_ERROR(code, ParserError, "Object name cannot be the same as the name of the containing object");
}
BOOST_AUTO_TEST_CASE(reuse_object_of_sibling)
{
string code = R"(
object "O" {
code { }
object "i" { code {} }
data "i" "abc"
}
)";
CHECK_ERROR(code, ParserError, "already exists inside the");
}
BOOST_AUTO_TEST_CASE(to_string)
{
string code = R"(
@ -248,69 +162,6 @@ 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_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"(
object "outer" {
code { let x := "outer" let y := datasize(x) }
}
)";
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"(
object "outer" {
code { let x := 0 let y := 2 let s := 3 datacopy(x, y, s) }
}
)";
BOOST_CHECK(successParse(code));
}
BOOST_AUTO_TEST_CASE(non_existing_objects)
{
BOOST_CHECK(successParse(
"object \"main\" { code { pop(datasize(\"main\")) } }"
));
CHECK_ERROR(
"object \"main\" { code { pop(datasize(\"abc\")) } }",
TypeError,
"Unknown data object"
);
}
BOOST_AUTO_TEST_SUITE_END()
}