Skip to content

Commit

Permalink
Add more tests to LandGrabInSpaceTests.cs (#2300)
Browse files Browse the repository at this point in the history
* Add more tests to LandGrabInSpaceTests.cs

See discussion at https://forum.exercism.org/t/land-grab-in-space-has-insufficient-test-coverage-for-the-plot-with-longest-side/9615

* Remove unnecessary comment

Co-authored-by: Erik Schierboom <erik_schierboom@hotmail.com>

---------

Co-authored-by: Erik Schierboom <erik_schierboom@hotmail.com>

[no important files changed]
  • Loading branch information
cizra authored Aug 28, 2024
1 parent cd81e9d commit ce6268b
Showing 1 changed file with 24 additions and 0 deletions.
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

0 comments on commit ce6268b

Please sign in to comment.