📷 A modern, cross-platform, 2D Graphics library for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
1.1 KiB

// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Advanced;
namespace SixLabors.ImageSharp.Tests.Helpers;
public class ParallelExecutionSettingsTests
{
[Theory]
[InlineData(-3, true)]
[InlineData(-2, true)]
[InlineData(-1, false)]
[InlineData(0, true)]
[InlineData(1, false)]
[InlineData(5, false)]
public void Constructor_MaxDegreeOfParallelism_CompatibleWith_ParallelOptions(int maxDegreeOfParallelism, bool throws)
{
if (throws)
{
Assert.Throws<ArgumentOutOfRangeException>(
() =>
{
_ = new ParallelExecutionSettings(
maxDegreeOfParallelism,
Configuration.Default.MemoryAllocator);
});
}
else
{
ParallelExecutionSettings parallelSettings = new(
maxDegreeOfParallelism,
Configuration.Default.MemoryAllocator);
Assert.Equal(maxDegreeOfParallelism, parallelSettings.MaxDegreeOfParallelism);
}
}
}