From 6cb0d1baa0b690ece371d35cf4898a199d32c8fd Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 21 Nov 2014 19:14:56 +0100 Subject: Magic variables. --- solidityCompiler.cpp | 2 +- solidityEndToEndTest.cpp | 2 +- solidityNameAndTypeResolution.cpp | 20 ++++++++++++++++++++ solidityParser.cpp | 20 -------------------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/solidityCompiler.cpp b/solidityCompiler.cpp index 1767a0f3..3e86919a 100644 --- a/solidityCompiler.cpp +++ b/solidityCompiler.cpp @@ -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(); diff --git a/solidityEndToEndTest.cpp b/solidityEndToEndTest.cpp index a7c6357b..46081a63 100644 --- a/solidityEndToEndTest.cpp +++ b/solidityEndToEndTest.cpp @@ -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"; diff --git a/solidityNameAndTypeResolution.cpp b/solidityNameAndTypeResolution.cpp index 61aabb34..a19e7450 100644 --- a/solidityNameAndTypeResolution.cpp +++ b/solidityNameAndTypeResolution.cpp @@ -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() } diff --git a/solidityParser.cpp b/solidityParser.cpp index 0ee88b26..9319a02c 100644 --- a/solidityParser.cpp +++ b/solidityParser.cpp @@ -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() } -- cgit v1.2.3