-
-
Notifications
You must be signed in to change notification settings - Fork 986
/
Copy pathMonoTests.cs
44 lines (40 loc) · 1.37 KB
/
MonoTests.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
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Portability;
using BenchmarkDotNet.Tests.Loggers;
using BenchmarkDotNet.Tests.XUnit;
using Xunit.Abstractions;
namespace BenchmarkDotNet.IntegrationTests
{
public class MonoTests : BenchmarkTestExecutor
{
public MonoTests(ITestOutputHelper output) : base(output) { }
[FactEnvSpecific("UseMonoRuntime option is available in .NET Core only starting from .NET 6", EnvRequirement.DotNetCoreOnly)]
public void Mono80IsSupported()
{
var logger = new OutputLogger(Output);
var config = ManualConfig.CreateEmpty()
.AddLogger(logger)
.AddJob(Job.Dry.WithRuntime(MonoRuntime.Mono80));
CanExecute<MonoBenchmark>(config);
}
public class MonoBenchmark
{
[Benchmark]
public void Check()
{
if (Type.GetType("Mono.RuntimeStructs") == null)
{
throw new Exception("This is not Mono runtime");
}
if (RuntimeInformation.GetCurrentRuntime() != MonoRuntime.Mono80)
{
throw new Exception("Incorrect runtime detection");
}
}
}
}
}