Added unit tests for custom allocation modes

このコミットが含まれているのは:
Sergio Pedri committed 2021-03-13 14:24:55 +01:00
1 親 c65a36c87d
コミット 5622a8b60a
8ファイル変更
+142 -66

検索条件に一致するファイルはありません

+13 -4
ファイルの表示
@@ -3,8 +3,7 @@ using System.Linq;
using ComputeSharp.Resources;
using ComputeSharp.Tests.Attributes;
using ComputeSharp.Tests.Extensions;
using Microsoft.Toolkit.HighPerformance.Extensions;
using Microsoft.Toolkit.HighPerformance.Memory;
using Microsoft.Toolkit.HighPerformance;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ComputeSharp.Tests
@@ -17,15 +16,25 @@ namespace ComputeSharp.Tests
[AllDevices]
[Resource(typeof(ReadOnlyTexture3D<>))]
[Resource(typeof(ReadWriteTexture3D<>))]
public void Allocate_Uninitialized_Ok(Device device, Type textureType)
[Data(AllocationMode.Default)]
[Data(AllocationMode.Clear)]
public void Allocate_Uninitialized_Ok(Device device, Type textureType, AllocationMode allocationMode)
{
using Texture3D<float> texture = device.Get().AllocateTexture3D<float>(textureType, 64, 64, 12);
using Texture3D<float> texture = device.Get().AllocateTexture3D<float>(textureType, 64, 64, 12, allocationMode);
Assert.IsNotNull(texture);
Assert.AreEqual(texture.Width, 64);
Assert.AreEqual(texture.Height, 64);
Assert.AreEqual(texture.Depth, 12);
Assert.AreSame(texture.GraphicsDevice, device.Get());
if (allocationMode == AllocationMode.Clear)
{
foreach (float x in texture.ToArray())
{
Assert.AreEqual(x, 0f);
}
}
}
[CombinatorialTestMethod]