Added a test for a static method that takes an HLSL vector type

このコミットが含まれているのは:
Sergio Pedri committed 2019-09-04 15:40:13 +02:00
1 親 b666d48678
コミット a3bc07e88d
1ファイル変更
+15
+15
ファイルの表示
@@ -14,6 +14,9 @@ namespace ComputeSharp.Tests
[Pure]
public static Float4 Range(float x) => new Float4(x, x + 1, x + 2, x + 3);
[Pure]
public static int Sum(Float4 x) => (int)(x.X + x.Y + x.Z + x.W);
}
[TestClass]
@@ -46,6 +49,18 @@ namespace ComputeSharp.Tests
Assert.IsTrue(MathF.Abs(result[0].Z - 5) < 0.0001f);
Assert.IsTrue(MathF.Abs(result[0].W - 6) < 0.0001f);
}
[TestMethod]
public void Float4ToIntFunc()
{
using ReadWriteBuffer<int> buffer = Gpu.Default.AllocateReadWriteBuffer<int>(1);
Gpu.Default.For(1, id => buffer[0] = StaticMethodsContainer.Sum(new Float4(1, 2, 3, 14)));
int[] result = buffer.GetData();
Assert.IsTrue(result[0] == 20);
}
}
}