Use primary constructors in remaining projects

このコミットが含まれているのは:
Sergio Pedri committed 2023-11-20 23:06:22 +01:00
1 親 46a6b25756
コミット 6897ecfcb2
14ファイル変更
+55 -174

検索条件に一致するファイルはありません

+3 -11
ファイルの表示
@@ -5,20 +5,12 @@ namespace ComputeSharp.Tests.Attributes;
/// <summary>
/// An attribute to use with <see cref="CombinatorialTestMethodAttribute"/> adding additional arbitrary input data.
/// </summary>
/// <param name="data">The additional input data.</param>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class AdditionalDataAttribute : Attribute
public sealed class AdditionalDataAttribute(params object[] data) : Attribute
{
/// <summary>
/// Creates a new <see cref="AdditionalDataAttribute"/> instance with the specified parameters.
/// </summary>
/// <param name="data">The additional input data.</param>
public AdditionalDataAttribute(params object[] data)
{
Data = data;
}
/// <summary>
/// Gets the additional input data for the current attribute.
/// </summary>
public object[] Data { get; }
public object[] Data => data;
}
+3 -11
ファイルの表示
@@ -5,20 +5,12 @@ namespace ComputeSharp.Tests.Attributes;
/// <summary>
/// An attribute to use with <see cref="CombinatorialTestMethodAttribute"/> targeting an additional specific resource type.
/// </summary>
/// <param name="type">The additional resource type.</param>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class AdditionalResourceAttribute : Attribute
public sealed class AdditionalResourceAttribute(Type type) : Attribute
{
/// <summary>
/// Creates a new <see cref="AdditionalResourceAttribute"/> instance with the specified parameters.
/// </summary>
/// <param name="type">The additional resource type.</param>
public AdditionalResourceAttribute(Type type)
{
Type = type;
}
/// <summary>
/// Gets the additional resource type for the current attribute.
/// </summary>
public Type Type { get; }
public Type Type => type;
}
+3 -11
ファイルの表示
@@ -5,20 +5,12 @@ namespace ComputeSharp.Tests.Attributes;
/// <summary>
/// An attribute to use with <see cref="CombinatorialTestMethodAttribute"/> adding arbitrary input data.
/// </summary>
/// <param name="data">The input data.</param>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class DataAttribute : Attribute
public sealed class DataAttribute(params object[] data) : Attribute
{
/// <summary>
/// Creates a new <see cref="DataAttribute"/> instance with the specified parameters.
/// </summary>
/// <param name="data">The input data.</param>
public DataAttribute(params object[] data)
{
Data = data;
}
/// <summary>
/// Gets the input data for the current attribute.
/// </summary>
public object[] Data { get; }
public object[] Data => data;
}
+3 -11
ファイルの表示
@@ -6,20 +6,12 @@ namespace ComputeSharp.Tests.Attributes;
/// <summary>
/// An attribute to use with <see cref="CombinatorialTestMethodAttribute"/> adding a specific <see cref="Extensions.Device"/> input.
/// </summary>
/// <param name="device">The target device type to use..</param>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class DeviceAttribute : Attribute
public sealed class DeviceAttribute(Device device) : Attribute
{
/// <summary>
/// Creates a new <see cref="DeviceAttribute"/> instance with the specified parameters.
/// </summary>
/// <param name="device">The target device type to use..</param>
public DeviceAttribute(Device device)
{
Device = device;
}
/// <summary>
/// Gets the <see cref="Extensions.Device"/> target to use.
/// </summary>
public Device Device { get; }
public Device Device => device;
}
+3 -11
ファイルの表示
@@ -5,20 +5,12 @@ namespace ComputeSharp.Tests.Attributes;
/// <summary>
/// An attribute to use with <see cref="CombinatorialTestMethodAttribute"/> targeting a specific resource type.
/// </summary>
/// <param name="type">The resource type.</param>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class ResourceAttribute : Attribute
public sealed class ResourceAttribute(Type type) : Attribute
{
/// <summary>
/// Creates a new <see cref="ResourceAttribute"/> instance with the specified parameters.
/// </summary>
/// <param name="type">The resource type.</param>
public ResourceAttribute(Type type)
{
Type = type;
}
/// <summary>
/// Gets the resource type for the current attribute.
/// </summary>
public Type Type { get; }
public Type Type => type;
}
+6 -20
ファイルの表示
@@ -117,31 +117,17 @@ internal static class TolerantImageComparer
/// <summary>
/// A simple model repressenting info about a difference between two pixels.
/// </summary>
private readonly struct PixelDifference
private readonly struct PixelDifference(Point position, ImageSharpRgba32 expected, ImageSharpRgba32 actual)
{
public PixelDifference(Point position, ImageSharpRgba32 expected, ImageSharpRgba32 actual)
{
this.Position = position;
this.RedDifference = actual.R - expected.R;
this.GreenDifference = actual.G - expected.G;
this.BlueDifference = actual.B - expected.B;
this.AlphaDifference = actual.A - expected.A;
}
public readonly Point Position;
public readonly int RedDifference;
public readonly int GreenDifference;
public readonly int BlueDifference;
public readonly int AlphaDifference;
private readonly int redDifference = actual.R - expected.R;
private readonly int greenDifference = actual.G - expected.G;
private readonly int blueDifference = actual.B - expected.B;
private readonly int alphaDifference = actual.A - expected.A;
/// <inheritdoc/>
public override string ToString()
{
return $"[delta({this.RedDifference},{this.GreenDifference},{this.BlueDifference},{this.AlphaDifference}) @ ({this.Position.X},{this.Position.Y})]";
return $"[delta({this.redDifference},{this.greenDifference},{this.blueDifference},{this.alphaDifference}) @ ({position.X},{position.Y})]";
}
}
}