From 0fcd2212d494239b41ddbf1a18328a77fe186558 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 9 Mar 2015 19:22:43 +0100 Subject: Global variable "now" (alias for block.timestamp). --- SolidityEndToEndTest.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index ae241705..3205c038 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -1031,6 +1031,17 @@ BOOST_AUTO_TEST_CASE(blockchain) BOOST_CHECK(callContractFunctionWithValue("someInfo()", 28) == encodeArgs(28, 0, 1)); } +BOOST_AUTO_TEST_CASE(now) +{ + char const* sourceCode = "contract test {\n" + " function someInfo() returns (bool success) {\n" + " return block.timestamp == now && now > 0;\n" + " }\n" + "}\n"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("someInfo()") == encodeArgs(true)); +} + BOOST_AUTO_TEST_CASE(function_types) { char const* sourceCode = "contract test {\n" -- cgit