Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling VersionCheck in TreeSubSet.Min and Max #55763

Merged
merged 1 commit into from
Jul 18, 2021
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 @@ -125,6 +125,7 @@ internal override T MinInternal
{
get
{
VersionCheck();
Node? current = root;
T? result = default;

Expand Down Expand Up @@ -155,6 +156,7 @@ internal override T MaxInternal
{
get
{
VersionCheck();
Node? current = root;
T? result = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ public void SortedSet_Generic_GetViewBetween_MinMax_Exhaustive()
}
}
}

[Fact]
public void SortedSet_Generic_GetViewBetween_MinMax_Updating()
{
var set = (SortedSet<int>)CreateSortedSet(new[] { 1 }, 1, 1);
var lowerView = set.GetViewBetween(-5, -2);
var upperView = set.GetViewBetween(2, 5);

set.Add(-3);
set.Add(2);
set.Add(3);

Assert.Equal(-3, lowerView.Min);
Assert.Equal(-3, lowerView.Max);
Assert.Equal(2, upperView.Min);
Assert.Equal(3, upperView.Max);
}
}

public class SortedSet_Generic_Tests_int_With_NullComparer : SortedSet_Generic_Tests_int
Expand Down