mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Magic variables.
This commit is contained in:
parent
c5a012cdca
commit
6cb0d1baa0
@ -52,7 +52,7 @@ bytes compileContract(const string& _sourceCode)
|
||||
BOOST_REQUIRE_NO_THROW(resolver.resolveNamesAndTypes(*contract));
|
||||
|
||||
Compiler compiler;
|
||||
compiler.compileContract(*contract);
|
||||
compiler.compileContract(*contract, {});
|
||||
// debug
|
||||
//compiler.streamAssembly(cout);
|
||||
return compiler.getAssembledBytecode();
|
||||
|
@ -725,7 +725,7 @@ BOOST_AUTO_TEST_CASE(constructor)
|
||||
BOOST_AUTO_TEST_CASE(balance)
|
||||
{
|
||||
char const* sourceCode = "contract test {\n"
|
||||
" function getBalance() returns (u256 balance) {\n"
|
||||
" function getBalance() returns (uint256 balance) {\n"
|
||||
" return address(this).balance;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
|
@ -224,6 +224,26 @@ BOOST_AUTO_TEST_CASE(type_inference_explicit_conversion)
|
||||
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(balance)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" function fun() {\n"
|
||||
" uint256 x = address(0).balance;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(balance_invalid)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" function fun() {\n"
|
||||
" address(0).balance = 7;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
@ -221,26 +221,6 @@ BOOST_AUTO_TEST_CASE(statement_starting_with_type_conversion)
|
||||
BOOST_CHECK_NO_THROW(parseText(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(blockchain_access)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" function fun() {\n"
|
||||
" u256 x = address(0).balance;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_NO_THROW(parseText(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(blockchain_access_invalid)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" function fun() {\n"
|
||||
" address(0).balance = 7;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_THROW(parseText(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user