mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests for comparison of non-comparable types.
This commit is contained in:
parent
751ba701bc
commit
d2445dfdce
@ -554,6 +554,40 @@ BOOST_AUTO_TEST_CASE(comparison_bitop_precedence)
|
|||||||
CHECK_SUCCESS(text);
|
CHECK_SUCCESS(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(comparison_of_function_types)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract C {
|
||||||
|
function f() returns (bool ret) {
|
||||||
|
return this.f < this.f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, TypeError, "Operator < not compatible");
|
||||||
|
text = R"(
|
||||||
|
contract C {
|
||||||
|
function f() returns (bool ret) {
|
||||||
|
return f < f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_SUCCESS(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(comparison_of_mapping_types)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract C {
|
||||||
|
mapping(uint => uint) x;
|
||||||
|
function f() returns (bool ret) {
|
||||||
|
var y = x;
|
||||||
|
return x == y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, TypeError, "Operator == not compatible");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(function_no_implementation)
|
BOOST_AUTO_TEST_CASE(function_no_implementation)
|
||||||
{
|
{
|
||||||
ASTPointer<SourceUnit> sourceUnit;
|
ASTPointer<SourceUnit> sourceUnit;
|
||||||
|
Loading…
Reference in New Issue
Block a user