public void CanIteratorNormally() { HashSet<int> gaps = new HashSet<int>(); IndexIterator ii = new IndexIterator(gaps, 100); int cnt = 0; while (ii.HasMore()) { ii.FetchNextIndex(); cnt++; } Assert.AreEqual(cnt, 100); }
public void CanIteratorNormally() { HashSet <int> gaps = new HashSet <int>(); IndexIterator ii = new IndexIterator(gaps, 100); int cnt = 0; while (ii.HasMore()) { ii.FetchNextIndex(); cnt++; } Assert.AreEqual(cnt, 100); }
public void CanIteratorWithGapAt1_PlusGapsEvery10() { HashSet<int> gaps = new HashSet<int>(new List<int> { 1, 11, 21, 31, 41, 51, 61, 71, 81, 91 }); const int maxValue = 100; IndexIterator ii = new IndexIterator(gaps, 100); int cnt = 0; int firstIdx = -1; while (ii.HasMore()) { int val = ii.FetchNextIndex(); if (cnt == 0) { firstIdx = val; } cnt++; } Assert.AreEqual(cnt, (maxValue - gaps.Count)); Assert.AreEqual(2, firstIdx); }
public void CanIteratorWithGapAt1_PlusGapsEvery10() { HashSet <int> gaps = new HashSet <int>(new List <int> { 1, 11, 21, 31, 41, 51, 61, 71, 81, 91 }); const int maxValue = 100; IndexIterator ii = new IndexIterator(gaps, 100); int cnt = 0; int firstIdx = -1; while (ii.HasMore()) { int val = ii.FetchNextIndex(); if (cnt == 0) { firstIdx = val; } cnt++; } Assert.AreEqual(cnt, maxValue - gaps.Count); Assert.AreEqual(2, firstIdx); }
public void CanIteratorWithGapAt1() { HashSet <int> gaps = new HashSet <int>(new List <int> { 1 }); int maxValue = 100; IndexIterator ii = new IndexIterator(gaps, 100); int cnt = 0; int firstIdx = -1; while (ii.HasMore()) { int val = ii.FetchNextIndex(); if (cnt == 0) { firstIdx = val; } cnt++; } Assert.AreEqual(cnt, (maxValue - gaps.Count)); Assert.AreEqual(2, firstIdx); }