From 8b01e4f90cfd1a84a90027d156ecb3dd0e34de1b Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 6 Sep 2019 13:42:08 +0200 Subject: [PATCH] Added new test for static members in class hierarchy --- .../ComputeSharp.Tests/StaticPropertiesTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/ComputeSharp.Tests/StaticPropertiesTests.cs b/tests/ComputeSharp.Tests/StaticPropertiesTests.cs index 0d6d19d1..bf5ceb57 100644 --- a/tests/ComputeSharp.Tests/StaticPropertiesTests.cs +++ b/tests/ComputeSharp.Tests/StaticPropertiesTests.cs @@ -143,5 +143,21 @@ namespace ComputeSharp.Tests Assert.IsTrue(MathF.Abs(result[0] - expected[0]) < 0.0001f); Assert.IsTrue(MathF.Abs(result[1] - expected[1]) < 0.0001f); } + + public static int SomeNumber = 7; + + [TestMethod] + public void StaticLocalScalarFieldAssignToBuffer() + { + using ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(1); + + Action action = id => buffer[0] = SomeNumber; + + Gpu.Default.For(1, action); + + int[] result = buffer.GetData(); + + Assert.IsTrue(result[0] == SomeNumber); + } } }