aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SMTChecker.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-05-02 21:56:59 +0800
committerGitHub <noreply@github.com>2018-05-02 21:56:59 +0800
commit8debded7431cb852bd66edc8ebb615cb39f95231 (patch)
tree8cd4db92d6d7b5aa7c31995ff9a5026c4e9312a3 /test/libsolidity/SMTChecker.cpp
parent42289b642ff12d9275dedf10c257cfec8295feed (diff)
downloaddexon-solidity-8debded7431cb852bd66edc8ebb615cb39f95231.tar.gz
dexon-solidity-8debded7431cb852bd66edc8ebb615cb39f95231.tar.zst
dexon-solidity-8debded7431cb852bd66edc8ebb615cb39f95231.zip
Revert "BREAKING: Bool variables should not allow arithmetic comparison"
Diffstat (limited to 'test/libsolidity/SMTChecker.cpp')
-rw-r--r--test/libsolidity/SMTChecker.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/libsolidity/SMTChecker.cpp b/test/libsolidity/SMTChecker.cpp
index 10f64a7f..beb933a4 100644
--- a/test/libsolidity/SMTChecker.cpp
+++ b/test/libsolidity/SMTChecker.cpp
@@ -388,6 +388,35 @@ BOOST_AUTO_TEST_CASE(bool_simple)
}
)";
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)