From 6338f2511eb0b5e98898a977f0a9112fff997cf8 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 13 Jan 2021 20:09:52 +0100 Subject: [PATCH] Updated unit tests with new code changes --- .../ShaderHashCodeTests.cs | 4 +- tests/ComputeSharp.Tests/BufferTests.cs | 12 ++--- .../ComputeSharp.Tests/InitializationTests.cs | 4 +- .../Texture2DTests.Pixels.g.cs | 48 +++++++++---------- .../Texture2DTests.Pixels.tt | 4 +- tests/ComputeSharp.Tests/Texture2DTests.cs | 8 ++-- .../Texture3DTests.Pixels.g.cs | 48 +++++++++---------- .../Texture3DTests.Pixels.tt | 4 +- tests/ComputeSharp.Tests/Texture3DTests.cs | 8 ++-- 9 files changed, 70 insertions(+), 70 deletions(-) diff --git a/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs b/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs index 498695ea..dfe219e2 100644 --- a/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs +++ b/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs @@ -13,7 +13,7 @@ namespace ComputeSharp.Tests.Internals public float A; public ReadWriteBuffer B; - public void Execute(ThreadIds ids) + public void Execute() { B[0] = A; } @@ -46,7 +46,7 @@ namespace ComputeSharp.Tests.Internals public ReadWriteBuffer B; public Func F; - public void Execute(ThreadIds ids) + public void Execute() { B[0] = F(A); } diff --git a/tests/ComputeSharp.Tests/BufferTests.cs b/tests/ComputeSharp.Tests/BufferTests.cs index 55e49552..e8dcc321 100644 --- a/tests/ComputeSharp.Tests/BufferTests.cs +++ b/tests/ComputeSharp.Tests/BufferTests.cs @@ -223,9 +223,9 @@ namespace ComputeSharp.Tests public readonly ConstantBuffer source; public readonly ReadWriteBuffer destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.X] = source[ids.X]; + destination[ThreadIds.X] = source[ThreadIds.X]; } } @@ -250,9 +250,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyBuffer source; public readonly ReadWriteBuffer destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.X] = source[ids.X]; + destination[ThreadIds.X] = source[ThreadIds.X]; } } @@ -277,9 +277,9 @@ namespace ComputeSharp.Tests public readonly ReadWriteBuffer source; public readonly ReadWriteBuffer destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.X] = source[ids.X]; + destination[ThreadIds.X] = source[ThreadIds.X]; } } } diff --git a/tests/ComputeSharp.Tests/InitializationTests.cs b/tests/ComputeSharp.Tests/InitializationTests.cs index 661896e0..4e7e8589 100644 --- a/tests/ComputeSharp.Tests/InitializationTests.cs +++ b/tests/ComputeSharp.Tests/InitializationTests.cs @@ -86,9 +86,9 @@ namespace ComputeSharp.Tests { public readonly ReadWriteBuffer buffer; - public void Execute(ThreadIds ids) + public void Execute() { - buffer[ids.X] = ids.X; + buffer[ThreadIds.X] = ThreadIds.X; } } } diff --git a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.g.cs b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.g.cs index 08039596..f914c901 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.g.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.g.cs @@ -113,9 +113,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -125,9 +125,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -137,9 +137,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -149,9 +149,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -161,9 +161,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -173,9 +173,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -185,9 +185,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -197,9 +197,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -209,9 +209,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -221,9 +221,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -233,9 +233,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } @@ -245,9 +245,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } } diff --git a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.tt b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.tt index 33775291..991ce833 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.tt +++ b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.tt @@ -69,9 +69,9 @@ foreach (var (t, tPixel) in EnumerateTypes()) public readonly ReadOnlyTexture2D<<#=t#>, <#=tPixel#>> source; public readonly ReadWriteTexture2D<<#=t#>, <#=tPixel#>> destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = (source[ids.XY] + destination[ids.XY]) / 2; + destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2; } } <# diff --git a/tests/ComputeSharp.Tests/Texture2DTests.cs b/tests/ComputeSharp.Tests/Texture2DTests.cs index 4a6806e8..77991cfe 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.cs @@ -159,9 +159,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture2D source; public readonly ReadWriteBuffer destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.Y * 32 + ids.X] = source[ids.XY]; + destination[ThreadIds.Y * 32 + ThreadIds.X] = source[ThreadIds.XY]; } } @@ -188,9 +188,9 @@ namespace ComputeSharp.Tests public readonly ReadWriteTexture2D source; public readonly ReadWriteTexture2D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XY] = source[ids.XY]; + destination[ThreadIds.XY] = source[ThreadIds.XY]; } } } diff --git a/tests/ComputeSharp.Tests/Texture3DTests.Pixels.g.cs b/tests/ComputeSharp.Tests/Texture3DTests.Pixels.g.cs index 3c1e4955..debd29cf 100644 --- a/tests/ComputeSharp.Tests/Texture3DTests.Pixels.g.cs +++ b/tests/ComputeSharp.Tests/Texture3DTests.Pixels.g.cs @@ -113,9 +113,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -125,9 +125,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -137,9 +137,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -149,9 +149,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -161,9 +161,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -173,9 +173,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -185,9 +185,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -197,9 +197,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -209,9 +209,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -221,9 +221,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -233,9 +233,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } @@ -245,9 +245,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } } diff --git a/tests/ComputeSharp.Tests/Texture3DTests.Pixels.tt b/tests/ComputeSharp.Tests/Texture3DTests.Pixels.tt index d72edd3c..57be04b8 100644 --- a/tests/ComputeSharp.Tests/Texture3DTests.Pixels.tt +++ b/tests/ComputeSharp.Tests/Texture3DTests.Pixels.tt @@ -69,9 +69,9 @@ foreach (var (t, tPixel) in EnumerateTypes()) public readonly ReadOnlyTexture3D<<#=t#>, <#=tPixel#>> source; public readonly ReadWriteTexture3D<<#=t#>, <#=tPixel#>> destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = (source[ids.XYZ] + destination[ids.XYZ]) / 2; + destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2; } } <# diff --git a/tests/ComputeSharp.Tests/Texture3DTests.cs b/tests/ComputeSharp.Tests/Texture3DTests.cs index d69d4335..b2adb7e0 100644 --- a/tests/ComputeSharp.Tests/Texture3DTests.cs +++ b/tests/ComputeSharp.Tests/Texture3DTests.cs @@ -193,9 +193,9 @@ namespace ComputeSharp.Tests public readonly ReadOnlyTexture3D source; public readonly ReadWriteBuffer destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.Z * 32 * 32 + ids.Y * 32 + ids.X] = source[ids.XYZ]; + destination[ThreadIds.Z * 32 * 32 + ThreadIds.Y * 32 + ThreadIds.X] = source[ThreadIds.XYZ]; } } @@ -222,9 +222,9 @@ namespace ComputeSharp.Tests public readonly ReadWriteTexture3D source; public readonly ReadWriteTexture3D destination; - public void Execute(ThreadIds ids) + public void Execute() { - destination[ids.XYZ] = source[ids.XYZ]; + destination[ThreadIds.XYZ] = source[ThreadIds.XYZ]; } } }