-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aece2f2
commit 252b589
Showing
3 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
LeetCode/tests/LeetCode.Challenges.UnitTests/CoinChange/SolutionV1Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using LeetCode.Challenges.CoinChange; | ||
using Xunit; | ||
using Shouldly; | ||
|
||
namespace LeetCode.Challenges.UnitTests.CoinChange; | ||
|
||
public class SolutionV1Tests | ||
{ | ||
[Theory] | ||
[MemberData(nameof(CoinChangeTestCases))] | ||
public void GivenCoins_WhenCoinChange_ThenResultAsExpected(int[] coins, int amount, int expected) | ||
{ | ||
SolutionV1.CoinChange(coins, amount).ShouldBe(expected); | ||
} | ||
|
||
public static IEnumerable<object[]> CoinChangeTestCases() | ||
{ | ||
yield return [new[] { 1, 2, 5 }, 11, 3]; | ||
yield return [new[] { 2 }, 3, -1]; | ||
yield return [new[] { 1 }, 0, 0]; | ||
yield return [new[] { 186, 419, 83, 408 }, 6249, 20]; | ||
yield return [new[] { 1, 3, 4 }, 6, 2]; | ||
yield return [new[] { 5 }, 5, 1]; | ||
yield return [new[] { 5 }, 0, 0]; | ||
yield return [new[] { 5 }, 2, -1]; | ||
yield return [new[] { 2, 5, 10 }, 1, -1]; | ||
yield return [new[] { 10, 5 }, 20, 2]; | ||
yield return [new[] { 1, 5, 10, 25 }, 30, 2]; | ||
yield return [new[] { 2, 3 }, 7, 3]; | ||
yield return [new[] { 1, 2, 5 }, 100, 20]; | ||
yield return [new[] { 7, 3, 2 }, 8, 3]; | ||
yield return [new[] { 1, 7, 10 }, 14, 2]; | ||
yield return [new[] { 1, 3, 4, 7 }, 15, 3]; | ||
yield return [new[] { 25, 50, 100 }, 30, -1]; | ||
yield return [new[] { 9, 6, 5, 1 }, 11, 2]; | ||
} | ||
} |