You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this is the right place to announce it, nor do I know if it is an error. So forgive me if I make noise for nothing.
The possible problem is in the method intersects in proper_interval.e
It is possible that I don't understand the Eiffel code well, I am not used to work with it.
But, OK, what I see:
Imagine two intervals, one 3..7 and the other, 8..10. They do not intersect. So the result should be false. When I run them in my converted Javacode, the test fails at the last line of the method, which says in Eiffel:
((attached other.lower as other_l and then attached upper as u and then u >= other_l) OR
(attached other.upper as other_u and then attached lower as l and then l <= other_u))
Lower should not be smaller then the other.upper (because the result must be FALSE, doesn't it? But lower is smaller then the other.upper, so the function returns TRUE were it should return FALSE.
I think it must be AND where now I emphasized with OR
Definition in comment: Does current interval properly contain `other'? True if at least one limit of other is stricly inside the limits of this interval
I wrote it this way in Java:
In Java Comparables are compared in this way. Although the function seems complex there is a trick to read what it does easy. Replace the function compareTo with the operator behind it, and forget the 0.
So
boolean l_ol = lower.compareTo(other.lower) > 0;
should be read as
boolean l_ol = lower > (other.lower);
In case of 3..5 and 6..8 all comparisons are FALSE //(=not contains)
In case of 3..5 and 1..2 all comparisons are TRUE. //(=not contains)
So the return value must have one or more but not all unequal boolean, and then the contains-rule counts:
The text was updated successfully, but these errors were encountered:
I just got the time to set up some unit tests. You are right, there are a couple of errors. I'll fix my classes, but in the meantime, you may as well build the logic in yours according to your preference. Thanks for the error report.
I don't know if this is the right place to announce it, nor do I know if it is an error. So forgive me if I make noise for nothing.
The possible problem is in the method intersects in proper_interval.e
It is possible that I don't understand the Eiffel code well, I am not used to work with it.
But, OK, what I see:
Imagine two intervals, one 3..7 and the other, 8..10. They do not intersect. So the result should be false. When I run them in my converted Javacode, the test fails at the last line of the method, which says in Eiffel:
((attached other.lower as other_l and then attached upper as u and then u >= other_l) OR
(attached other.upper as other_u and then attached lower as l and then l <= other_u))
Lower should not be smaller then the other.upper (because the result must be FALSE, doesn't it? But lower is smaller then the other.upper, so the function returns TRUE were it should return FALSE.
I think it must be AND where now I emphasized with OR
Definition in comment: Does current interval properly contain `other'? True if at least one limit of other is stricly inside the limits of this interval
I wrote it this way in Java:
In Java Comparables are compared in this way. Although the function seems complex there is a trick to read what it does easy. Replace the function compareTo with the operator behind it, and forget the 0.
So
boolean l_ol = lower.compareTo(other.lower) > 0;
should be read as
boolean l_ol = lower > (other.lower);
In case of 3..5 and 6..8 all comparisons are FALSE //(=not contains)
In case of 3..5 and 1..2 all comparisons are TRUE. //(=not contains)
So the return value must have one or more but not all unequal boolean, and then the contains-rule counts:
The text was updated successfully, but these errors were encountered: