mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adds support for hex string literals in soltest.
This commit is contained in:
@@ -310,6 +310,40 @@ BOOST_AUTO_TEST_CASE(call_arguments_bool)
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(call_arguments_hex_string)
|
||||
{
|
||||
char const* source = R"(
|
||||
// f(bytes): hex"4200ef" -> hex"ab0023"
|
||||
)";
|
||||
auto const calls = parse(source);
|
||||
BOOST_REQUIRE_EQUAL(calls.size(), 1);
|
||||
testFunctionCall(
|
||||
calls.at(0),
|
||||
Mode::SingleLine,
|
||||
"f(bytes)",
|
||||
false,
|
||||
fromHex("4200ef"),
|
||||
fromHex("ab0023")
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(call_arguments_hex_string_lowercase)
|
||||
{
|
||||
char const* source = R"(
|
||||
// f(bytes): hex"4200ef" -> hex"23ef00"
|
||||
)";
|
||||
auto const calls = parse(source);
|
||||
BOOST_REQUIRE_EQUAL(calls.size(), 1);
|
||||
testFunctionCall(
|
||||
calls.at(0),
|
||||
Mode::SingleLine,
|
||||
"f(bytes)",
|
||||
false,
|
||||
fromHex("4200EF"),
|
||||
fromHex("23EF00")
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(call_arguments_tuple)
|
||||
{
|
||||
char const* source = R"(
|
||||
@@ -564,6 +598,22 @@ BOOST_AUTO_TEST_CASE(call_builtin_right_decimal)
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(call_arguments_hex_string_left_align)
|
||||
{
|
||||
char const* source = R"(
|
||||
// f(bytes): left(hex"4200ef") ->
|
||||
)";
|
||||
BOOST_REQUIRE_THROW(parse(source), langutil::Error);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(call_arguments_hex_string_right_align)
|
||||
{
|
||||
char const* source = R"(
|
||||
// f(bytes): right(hex"4200ef") ->
|
||||
)";
|
||||
BOOST_REQUIRE_THROW(parse(source), langutil::Error);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(call_newline_invalid)
|
||||
{
|
||||
char const* source = R"(
|
||||
|
||||
Reference in New Issue
Block a user