Skip to content

Commit

Permalink
Added tests for off-by-one Get[Row|Column] for 2D arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Nov 3, 2020
1 parent 2745962 commit 7a65a29
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public void Test_ArrayExtensions_2D_GetRow_Rectangle()
Assert.AreSame(new int[1, 0].GetRow(0).ToArray(), Array.Empty<int>());

Assert.ThrowsException<ArgumentOutOfRangeException>(() => array.GetRow(-1));
Assert.ThrowsException<ArgumentOutOfRangeException>(() => array.GetRow(3));

Assert.ThrowsException<ArgumentOutOfRangeException>(() => array.GetRow(20));
}
Expand Down Expand Up @@ -221,6 +222,7 @@ public void Test_ArrayExtensions_2D_GetColumn_Rectangle()
CollectionAssert.AreEqual(array.GetColumn(1).ToArray(), new[] { 2, 6, 10 });

Assert.ThrowsException<ArgumentOutOfRangeException>(() => array.GetColumn(-1));
Assert.ThrowsException<ArgumentOutOfRangeException>(() => array.GetColumn(4));

Assert.ThrowsException<ArgumentOutOfRangeException>(() => array.GetColumn(20));
}
Expand Down

0 comments on commit 7a65a29

Please sign in to comment.