aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-01-09 22:00:47 +0800
committerChristian <c@ethdev.com>2015-01-09 22:00:47 +0800
commit0652c29bb662e0aad415d2da0db3e7b48f34cdb0 (patch)
tree5c4d95ccc7fe6d39618d2ba726ffd58c5ee554cb /SolidityEndToEndTest.cpp
parent2e93e7e676ea9b54e2b69cdc834bf57f47a2d409 (diff)
downloaddexon-solidity-0652c29bb662e0aad415d2da0db3e7b48f34cdb0.tar
dexon-solidity-0652c29bb662e0aad415d2da0db3e7b48f34cdb0.tar.gz
dexon-solidity-0652c29bb662e0aad415d2da0db3e7b48f34cdb0.tar.bz2
dexon-solidity-0652c29bb662e0aad415d2da0db3e7b48f34cdb0.tar.lz
dexon-solidity-0652c29bb662e0aad415d2da0db3e7b48f34cdb0.tar.xz
dexon-solidity-0652c29bb662e0aad415d2da0db3e7b48f34cdb0.tar.zst
dexon-solidity-0652c29bb662e0aad415d2da0db3e7b48f34cdb0.zip
Some changes to the log functions.
Diffstat (limited to 'SolidityEndToEndTest.cpp')
-rw-r--r--SolidityEndToEndTest.cpp45
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"