Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ internal override T MinInternal
{

int comp = _lBoundActive ? Comparer.Compare(_min, current.Item) : -1;
if (comp == 1)
if (comp > 0)
{
current = current.Right;
}
Expand Down Expand Up @@ -161,7 +161,7 @@ internal override T MaxInternal
while (current != null)
{
int comp = _uBoundActive ? Comparer.Compare(_max, current.Item) : 1;
if (comp == -1)
if (comp < 0)
{
current = current.Left;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,23 @@ protected override ISet<int> GenericISetFactory()
{
return new SortedSet<int>(new Comparer_SameAsDefaultComparer());
}

[Fact]
public void SortedSet_Generic_GetViewBetween_MinMax_WithCustomComparer()
{
var set = (SortedSet<int>)CreateSortedSet(new[] { 5, 15, 25, 35, 45 }, 5, 5);

for (int i = 0; i <= 40; i += 10)
{
for (int j = i + 10; j <= 50; j += 10)
{
SortedSet<int> view = set.GetViewBetween(i, j);

Assert.Equal(i + 5, view.Min);
Assert.Equal(j - 5, view.Max);
}
}
}
}

[OuterLoop]
Expand Down