Added more tests for the mapped vector types

このコミットが含まれているのは:
Sergio Pedri committed 2019-08-29 03:23:01 +02:00
1 親 8c0269be6f
コミット 32b3c31537
1ファイル変更
+35
+35
ファイルの表示
@@ -23,6 +23,20 @@ namespace ComputeSharp.Tests
Assert.IsTrue(MathF.Abs(result[0].Y - f2.X) < 0.0001f);
}
[TestMethod]
public void Int2Properties()
{
using ReadWriteBuffer<Int2> buffer = Gpu.Default.AllocateReadWriteBuffer<Int2>(1);
Action<ThreadIds> 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<Bool3> buffer = Gpu.Default.AllocateReadWriteBuffer<Bool3>(3);
Action<ThreadIds> 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);
}
}
}