Skip to content

Commit

Permalink
test: added the test code
Browse files Browse the repository at this point in the history
  • Loading branch information
kurone-kito committed Apr 30, 2024
1 parent 7f49b26 commit 5cb35ef
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Packages/black.kit.toybox/Tests/Runtime/TestArrayUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ public sealed class TestArrayUtils
[TestCase(null, 0, ExpectedResult = 0)]
public int At(int[] array, int index) => array.At(index);

/// <summary>
/// Test for the <see cref="ArrayUtils.AtIndex{T}(T[], int)"/> method.
/// </summary>
[TestCase(new[] { 1, 2, 3 }, 0, ExpectedResult = 0)]
[TestCase(new[] { 1, 2, 3 }, 1, ExpectedResult = 1)]
[TestCase(new[] { 1, 2, 3 }, 2, ExpectedResult = 2)]
[TestCase(new[] { 1, 2, 3 }, 3, ExpectedResult = 0)]
[TestCase(new[] { 1, 2, 3 }, -1, ExpectedResult = 2)]
[TestCase(new[] { 1, 2, 3 }, -2, ExpectedResult = 1)]
[TestCase(new[] { 1, 2, 3 }, -3, ExpectedResult = 0)]
[TestCase(new[] { 1, 2, 3 }, -4, ExpectedResult = 2)]
[TestCase(new[] { 1, 2, 3 }, -5, ExpectedResult = 1)]
[TestCase(new[] { 1, 2, 3 }, -6, ExpectedResult = 0)]
[TestCase(null, 0, ExpectedResult = -1)]
public int AtIndex(int[] array, int index) => array.AtIndex(index);

/// <summary>
/// Test for the <see cref="ArrayUtils.Contains{T}(T[], T)"/> method.
/// </summary>
Expand Down

0 comments on commit 5cb35ef

Please sign in to comment.