public void Add_Mid() { var range = new MultiRange(); range.Add(10); range.Add(12); range.Add(11); Assert.Equal(3, range.Count); Assert.Equal(new[] { R(10, 13) }, range.GetRanges()); }
public void Copy() { var range = new MultiRange(); range.Add(23); range.Add(42); var copy = new MultiRange(range); Assert.Equal(2, copy.Count); Assert.Equal(new[] { R(23), R(42) }, range.GetRanges()); }
public void Add_OutOfOrder() { var range = new MultiRange(); range.Add(23); range.Add(42); range.Add(10); Assert.Equal(3, range.Count); Assert.Equal(new[] { R(10), R(23), R(42) }, range.GetRanges()); Assert.True(range.Contains(10)); Assert.True(range.Contains(23)); Assert.True(range.Contains(42)); Assert.False(range.Contains(22)); Assert.False(range.Contains(24)); }
public void AddRange_Empty() { var range = new MultiRange(); range.Add(new Range(10, 20)); Assert.Equal(10, range.Count); Assert.Equal(new[] { R(10, 20) }, range.GetRanges()); }
public void Add() { var range = new MultiRange(); range.Add(42); Assert.Equal(1, range.Count); Assert.Equal(new[] { R(42) }, range.GetRanges()); Assert.True(range.Contains(42)); }
public void AddRange_OverlappedEnd() { var range = new MultiRange { 10, 11, 12 }; range.Add(new Range(11, 15)); Assert.Equal(5, range.Count); Assert.Equal(new[] { R(10, 15) }, range.GetRanges()); }
public void AddRange_OverlappedBegin() { var range = new MultiRange { 7, 8, 9 }; range.Add(new Range(5, 8)); Assert.Equal(5, range.Count); Assert.Equal(new[] { R(5, 10) }, range.GetRanges()); }
public void AddRange_Super() { var range = new MultiRange { 10, 11 }; range.Add(new Range(5, 15)); Assert.Equal(10, range.Count); Assert.Equal(new[] { R(5, 15) }, range.GetRanges()); }
public void Add_End() { var range = new MultiRange { 11 }; range.Add(12); Assert.Equal(2, range.Count); Assert.Equal(new[] { R(11, 13) }, range.GetRanges()); Assert.True(range.Contains(12)); }
public void Add_Begin() { var range = new MultiRange { 11 }; range.Add(10); Assert.Equal(2, range.Count); Assert.Equal(new[] { R(10, 12) }, range.GetRanges()); Assert.True(range.Contains(10)); }
public void AddRange_Multiple() { var range = new MultiRange(); range.Add(new Range(20, 30)); range.Add(new Range(15, 25)); range.Add(new Range(25, 35)); range.Add(new Range(10, 40)); range.Add(new Range(40, 45)); range.Add(new Range(50, 55)); range.Add(new Range(5, 6)); Assert.Equal(41, range.Count); Assert.Equal(new[] { R(5, 6), R(10, 45), R(50, 55) }, range.GetRanges()); }
private MultiRange R(int begin, int end, params int[] indices) { if (indices.Length % 2 != 0) { throw new ArgumentException(); } var range = new MultiRange { new Range(begin, end) }; for (int i = 0; i < indices.Length / 2; i += 2) { range.Add(new Range(indices[i], indices[i + 1])); } return(range); }
private void SelectIdx(int rowIndex) { selectedIndices.Add(rowIndex); }