public void TestIntervalTreeEqual() { Assert.AreEqual( _ranges.SubRanges.Where(r => r.HasIntersection(_intersection)).ToArray(), IntersectNaive(_intersection).ToArray()); Assert.AreEqual( _tree.Intersect(_intersection).Join(";"), IntersectNaive(_intersection).ToArray().Join(";")); Assert.AreEqual( _treeCostin .GetIntervalsOverlappingWith(_intersectionCostin) .Select(i => new Range <int, string>(i.Key.Start, i.Key.End, i.Value)) .Join(";"), IntersectNaive(_intersection).ToArray().Join(";")); }
private static void AssertSameOverlap(CompositeRange <int, string> ranges, [NotNull] IntervalTree <int, string> tree, Range <int> overlapRange) => Assert.AreEqual( ranges.SubRanges.Where(r => r.HasIntersection(overlapRange)).Join(";"), tree.Intersect(overlapRange).Join(";"));