Skip to content
Snippets Groups Projects
Commit ff9c14de authored by David Sehnal's avatar David Sehnal
Browse files

Fix OrderedSet areInterseting array/interval

parent 63a9b680
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,9 @@ describe('ordered set', () => {
expect(OrderedSet.areIntersecting(Interval.ofRange(4, 5), arr12369)).toBe(false);
expect(OrderedSet.areIntersecting(Interval.ofRange(7, 8), arr12369)).toBe(false);
expect(OrderedSet.areIntersecting(Interval.ofRange(6, 6), arr12369)).toBe(true);
expect(OrderedSet.areIntersecting(Interval.ofRange(3, 4), OrderedSet.ofSortedArray([0, 1, 10]))).toBe(false);
});
it('isSubset', () => {
......
......@@ -99,10 +99,7 @@ export function subtract(a: OrderedSetImpl, b: OrderedSetImpl) {
function areEqualIS(a: I, b: S) { return I.size(a) === S.size(b) && I.start(a) === S.start(b) && I.end(a) === S.end(b); }
function areIntersectingSI(a: S, b: I) {
if (S.size(a) === 0 || I.size(b) === 0) return false
const predAMinB = S.findPredecessorIndex(a, I.min(b))
const predAMaxB = S.findPredecessorIndex(a, I.max(b))
return predAMinB !== predAMaxB
return a.length !== 0 && I.size(S.findRange(a, I.min(b), I.max(b))) !== 0;
}
function isSubsetSI(a: S, b: I) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment