diff options
author | chriseth <c@ethdev.com> | 2016-05-20 22:44:03 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-05-20 22:52:38 +0800 |
commit | a09583a2a49344034e8be22be91a4410f2982781 (patch) | |
tree | eca575a147ae3005fc648e26bc45963ba189078d /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | e3c54185434e16591e15e94b9f0cbef49c83137c (diff) | |
download | dexon-solidity-a09583a2a49344034e8be22be91a4410f2982781.tar.gz dexon-solidity-a09583a2a49344034e8be22be91a4410f2982781.tar.zst dexon-solidity-a09583a2a49344034e8be22be91a4410f2982781.zip |
Tests for invalid cleanup and missing bool conversion code.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 8c537346..30ae5792 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -6775,6 +6775,24 @@ BOOST_AUTO_TEST_CASE(iszero_bnot_correct) BOOST_CHECK(callContractFunction("f()") == encodeArgs(true)); } +BOOST_AUTO_TEST_CASE(cleanup_bytes_types) +{ + // Checks that bytesXX types are properly cleaned before they are compared. + char const* sourceCode = R"( + contract C { + function f(bytes2 a, uint16 x) returns (uint) { + if (a != "ab") return 1; + if (x != 0x0102) return 2; + if (bytes3(x) != 0x0102) return 3; + return 0; + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + // We input longer data on purpose. + BOOST_CHECK(callContractFunction("f(bytes2,uint16)", string("abc"), u256(0x040102)) == encodeArgs(0)); +} + BOOST_AUTO_TEST_SUITE_END() } |