Magic variables.

This commit is contained in:
Christian committed 2014-11-23 21:28:45 +01:00
1 parent c5a012cdca
commit 6cb0d1baa0
4 files changed
+22 -22

No files matched your search

+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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";
+20
View File
@@ -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()
}
-20
View File
@@ -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()
}