Exemplo n.º 1
0
        public void TestStickSmallGaps()
        {
            var gaps = clientGaps.Select(g => new GapInfo {
                start = g.start, end = g.end
            }).ToList();

            GapInfo.StickSmallGaps(ref gaps, 30);
            Assert.True(gaps.Count == 4, "StickSmallGaps: gaps not sticked, gaps.Count != 4");
            Assert.True(gaps[2].end == clientGaps[3].end, "StickSmallGaps: data error while sticking");
        }
Exemplo n.º 2
0
        public void TestCreateGapList()
        {
            var gaps = clientGaps.Select(g => new GapInfo {
                start = g.start, end = g.end
            }).ToList();
            var groups = GapList.CreateGapList(gaps, 1);

            Assert.AreEqual(3, groups.Count, "CreateGapList: error grouping gaps, groups.Count != 3");
            for (var groupIndex = 0; groupIndex < groups.Count; groupIndex++)
            {
                Assert.AreNotEqual(0, groups[groupIndex].Gaps.Count, "CreateGapList: gap group empty");
            }
            for (var groupIndex = 1; groupIndex < groups.Count; groupIndex++)
            {
                Assert.Less(groups[groupIndex - 1].Gaps.Last().end, groups[groupIndex].Gaps.First().start, "CreateGapList: gap groups intersect each other");
            }
            gaps.Clear();
            groups.ForEach(g => gaps.AddRange(g.Gaps));
            GapInfo.StickSmallGaps(ref gaps, 1);
            Assert.True(gaps.Count == clientGaps.Length, "CreateGapList: error sticking & returning to original");
        }