Switch methods to block bodies

このコミットが含まれているのは:
Sergio Pedri committed 2022-10-15 09:10:18 -07:00
1 親 16c0fc9aab
コミット b2afb88f30
53ファイル変更
+426 -132

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

+2
ファイルの表示
@@ -8,6 +8,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Win32;
using Win32.Graphics.Direct2D;
#pragma warning disable IDE0022
namespace ComputeSharp.D2D1.Tests;
[TestClass]
@@ -14,6 +14,9 @@ internal sealed partial class D2D1ResourceTextureUninitializedFieldDiagnosticSup
[D2DResourceTextureIndex(0)]
private readonly D2D1ResourceTexture1D<float4> texture;
public float4 Execute() => texture[0];
public float4 Execute()
{
return texture[0];
}
}
}
@@ -179,61 +179,76 @@ public abstract class NativeLibrariesResolverTestsBase
/// </summary>
/// <param name="rid">The input <see cref="RID"/> value.</param>
/// <returns>A text representation for <paramref name="rid"/>.</returns>
private static string ToOption(RID rid) => rid switch
private static string ToOption(RID rid)
{
RID.None => "",
RID.Win_x64 => "-r win-x64",
_ => throw new InvalidEnumArgumentException(nameof(rid), (int)rid, typeof(RID))
};
return rid switch
{
RID.None => "",
RID.Win_x64 => "-r win-x64",
_ => throw new InvalidEnumArgumentException(nameof(rid), (int)rid, typeof(RID))
};
}
/// <summary>
/// Gets a text representation of the command line argument for the given <see cref="PublishMode"/>.
/// </summary>
/// <param name="publishMode">The input <see cref="PublishMode"/> value.</param>
/// <returns>A text representation for <paramref name="publishMode"/>.</returns>
private static string ToOption(PublishMode publishMode) => publishMode switch
private static string ToOption(PublishMode publishMode)
{
PublishMode.FrameworkDependent => "--self-contained false",
PublishMode.SelfContained => "--self-contained true",
_ => throw new InvalidEnumArgumentException(nameof(publishMode), (int)publishMode, typeof(PublishMode))
};
return publishMode switch
{
PublishMode.FrameworkDependent => "--self-contained false",
PublishMode.SelfContained => "--self-contained true",
_ => throw new InvalidEnumArgumentException(nameof(publishMode), (int)publishMode, typeof(PublishMode))
};
}
/// <summary>
/// Gets a text representation of the command line argument for the given <see cref="DeploymentMode"/>.
/// </summary>
/// <param name="deploymentMode">The input <see cref="DeploymentMode"/> value.</param>
/// <returns>A text representation for <paramref name="deploymentMode"/>.</returns>
private static string ToOption(DeploymentMode deploymentMode) => deploymentMode switch
private static string ToOption(DeploymentMode deploymentMode)
{
DeploymentMode.Multiassembly => "/p:PublishSingleFile=false",
DeploymentMode.SingleFile => "/p:PublishSingleFile=true",
_ => throw new InvalidEnumArgumentException(nameof(deploymentMode), (int)deploymentMode, typeof(DeploymentMode))
};
return deploymentMode switch
{
DeploymentMode.Multiassembly => "/p:PublishSingleFile=false",
DeploymentMode.SingleFile => "/p:PublishSingleFile=true",
_ => throw new InvalidEnumArgumentException(nameof(deploymentMode), (int)deploymentMode, typeof(DeploymentMode))
};
}
/// <summary>
/// Gets a text representation of the command line argument for the given <see cref="NativeLibrariesDeploymentMode"/>.
/// </summary>
/// <param name="deploymentMode">The input <see cref="NativeLibrariesDeploymentMode"/> value.</param>
/// <returns>A text representation for <paramref name="deploymentMode"/>.</returns>
private static string ToOption(NativeLibrariesDeploymentMode deploymentMode) => deploymentMode switch
private static string ToOption(NativeLibrariesDeploymentMode deploymentMode)
{
NativeLibrariesDeploymentMode.NotApplicable => "",
NativeLibrariesDeploymentMode.CopyToApplicationDirectory => "/p:IncludeNativeLibrariesForSelfExtract=false",
NativeLibrariesDeploymentMode.ExtractToTemporaryDirectory => "/p:IncludeNativeLibrariesForSelfExtract=true",
_ => throw new InvalidEnumArgumentException(nameof(deploymentMode), (int)deploymentMode, typeof(NativeLibrariesDeploymentMode))
};
return deploymentMode switch
{
NativeLibrariesDeploymentMode.NotApplicable => "",
NativeLibrariesDeploymentMode.CopyToApplicationDirectory => "/p:IncludeNativeLibrariesForSelfExtract=false",
NativeLibrariesDeploymentMode.ExtractToTemporaryDirectory => "/p:IncludeNativeLibrariesForSelfExtract=true",
_ => throw new InvalidEnumArgumentException(nameof(deploymentMode), (int)deploymentMode, typeof(NativeLibrariesDeploymentMode))
};
}
/// <summary>
/// Gets a text representation of the build folder for the given <see cref="RID"/>.
/// </summary>
/// <param name="rid">The input <see cref="RID"/> value.</param>
/// <returns>A text representation for <paramref name="rid"/>.</returns>
private static string ToDirectory(RID rid) => rid switch
private static string ToDirectory(RID rid)
{
RID.None => "",
RID.Win_x64 => "win-x64",
_ => throw new InvalidEnumArgumentException(nameof(rid), (int)rid, typeof(RID))
};
return rid switch
{
RID.None => "",
RID.Win_x64 => "win-x64",
_ => throw new InvalidEnumArgumentException(nameof(rid), (int)rid, typeof(RID))
};
}
}
/// <summary>
+16 -4
ファイルの表示
@@ -26,16 +26,28 @@ public partial class MetaprogrammingTests
public static class Activations
{
[ShaderMethod]
public static int Square(int x) => x * x;
public static int Square(int x)
{
return x * x;
}
[ShaderMethod]
public static int AddOne(int x) => x + 1;
public static int AddOne(int x)
{
return x + 1;
}
// Missing attribute
public static int Identity(int x) => x;
public static int Identity(int x)
{
return x;
}
[ShaderMethod]
public static int FunctionWithConstants(int x) => (int)(x + FourAndAHalf);
public static int FunctionWithConstants(int x)
{
return (int)(x + FourAndAHalf);
}
[ShaderMethod]
public static Position FunctionWithTypes(int x)
+1 -1
ファイルの表示
@@ -3,7 +3,7 @@ using ComputeSharp.Interop;
using ComputeSharp.Tests.Misc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
#pragma warning disable IDE0008
#pragma warning disable IDE0008, IDE0022
namespace ComputeSharp.Tests
{