Added new tests
このコミットが含まれているのは:
1 親
aff1959b42
コミット
9effc967fb
2ファイル変更
+31
検索条件に一致するファイルはありません
@@ -149,5 +149,31 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Assert.IsTrue(MathF.Abs(result[0] - 9) < 0.0001f);
|
||||
}
|
||||
|
||||
public static Func<float, float> SquareFunc { get; } = x => x * x;
|
||||
|
||||
[TestMethod]
|
||||
public void StaticFunctionInSameClass()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = Gpu.Default.AllocateReadWriteBuffer<float>(1);
|
||||
|
||||
Gpu.Default.For(1, id => buffer[0] = SquareFunc(3));
|
||||
|
||||
float[] result = buffer.GetData();
|
||||
|
||||
Assert.IsTrue(MathF.Abs(result[0] - 9) < 0.0001f);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StaticFunctionInExternalClass()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = Gpu.Default.AllocateReadWriteBuffer<float>(1);
|
||||
|
||||
Gpu.Default.For(1, id => buffer[0] = StaticPropertiesContainer.SquareFunc(3));
|
||||
|
||||
float[] result = buffer.GetData();
|
||||
|
||||
Assert.IsTrue(MathF.Abs(result[0] - 9) < 0.0001f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,11 @@ namespace ComputeSharp.Tests
|
||||
/// A <see langword="static"/> <see cref="ReadOnlyBuffer{T}"/> property
|
||||
/// </summary>
|
||||
public static ReadOnlyBuffer<float> StaticBuffer { get; set; } = Gpu.Default.AllocateReadOnlyBuffer(new[] { 3.14f, 7.77f });
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="static"/> <see cref="Func{T,TResult}"/> property
|
||||
/// </summary>
|
||||
public static Func<float, float> SquareFunc { get; } = x => x * x;
|
||||
}
|
||||
|
||||
[TestClass]
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする