Пример #1
0
 /// <summary>
 /// Get intersection of two intervals
 /// https://scicomp.stackexchange.com/questions/26258/the-easiest-way-to-find-intersection-of-two-intervals
 /// </summary>
 /// <param name="uut"></param>
 /// <param name="clone"></param>
 /// <returns></returns>
 public static long[] LineIntersection(TestCaseUUTPair uut, ClonePair clone)
 {
     long[] intersection = new long[2];
     if (clone.StartLineNumber > uut.UutEndingLine || uut.UutStartingLine > clone.EndLineNumber)
     {
         intersection = new long[] { 0, 0 };
     }
     else
     {
         intersection[0] = Math.Max(uut.UutStartingLine, clone.StartLineNumber);
         intersection[1] = Math.Min(uut.UutEndingLine, clone.EndLineNumber);
     }
     return(intersection);
 }
Пример #2
0
        public static bool LineRangesIntersect(TestCaseUUTPair uut, ClonePair clone, bool isTestCase)
        {
            bool exists = false;

            if (clone.StartLineNumber > (isTestCase?uut.TestEndingLine:uut.UutEndingLine) || (isTestCase ? uut.TestStartingLine : uut.UutStartingLine) > clone.EndLineNumber)
            {
                exists = false;
            }
            else
            {
                exists = true;
            }
            return(exists);
        }