diff options
author | Leonardo Alt <leonardoaltt@gmail.com> | 2018-03-09 23:19:03 +0800 |
---|---|---|
committer | Leonardo Alt <leonardoaltt@gmail.com> | 2018-03-13 03:16:47 +0800 |
commit | c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb (patch) | |
tree | 5603090f386fc913b8c6cf6c4eb384a96da67a31 /test/libsolidity/SMTChecker.cpp | |
parent | 6a940f0a99e941c48e5deb695e89ac52784c4f3c (diff) | |
download | dexon-solidity-c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb.tar.gz dexon-solidity-c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb.tar.zst dexon-solidity-c2d26eb6a20a21f5fe4b5d78a39f8c23f7f3f5cb.zip |
[SMTChecker_Bool] Fix PR comments; Add support to gt, ge, lt, le. and tests.
Diffstat (limited to 'test/libsolidity/SMTChecker.cpp')
-rw-r--r-- | test/libsolidity/SMTChecker.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/libsolidity/SMTChecker.cpp b/test/libsolidity/SMTChecker.cpp index b97fc80e..beb933a4 100644 --- a/test/libsolidity/SMTChecker.cpp +++ b/test/libsolidity/SMTChecker.cpp @@ -377,6 +377,46 @@ BOOST_AUTO_TEST_CASE(bool_simple) } )"; CHECK_SUCCESS_NO_WARNINGS(text); + text = R"( + contract C { + function f(bool x) public pure { + require(x); + bool y; + y = false; + assert(x || y); + } + } + )"; + CHECK_SUCCESS_NO_WARNINGS(text); + text = R"( + contract C { + function f(bool x) public pure { + bool y; + assert(x <= y); + } + } + )"; + CHECK_WARNING(text, "Assertion violation happens here"); + text = R"( + contract C { + function f(bool x) public pure { + bool y; + assert(x >= y); + } + } + )"; + CHECK_SUCCESS_NO_WARNINGS(text); + text = R"( + contract C { + function f(bool x) public pure { + require(x); + bool y; + assert(x > y); + assert(y < x); + } + } + )"; + CHECK_SUCCESS_NO_WARNINGS(text); } BOOST_AUTO_TEST_CASE(bool_int_mixed) |