From 3bff05366d1ac8d25efc56f84c946b76309de5bd Mon Sep 17 00:00:00 2001 From: routersys Date: Fri, 17 Jul 2026 08:38:29 +0900 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E9=83=A8API=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=82=92Tests.Internals=E3=81=B8=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DescriptorHandleAllocatorTests.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/ComputeSharp.Tests.Internals/DescriptorHandleAllocatorTests.cs diff --git a/tests/ComputeSharp.Tests.Internals/DescriptorHandleAllocatorTests.cs b/tests/ComputeSharp.Tests.Internals/DescriptorHandleAllocatorTests.cs new file mode 100644 index 00000000..0bff16b0 --- /dev/null +++ b/tests/ComputeSharp.Tests.Internals/DescriptorHandleAllocatorTests.cs @@ -0,0 +1,31 @@ +using System; +using ComputeSharp.Graphics.Commands.Interop; +using ComputeSharp.Tests.Attributes; +using ComputeSharp.Tests.Extensions; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace ComputeSharp.Tests.Internals; + +[TestClass] +public unsafe partial class DescriptorHandleAllocatorTests +{ + [CombinatorialTestMethod] + [AllDevices] + public void DescriptorHandleAllocator_DefaultReturnIsIgnoredAndDuplicateReturnThrows(Device device) + { + ID3D12DescriptorHandleAllocator allocator = new(device.Get().D3D12Device); + + try + { + allocator.Return(default); + allocator.Rent(out ID3D12ResourceDescriptorHandles handles); + allocator.Return(in handles); + + _ = Assert.ThrowsExactly(() => allocator.Return(in handles)); + } + finally + { + allocator.Dispose(); + } + } +}