diff options
author | Gav Wood <g@ethdev.com> | 2015-01-09 23:28:01 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2015-01-09 23:28:01 +0800 |
commit | 8cc70a12c6fc726c0ec1dada49003d48406b65a0 (patch) | |
tree | 041a3615f4a97bb41769626af84fcafc7d1a4ea9 | |
parent | b240574cb6a16f7d7865a5c1b76f93a3008285c2 (diff) | |
parent | 0652c29bb662e0aad415d2da0db3e7b48f34cdb0 (diff) | |
download | dexon-solidity-8cc70a12c6fc726c0ec1dada49003d48406b65a0.tar.gz dexon-solidity-8cc70a12c6fc726c0ec1dada49003d48406b65a0.tar.zst dexon-solidity-8cc70a12c6fc726c0ec1dada49003d48406b65a0.zip |
Merge pull request #765 from chriseth/sol_someLogFixes
Some changes to the log functions.
-rw-r--r-- | SolidityEndToEndTest.cpp | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index 1ddd26f7..bc184dfc 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -857,10 +857,8 @@ BOOST_AUTO_TEST_CASE(log0) " log0(1);\n" " }\n" "}\n"; - u256 amount(130); - compileAndRun(sourceCode, amount + 1); - u160 address(23); - callContractFunction("a()", address, amount); + compileAndRun(sourceCode); + callContractFunction("a()"); BOOST_CHECK_EQUAL(m_logs.size(), 1); BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); @@ -874,10 +872,8 @@ BOOST_AUTO_TEST_CASE(log1) " log1(1, 2);\n" " }\n" "}\n"; - u256 amount(130); - compileAndRun(sourceCode, amount + 1); - u160 address(23); - callContractFunction("a()", address, amount); + compileAndRun(sourceCode); + callContractFunction("a()"); BOOST_CHECK_EQUAL(m_logs.size(), 1); BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); @@ -892,10 +888,8 @@ BOOST_AUTO_TEST_CASE(log2) " log2(1, 2, 3);\n" " }\n" "}\n"; - u256 amount(130); - compileAndRun(sourceCode, amount + 1); - u160 address(23); - callContractFunction("a()", address, amount); + compileAndRun(sourceCode); + callContractFunction("a()"); BOOST_CHECK_EQUAL(m_logs.size(), 1); BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); @@ -911,10 +905,8 @@ BOOST_AUTO_TEST_CASE(log3) " log3(1, 2, 3, 4);\n" " }\n" "}\n"; - u256 amount(130); - compileAndRun(sourceCode, amount + 1); - u160 address(23); - callContractFunction("a()", address, amount); + compileAndRun(sourceCode); + callContractFunction("a()"); BOOST_CHECK_EQUAL(m_logs.size(), 1); BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); @@ -930,10 +922,8 @@ BOOST_AUTO_TEST_CASE(log4) " log4(1, 2, 3, 4, 5);\n" " }\n" "}\n"; - u256 amount(130); - compileAndRun(sourceCode, amount + 1); - u160 address(23); - callContractFunction("a()", address, amount); + compileAndRun(sourceCode); + callContractFunction("a()"); BOOST_CHECK_EQUAL(m_logs.size(), 1); BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); @@ -942,6 +932,21 @@ BOOST_AUTO_TEST_CASE(log4) BOOST_CHECK_EQUAL(m_logs[0].topics[i], h256(u256(i + 2))); } +BOOST_AUTO_TEST_CASE(log_in_constructor) +{ + char const* sourceCode = "contract test {\n" + " function test() {\n" + " log1(1, 2);\n" + " }\n" + "}\n"; + compileAndRun(sourceCode); + BOOST_CHECK_EQUAL(m_logs.size(), 1); + BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); + BOOST_CHECK_EQUAL(h256(m_logs[0].data), h256(u256(1))); + BOOST_CHECK_EQUAL(m_logs[0].topics.size(), 1); + BOOST_CHECK_EQUAL(m_logs[0].topics[0], h256(u256(2))); +} + BOOST_AUTO_TEST_CASE(suicide) { char const* sourceCode = "contract test {\n" |