mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adjust tests.
This commit is contained in:
parent
167ee2fcbb
commit
42c4c78390
@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(basic_compilation)
|
||||
BOOST_CHECK(contract["bytecode"].isString());
|
||||
BOOST_CHECK_EQUAL(
|
||||
dev::test::bytecodeSansMetadata(contract["bytecode"].asString()),
|
||||
"60806040523415600e57600080fd5b603580601b6000396000f3006080604052600080fd00"
|
||||
"6080604052348015600f57600080fd5b50603580601d6000396000f3006080604052600080fd00"
|
||||
);
|
||||
BOOST_CHECK(contract["runtimeBytecode"].isString());
|
||||
BOOST_CHECK_EQUAL(
|
||||
@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE(basic_compilation)
|
||||
BOOST_CHECK(contract["gasEstimates"].isObject());
|
||||
BOOST_CHECK_EQUAL(
|
||||
dev::jsonCompactPrint(contract["gasEstimates"]),
|
||||
"{\"creation\":[61,10600],\"external\":{},\"internal\":{}}"
|
||||
"{\"creation\":[66,10600],\"external\":{},\"internal\":{}}"
|
||||
);
|
||||
BOOST_CHECK(contract["metadata"].isString());
|
||||
BOOST_CHECK(dev::test::isValidMetadata(contract["metadata"].asString()));
|
||||
@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE(single_compilation)
|
||||
BOOST_CHECK(contract["bytecode"].isString());
|
||||
BOOST_CHECK_EQUAL(
|
||||
dev::test::bytecodeSansMetadata(contract["bytecode"].asString()),
|
||||
"60806040523415600e57600080fd5b603580601b6000396000f3006080604052600080fd00"
|
||||
"6080604052348015600f57600080fd5b50603580601d6000396000f3006080604052600080fd00"
|
||||
);
|
||||
BOOST_CHECK(contract["runtimeBytecode"].isString());
|
||||
BOOST_CHECK_EQUAL(
|
||||
@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE(single_compilation)
|
||||
BOOST_CHECK(contract["gasEstimates"].isObject());
|
||||
BOOST_CHECK_EQUAL(
|
||||
dev::jsonCompactPrint(contract["gasEstimates"]),
|
||||
"{\"creation\":[61,10600],\"external\":{},\"internal\":{}}"
|
||||
"{\"creation\":[66,10600],\"external\":{},\"internal\":{}}"
|
||||
);
|
||||
BOOST_CHECK(contract["metadata"].isString());
|
||||
BOOST_CHECK(dev::test::isValidMetadata(contract["metadata"].asString()));
|
||||
|
@ -6009,7 +6009,8 @@ BOOST_AUTO_TEST_CASE(bare_others)
|
||||
{
|
||||
CHECK_WARNING("contract C { function f() pure public { selfdestruct; } }", "Statement has no effect.");
|
||||
CHECK_WARNING("contract C { function f() pure public { assert; } }", "Statement has no effect.");
|
||||
CHECK_WARNING("contract C { function f() pure public { require; } }", "Statement has no effect.");
|
||||
// This is different because it does have overloads.
|
||||
CHECK_ERROR("contract C { function f() pure public { require; } }", TypeError, "No matching declaration found after variable lookup.");
|
||||
CHECK_WARNING("contract C { function f() pure public { suicide; } }", "Statement has no effect.");
|
||||
}
|
||||
|
||||
@ -6508,7 +6509,7 @@ BOOST_AUTO_TEST_CASE(does_not_error_transfer_regular_function)
|
||||
CHECK_SUCCESS_NO_WARNINGS(text);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(returndatacopy_as_variable)
|
||||
BOOST_AUTO_TEST_CASE(returndatasize_as_variable)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract c { function f() public { uint returndatasize; assembly { returndatasize }}}
|
||||
|
@ -261,19 +261,24 @@ BOOST_AUTO_TEST_CASE(basic_compilation)
|
||||
BOOST_CHECK(contract["evm"]["bytecode"]["object"].isString());
|
||||
BOOST_CHECK_EQUAL(
|
||||
dev::test::bytecodeSansMetadata(contract["evm"]["bytecode"]["object"].asString()),
|
||||
"60806040523415600e57600080fd5b603580601b6000396000f3006080604052600080fd00"
|
||||
"6080604052348015600f57600080fd5b50603580601d6000396000f3006080604052600080fd00"
|
||||
);
|
||||
BOOST_CHECK(contract["evm"]["assembly"].isString());
|
||||
BOOST_CHECK(contract["evm"]["assembly"].asString().find(
|
||||
" /* \"fileA\":0:14 contract A { } */\n mstore(0x40, 0x80)\n jumpi(tag_1, iszero(callvalue))\n"
|
||||
" 0x0\n dup1\n revert\ntag_1:\n dataSize(sub_0)\n dup1\n dataOffset(sub_0)\n 0x0\n codecopy\n 0x0\n"
|
||||
" return\nstop\n\nsub_0: assembly {\n /* \"fileA\":0:14 contract A { } */\n"
|
||||
" mstore(0x40, 0x80)\n 0x0\n dup1\n revert\n\n"
|
||||
" auxdata: 0xa165627a7a7230582") == 0);
|
||||
" /* \"fileA\":0:14 contract A { } */\n mstore(0x40, 0x80)\n "
|
||||
"callvalue\n /* \"--CODEGEN--\":8:17 */\n dup1\n "
|
||||
"/* \"--CODEGEN--\":5:7 */\n iszero\n tag_1\n jumpi\n "
|
||||
"/* \"--CODEGEN--\":30:31 */\n 0x0\n /* \"--CODEGEN--\":27:28 */\n "
|
||||
"dup1\n /* \"--CODEGEN--\":20:32 */\n revert\n /* \"--CODEGEN--\":5:7 */\n"
|
||||
"tag_1:\n /* \"fileA\":0:14 contract A { } */\n pop\n dataSize(sub_0)\n dup1\n "
|
||||
"dataOffset(sub_0)\n 0x0\n codecopy\n 0x0\n return\nstop\n\nsub_0: assembly {\n "
|
||||
"/* \"fileA\":0:14 contract A { } */\n mstore(0x40, 0x80)\n 0x0\n "
|
||||
"dup1\n revert\n\n auxdata: 0xa165627a7a72305820"
|
||||
) == 0);
|
||||
BOOST_CHECK(contract["evm"]["gasEstimates"].isObject());
|
||||
BOOST_CHECK_EQUAL(
|
||||
dev::jsonCompactPrint(contract["evm"]["gasEstimates"]),
|
||||
"{\"creation\":{\"codeDepositCost\":\"10600\",\"executionCost\":\"61\",\"totalCost\":\"10661\"}}"
|
||||
"{\"creation\":{\"codeDepositCost\":\"10600\",\"executionCost\":\"66\",\"totalCost\":\"10666\"}}"
|
||||
);
|
||||
BOOST_CHECK(contract["metadata"].isString());
|
||||
BOOST_CHECK(dev::test::isValidMetadata(contract["metadata"].asString()));
|
||||
|
Loading…
Reference in New Issue
Block a user