From 3984550a16d7a8961d249686168c65fdf82f2e8b Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 4 Sep 2019 23:22:02 +0200 Subject: [PATCH] Added tests for static methods with out parameters --- ...ticMethodTests.cs => StaticMethodsTests.cs} | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) rename tests/ComputeSharp.Tests/{StaticMethodTests.cs => StaticMethodsTests.cs} (79%) diff --git a/tests/ComputeSharp.Tests/StaticMethodTests.cs b/tests/ComputeSharp.Tests/StaticMethodsTests.cs similarity index 79% rename from tests/ComputeSharp.Tests/StaticMethodTests.cs rename to tests/ComputeSharp.Tests/StaticMethodsTests.cs index dcc8be58..4c1909c5 100644 --- a/tests/ComputeSharp.Tests/StaticMethodTests.cs +++ b/tests/ComputeSharp.Tests/StaticMethodsTests.cs @@ -17,11 +17,13 @@ namespace ComputeSharp.Tests [Pure] public static int Sum(Float4 x) => (int)(x.X + x.Y + x.Z + x.W); + + public static void Assign(int x, out int y) => y = x; } [TestClass] - [TestCategory("StaticMethodTests")] - public class StaticMethodTests + [TestCategory("StaticMethodsTests")] + public class StaticMethodsTests { [TestMethod] public void FloatToFloatFunc() @@ -61,6 +63,18 @@ namespace ComputeSharp.Tests Assert.IsTrue(result[0] == 20); } + + [TestMethod] + public void IntToOutIntFunc() + { + using ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(1); + + Gpu.Default.For(1, id => StaticMethodsContainer.Assign(7, out buffer[0])); + + int[] result = buffer.GetData(); + + Assert.IsTrue(result[0] == 7); + } } }