aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-11-17 20:36:17 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-07-01 17:35:51 +0800
commit4dfc413b8e6e8f687fb19b1a39e0d2006f373579 (patch)
tree48d2df042f06b357b293ff9648104e7e2d890063
parentfdc9ef14ad02d6f940a3b5789810bc63f80cdd40 (diff)
downloaddexon-solidity-4dfc413b8e6e8f687fb19b1a39e0d2006f373579.tar.gz
dexon-solidity-4dfc413b8e6e8f687fb19b1a39e0d2006f373579.tar.zst
dexon-solidity-4dfc413b8e6e8f687fb19b1a39e0d2006f373579.zip
test: add a test passing an invalid boolean value as an event argument
Fixes #1381
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 50096792..a6c01283 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -3706,6 +3706,7 @@ BOOST_AUTO_TEST_CASE(storing_invalid_boolean)
{
char const* sourceCode = R"(
contract C {
+ event Ev(bool);
bool public perm;
function set() returns(uint) {
bool tmp;
@@ -3722,12 +3723,26 @@ BOOST_AUTO_TEST_CASE(storing_invalid_boolean)
}
return tmp;
}
+ function ev() returns(uint) {
+ bool tmp;
+ assembly {
+ tmp := 5
+ }
+ Ev(tmp);
+ return 1;
+ }
}
)";
compileAndRun(sourceCode);
BOOST_CHECK(callContractFunction("set()") == encodeArgs(1));
BOOST_CHECK(callContractFunction("perm()") == encodeArgs(1));
BOOST_CHECK(callContractFunction("ret()") == encodeArgs(1));
+ BOOST_CHECK(callContractFunction("ev()") == encodeArgs(1));
+ BOOST_REQUIRE_EQUAL(m_logs.size(), 1);
+ BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress);
+ BOOST_CHECK(m_logs[0].data == encodeArgs(1));
+ BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1);
+ BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::keccak256(string("Ev(bool)")));
}