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

Add more tests to LandGrabInSpaceTests.cs #2300

Merged
merged 2 commits into from
Aug 28, 2024
Merged
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
24 changes: 24 additions & 0 deletions exercises/concept/land-grab-in-space/LandGrabInSpaceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@ public void GetLongestSide()
Assert.Equal(longer, ch.GetClaimWithLongestSide());
}

[Fact]
[Task(4)]
public void GetLongestSideReverseInsertionOrder()
{
var ch = new ClaimsHandler();
var longer = CreatePlot(new Coord(10, 1), new Coord(20, 1), new Coord(10, 2), new Coord(20, 2));
var shorter = CreatePlot(new Coord(1, 1), new Coord(2, 1), new Coord(1, 2), new Coord(2, 2));
ch.StakeClaim(shorter);
ch.StakeClaim(longer);
Assert.Equal(longer, ch.GetClaimWithLongestSide());
}

[Fact]
[Task(4)]
public void GetLongestSideDiagonal1()
{
var ch = new ClaimsHandler();
var shorter = CreatePlot(new Coord(0, 0), new Coord(0, 10), new Coord(10, 0), new Coord(10, 10));
var longer = CreatePlot(new Coord(0, 0), new Coord(11, 0), new Coord(11, 11), new Coord(0, 11));
ch.StakeClaim(shorter);
ch.StakeClaim(longer);
Assert.Equal(longer, ch.GetClaimWithLongestSide());
}

private Plot CreatePlot(Coord coord1, Coord coord2, Coord coord3, Coord coord4)
{
Type plotType = typeof(Plot);
Expand Down
Loading