diff --git a/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs b/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs new file mode 100644 index 00000000..2de7dbbe --- /dev/null +++ b/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs @@ -0,0 +1,26 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace ComputeSharp.Tests +{ + [TestClass] + [TestCategory("HlslVectorTypes")] + public class HlslVectorTypesTests + { + [TestMethod] + public void LocalScalarAssignToBuffer() + { + Float2 f2 = new Float2(1, 2); + using ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(1); + + Action action = id => buffer[0] = f2.YX; + + Gpu.Default.For(1, action); + + Float2[] result = buffer.GetData(); + + Assert.IsTrue(MathF.Abs(result[0].X - f2.Y) < 0.0001f); + Assert.IsTrue(MathF.Abs(result[0].Y - f2.X) < 0.0001f); + } + } +}