GameDevPro.AlgTester
1.0.1
.NET 5.0
dotnet add package GameDevPro.AlgTester --version 1.0.1
NuGet\Install-Package GameDevPro.AlgTester -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GameDevPro.AlgTester" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GameDevPro.AlgTester --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GameDevPro.AlgTester, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GameDevPro.AlgTester as a Cake Addin
#addin nuget:?package=GameDevPro.AlgTester&version=1.0.1
// Install GameDevPro.AlgTester as a Cake Tool
#tool nuget:?package=GameDevPro.AlgTester&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AlgTester
A simple and flexible API to run Coding Challenge solutions in your IDE. Supports test files.
Note: [Check complete documentation on Github] (https://github.com/gamedev-pro/algorithm-tester-csharp)
How to use
You can just create any static function for your Coding Challenge and run it like this
- C# 10 and above
using AlgTester.API;//Include lib
public static int MyCodingChallengeSolution(int n, int[] arr)
{
return 0;
}
// Save the function you want to test in a variable (it will help C# auto resolve the correct method call)
var solutionFunc = MyCodingChallengeSolution;
// Run your tests
SolutionTester.New()
.WithSolution(solutionFunc)
.WithTestCase(2, new int[] { 1, 3 }, 0) // Type safe Input and output
.WithTestCase(3, new int[] { 2, 3, 5 }, 1) // Another test case (this one will fail)
.WithTestCase(3, new int[] { 2, 3, 5 }, 0) // and another :)
.Run();//Run tests!
- C# 9 and below
using AlgTester.API;//Include lib
public static class Solution
{
public static int MyCodingChallengeSolution(int n, int[] arr)
{
return 0;
}
}
class Program
{
static void Main(string[] args)
{
var solutionFunc = Solution.MyCodingChallengeSolution;
SolutionTester.New()
//No implicity generic method resolution for C# 9.0
.WithSolution<int, int[], int>(solutionFunc)
.WithTestCase(2, new int[] { 1, 3 }, 0) // Type safe Input and output
.WithTestCase(3, new int[] { 2, 3, 5 }, 1) // Another test case (this one will fail)
.WithTestCase(3, new int[] { 2, 3, 5 }, 0) // and another :)
.Run();
}
}
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- Newtonsoft.Json (>= 13.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.