public void RangeTest7() { var result = LazySequence.RangeInt(15); int j = 0; for (int i = 0; i < 15; i += 1) { Assert.Equal(i, result[j++]); } Assert.Equal(15, result.Count); }
public void SliceTest() { var sqnc = LazySequence.RangeInt(10); sqnc = sqnc.Slice((null, 4, 1)); for (int i = 0; i < 4; i++) { Assert.Equal(i, sqnc[i]); } Assert.Equal(4, sqnc.Count); }
public void DelayTest() { var sqnc = LazySequence.RangeInt(10); sqnc = sqnc.Delay(2); Assert.Equal(0, sqnc[0]); Assert.Equal(0, sqnc[1]); for (int i = 2; i < 10; i++) { Assert.Equal(i - 2, sqnc[i]); } Assert.Equal(10, sqnc.Count); }
public void SplitSequenceTest() { var result = LazySequence.RangeInt(7).SplitSequence(2); Assert.Equal(0, result[0].First()); Assert.Equal(1, result[0].Last()); Assert.Equal(2, result[1].First()); Assert.Equal(3, result[1].Last()); Assert.Equal(4, result[2].First()); Assert.Equal(5, result[2].Last()); Assert.Equal(6, result[3].First()); Assert.Equal(6, result[3].Last()); Assert.Equal(4, result.Count); }