-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
32 lines (28 loc) · 1.03 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Reflection;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using Chasm.Utilities;
namespace Chasm.SemanticVersioning.Benchmarks
{
public static class Program
{
public static void Main(string[] args)
{
// Quickly test what semver range syntaxes are supported by libraries
TestRangeParsingMethods();
IConfig config = DefaultConfig.Instance;
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config);
Console.ReadKey();
}
private static void TestRangeParsingMethods()
{
RangeParsingBenchmarks b = new();
foreach (MethodInfo method in b.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance))
{
if (method.DeclaringType != b.GetType()) continue;
if (Util.Catch(() => method.Invoke(b, [])) is { } ex)
Console.WriteLine($"{method.Name}: {ex.GetBaseException().Message}");
}
}
}
}