diff options
author | chriseth <chris@ethereum.org> | 2017-10-05 03:21:17 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-11-22 10:35:34 +0800 |
commit | 5e2c066778c2018b5ee627585c917dd2c92ae848 (patch) | |
tree | d97c3fee48f400b1a9baafcfbd7196722b267b37 /test/libsolidity/SMTChecker.cpp | |
parent | 95a65dc04c6f6a5c611c25d6f07d54843f2daec9 (diff) | |
download | dexon-solidity-5e2c066778c2018b5ee627585c917dd2c92ae848.tar.gz dexon-solidity-5e2c066778c2018b5ee627585c917dd2c92ae848.tar.zst dexon-solidity-5e2c066778c2018b5ee627585c917dd2c92ae848.zip |
Test for multi-branches.
Diffstat (limited to 'test/libsolidity/SMTChecker.cpp')
-rw-r--r-- | test/libsolidity/SMTChecker.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/libsolidity/SMTChecker.cpp b/test/libsolidity/SMTChecker.cpp index 9fbab03a..ff93f7c7 100644 --- a/test/libsolidity/SMTChecker.cpp +++ b/test/libsolidity/SMTChecker.cpp @@ -241,6 +241,24 @@ BOOST_AUTO_TEST_CASE(branches_assert_condition) } )"; CHECK_SUCCESS_NO_WARNINGS(text); + text = R"( + contract C { + function f(uint x) public pure { + if (x > 10) { + assert(x > 9); + } + else if (x > 2) + { + assert(x <= 10 && x > 2); + } + else + { + assert(0 <= x && x <= 2); + } + } + } + )"; + CHECK_SUCCESS_NO_WARNINGS(text); } BOOST_AUTO_TEST_CASE(ways_to_clear_variables) |