From 9ddb20565fba48473c01b37e87ec92e973f86ba2 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 29 Aug 2019 02:11:19 +0200 Subject: [PATCH] Added tests for the Bool2 type --- .../ComputeSharp.Tests/HlslVectorTypesTests.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs b/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs index 2de7dbbe..66498f5d 100644 --- a/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs +++ b/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.Tests public class HlslVectorTypesTests { [TestMethod] - public void LocalScalarAssignToBuffer() + public void LocalFloatAssignToFloat2Buffer() { Float2 f2 = new Float2(1, 2); using ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(1); @@ -22,5 +22,21 @@ namespace ComputeSharp.Tests Assert.IsTrue(MathF.Abs(result[0].X - f2.Y) < 0.0001f); Assert.IsTrue(MathF.Abs(result[0].Y - f2.X) < 0.0001f); } + + [TestMethod] + public void LocalBoolAssignToBool2Buffer() + { + Bool2 b2 = Bool2.TrueY; + using ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(1); + + Action action = id => buffer[0] = b2; + + Gpu.Default.For(1, action); + + Bool2[] result = buffer.GetData(); + + Assert.IsTrue(result[0].X == b2.X); + Assert.IsTrue(result[0].Y == b2.Y); + } } }