mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2114 from LianaHus/sol_byte0_in_storage
Sol removed bytes0
This commit is contained in:
commit
0237949212
@ -566,16 +566,16 @@ BOOST_AUTO_TEST_CASE(strings)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(empty_string_on_stack)
|
||||
{
|
||||
char const* sourceCode = "contract test {\n"
|
||||
" function run(bytes0 empty, uint8 inp) returns(uint16 a, bytes0 b, bytes4 c) {\n"
|
||||
" var x = \"abc\";\n"
|
||||
" var y = \"\";\n"
|
||||
" var z = inp;\n"
|
||||
" a = z; b = y; c = x;"
|
||||
" }\n"
|
||||
"}\n";
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function run() external returns(bytes2 ret) {
|
||||
var y = "";
|
||||
ret = y;
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("run(bytes0,uint8)", string(), byte(0x02)) == encodeArgs(0x2, string(""), string("abc\0")));
|
||||
BOOST_CHECK(callContractFunction("run()") == encodeArgs(byte(0x00)));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(inc_dec_operators)
|
||||
@ -3786,30 +3786,6 @@ BOOST_AUTO_TEST_CASE(packed_storage_structs_delete)
|
||||
BOOST_CHECK(m_state.storage(m_contractAddress).empty());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(packed_storage_structs_with_bytes0)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract C {
|
||||
struct str { uint8 a; bytes0 b; uint8 c; }
|
||||
uint8 a;
|
||||
bytes0 x;
|
||||
uint8 b;
|
||||
str data;
|
||||
function test() returns (bool) {
|
||||
a = 2;
|
||||
b = 3;
|
||||
data.a = 4;
|
||||
data.c = 5;
|
||||
delete x;
|
||||
delete data.b;
|
||||
return a == 2 && b == 3 && data.a == 4 && data.c == 5;
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("test()") == encodeArgs(true));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(overloaded_function_call_resolve_to_first)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
|
@ -1579,7 +1579,6 @@ BOOST_AUTO_TEST_CASE(test_fromElementaryTypeName)
|
||||
BOOST_CHECK(*Type::fromElementaryTypeName(Token::UInt256) == *make_shared<IntegerType>(256, IntegerType::Modifier::Unsigned));
|
||||
|
||||
BOOST_CHECK(*Type::fromElementaryTypeName(Token::Byte) == *make_shared<FixedBytesType>(1));
|
||||
BOOST_CHECK(*Type::fromElementaryTypeName(Token::Bytes0) == *make_shared<FixedBytesType>(0));
|
||||
BOOST_CHECK(*Type::fromElementaryTypeName(Token::Bytes1) == *make_shared<FixedBytesType>(1));
|
||||
BOOST_CHECK(*Type::fromElementaryTypeName(Token::Bytes2) == *make_shared<FixedBytesType>(2));
|
||||
BOOST_CHECK(*Type::fromElementaryTypeName(Token::Bytes3) == *make_shared<FixedBytesType>(3));
|
||||
@ -1666,16 +1665,6 @@ BOOST_AUTO_TEST_CASE(local_const_variable)
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), ParserError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bytes0_array)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract Foo {
|
||||
bytes0[] illegalArray;
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(overloaded_function_cannot_resolve)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
|
Loading…
Reference in New Issue
Block a user