mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Test for legacyAssembly in StandardCompiler
This commit is contained in:
parent
a16461249f
commit
0eeb06b6ea
@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE(basic_compilation)
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "abi", "devdoc", "userdoc", "evm.bytecode", "evm.assembly", "evm.gasEstimates", "metadata" ],
|
||||
"A": [ "abi", "devdoc", "userdoc", "evm.bytecode", "evm.assembly", "evm.gasEstimates", "evm.legacyAssembly", "metadata" ],
|
||||
"": [ "legacyAST" ]
|
||||
}
|
||||
}
|
||||
@ -280,6 +280,34 @@ BOOST_AUTO_TEST_CASE(basic_compilation)
|
||||
dev::jsonCompactPrint(contract["evm"]["gasEstimates"]),
|
||||
"{\"creation\":{\"codeDepositCost\":\"10600\",\"executionCost\":\"66\",\"totalCost\":\"10666\"}}"
|
||||
);
|
||||
// Lets take the top level `.code` section (the "deployer code"), that should expose most of the features of
|
||||
// the assembly JSON. What we want to check here is Operation, Push, PushTag, PushSub, PushSubSize and Tag.
|
||||
BOOST_CHECK(contract["evm"]["legacyAssembly"].isObject());
|
||||
BOOST_CHECK(contract["evm"]["legacyAssembly"][".code"].isArray());
|
||||
BOOST_CHECK_EQUAL(
|
||||
dev::jsonCompactPrint(contract["evm"]["legacyAssembly"][".code"]),
|
||||
"[{\"begin\":0,\"end\":14,\"name\":\"PUSH\",\"value\":\"80\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"PUSH\",\"value\":\"40\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"MSTORE\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"CALLVALUE\"},"
|
||||
"{\"begin\":8,\"end\":17,\"name\":\"DUP1\"},"
|
||||
"{\"begin\":5,\"end\":7,\"name\":\"ISZERO\"},"
|
||||
"{\"begin\":5,\"end\":7,\"name\":\"PUSH [tag]\",\"value\":\"1\"},"
|
||||
"{\"begin\":5,\"end\":7,\"name\":\"JUMPI\"},"
|
||||
"{\"begin\":30,\"end\":31,\"name\":\"PUSH\",\"value\":\"0\"},"
|
||||
"{\"begin\":27,\"end\":28,\"name\":\"DUP1\"},"
|
||||
"{\"begin\":20,\"end\":32,\"name\":\"REVERT\"},"
|
||||
"{\"begin\":5,\"end\":7,\"name\":\"tag\",\"value\":\"1\"},"
|
||||
"{\"begin\":5,\"end\":7,\"name\":\"JUMPDEST\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"POP\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"PUSH #[$]\",\"value\":\"0000000000000000000000000000000000000000000000000000000000000000\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"DUP1\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"PUSH [$]\",\"value\":\"0000000000000000000000000000000000000000000000000000000000000000\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"PUSH\",\"value\":\"0\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"CODECOPY\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"PUSH\",\"value\":\"0\"},"
|
||||
"{\"begin\":0,\"end\":14,\"name\":\"RETURN\"}]"
|
||||
);
|
||||
BOOST_CHECK(contract["metadata"].isString());
|
||||
BOOST_CHECK(dev::test::isValidMetadata(contract["metadata"].asString()));
|
||||
BOOST_CHECK(result["sources"].isObject());
|
||||
|
Loading…
Reference in New Issue
Block a user