From a850b1f2064094cc879611436fec18b97435f70c Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 28 Aug 2022 01:56:14 +0200 Subject: [PATCH] Add unit tests for TransferBuffer with no double support --- tests/ComputeSharp.Tests/BufferTests.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/ComputeSharp.Tests/BufferTests.cs b/tests/ComputeSharp.Tests/BufferTests.cs index 4e468e16..5d84cf8e 100644 --- a/tests/ComputeSharp.Tests/BufferTests.cs +++ b/tests/ComputeSharp.Tests/BufferTests.cs @@ -388,7 +388,7 @@ public partial class BufferTests [Resource(typeof(ReadOnlyBuffer<>))] [Resource(typeof(ReadWriteBuffer<>))] [ExpectedException(typeof(UnsupportedDoubleOperationException))] - public void Dispatch_ReadWriteBuffer_DoublePrecision_ThrowsExceptionIfUnsupported(Device device, Type resourceType) + public void Dispatch_Buffer_DoublePrecision_ThrowsExceptionIfUnsupported(Device device, Type resourceType) { if (device.Get().IsDoublePrecisionSupportAvailable()) { @@ -399,4 +399,21 @@ public partial class BufferTests Assert.Fail(); } + + [CombinatorialTestMethod] + [AllDevices] + [Resource(typeof(UploadBuffer<>))] + [Resource(typeof(ReadBackBuffer<>))] + [ExpectedException(typeof(UnsupportedDoubleOperationException))] + public void Dispatch_TransferBuffer_DoublePrecision_ThrowsExceptionIfUnsupported(Device device, Type resourceType) + { + if (device.Get().IsDoublePrecisionSupportAvailable()) + { + Assert.Inconclusive(); + } + + using TransferBuffer buffer = device.Get().AllocateTransferBuffer(resourceType, 32); + + Assert.Fail(); + } }