From 32b3c3153755ce09d90ba1a8f9451ff1793d6bc5 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 29 Aug 2019 03:23:01 +0200 Subject: [PATCH] Added more tests for the mapped vector types --- .../HlslVectorTypesTests.cs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs b/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs index 66498f5d..4e1cf505 100644 --- a/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs +++ b/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs @@ -23,6 +23,20 @@ namespace ComputeSharp.Tests Assert.IsTrue(MathF.Abs(result[0].Y - f2.X) < 0.0001f); } + [TestMethod] + public void Int2Properties() + { + using ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(1); + + Action action = id => buffer[0].X = 1; + + Gpu.Default.For(1, action); + + Int2[] result = buffer.GetData(); + + Assert.IsTrue(result[0].X == 1); + } + [TestMethod] public void LocalBoolAssignToBool2Buffer() { @@ -38,5 +52,26 @@ namespace ComputeSharp.Tests Assert.IsTrue(result[0].X == b2.X); Assert.IsTrue(result[0].Y == b2.Y); } + + [TestMethod] + public void Bool3Operations() + { + using ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(3); + + Action action = id => + { + buffer[0] = Bool3.TrueX; + buffer[1] = Bool3.True; + buffer[2].YZ = Bool2.True; + }; + + Gpu.Default.For(1, action); + + Bool3[] result = buffer.GetData(); + + Assert.IsTrue(result[0].X && !result[0].Y && !result[0].Z); + Assert.IsTrue(result[1].X && result[1].Y && result[1].Z); + Assert.IsTrue(!result[2].X && result[2].Y && result[2].Z); + } } }