mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Bool variables should not allow arithmetic comparison
This commit is contained in:
@@ -388,35 +388,6 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user