diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-10-20 02:16:28 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2017-01-23 22:25:13 +0800 |
commit | 4c09e81c3e60ddc43709656f9be4f991360b4108 (patch) | |
tree | 325104e4828222cffab9373e45508a052dea7800 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 133d1c05e1ea1ae505e84df4c0660942f614bb3a (diff) | |
download | dexon-solidity-4c09e81c3e60ddc43709656f9be4f991360b4108.tar.gz dexon-solidity-4c09e81c3e60ddc43709656f9be4f991360b4108.tar.zst dexon-solidity-4c09e81c3e60ddc43709656f9be4f991360b4108.zip |
test: check the results of function calls in the test for multiple events of the same name
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 6163790b..81cedfb0 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2800,35 +2800,38 @@ BOOST_AUTO_TEST_CASE(events_with_same_name) event Deposit; event Deposit(address _addr); event Deposit(address _addr, uint _amount); - function deposit() { + function deposit() returns (uint) { Deposit(); + return 1; } - function deposit(address _addr) { + function deposit(address _addr) returns (uint) { Deposit(_addr); + return 1; } - function deposit(address _addr, uint _amount) { + function deposit(address _addr, uint _amount) returns (uint) { Deposit(_addr, _amount); + return 1; } } )"; u160 const c_loggedAddress = m_contractAddress; compileAndRun(sourceCode); - callContractFunction("deposit()"); + BOOST_CHECK(callContractFunction("deposit()") == encodeArgs(u256(1))); BOOST_REQUIRE_EQUAL(m_logs.size(), 1); BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); BOOST_CHECK(m_logs[0].data.empty()); BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1); BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Deposit()"))); - callContractFunction("deposit(address)", c_loggedAddress); + BOOST_CHECK(callContractFunction("deposit(address)", c_loggedAddress) == encodeArgs(u256(1))); BOOST_REQUIRE_EQUAL(m_logs.size(), 2); BOOST_CHECK_EQUAL(m_logs[1].address, m_contractAddress); BOOST_CHECK(m_logs[1].data == encodeArgs(c_loggedAddress)); BOOST_REQUIRE_EQUAL(m_logs[1].topics.size(), 1); BOOST_CHECK_EQUAL(m_logs[1].topics[0], dev::keccak256(string("Deposit(address)"))); - callContractFunction("deposit(address, uint256)", c_loggedAddress, u256(100)); + BOOST_CHECK(callContractFunction("deposit(address,uint256)", c_loggedAddress, u256(100)) == encodeArgs(u256(1))); BOOST_REQUIRE_EQUAL(m_logs.size(), 3); BOOST_CHECK_EQUAL(m_logs[2].address, m_contractAddress); BOOST_CHECK(m_logs[2].data == encodeArgs(c_loggedAddress, 100)); |