mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
LongRangeSet.Range#unite fixed
This commit is contained in:
+1
-1
@@ -1272,7 +1272,7 @@ public abstract class LongRangeSet {
|
||||
return other.unite(this);
|
||||
}
|
||||
if (other instanceof Range) {
|
||||
if (other.intersects(this) ||
|
||||
if (other.min() <= max() && min() <= other.max() ||
|
||||
(other.max() < min() && other.max() + 1 == min()) ||
|
||||
(other.min() > max() && max() + 1 == other.min())) {
|
||||
return range(Math.min(min(), other.min()), Math.max(max(), other.max()));
|
||||
|
||||
+1
@@ -765,6 +765,7 @@ public class LongRangeSetTest {
|
||||
assertEquals("{-2..100}: even", modRange(0, 100, 2, 0b1).unite(point(-2)).toString());
|
||||
assertEquals("{-3, 0..100}", modRange(0, 100, 2, 0b1).unite(point(-3)).toString());
|
||||
assertEquals("{-4, 0..100}", modRange(0, 100, 2, 0b1).unite(point(-4)).toString());
|
||||
assertEquals("{Long.MIN_VALUE..9223372036854775744}", range(1, 63).unite(modRange(Long.MIN_VALUE, Long.MAX_VALUE, 64, 0b1)).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user