diff --git a/tests/ComputeSharp.Tests/StaticMethodTests.cs b/tests/ComputeSharp.Tests/StaticMethodTests.cs index a93ddbeb..dcc8be58 100644 --- a/tests/ComputeSharp.Tests/StaticMethodTests.cs +++ b/tests/ComputeSharp.Tests/StaticMethodTests.cs @@ -14,6 +14,9 @@ namespace ComputeSharp.Tests [Pure] public static Float4 Range(float x) => new Float4(x, x + 1, x + 2, x + 3); + + [Pure] + public static int Sum(Float4 x) => (int)(x.X + x.Y + x.Z + x.W); } [TestClass] @@ -46,6 +49,18 @@ namespace ComputeSharp.Tests Assert.IsTrue(MathF.Abs(result[0].Z - 5) < 0.0001f); Assert.IsTrue(MathF.Abs(result[0].W - 6) < 0.0001f); } + + [TestMethod] + public void Float4ToIntFunc() + { + using ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(1); + + Gpu.Default.For(1, id => buffer[0] = StaticMethodsContainer.Sum(new Float4(1, 2, 3, 14))); + + int[] result = buffer.GetData(); + + Assert.IsTrue(result[0] == 20); + } } }