Added test method for ref parameters
このコミットが含まれているのは:
1 親
07f7d855b3
コミット
d281236691
1ファイル変更
+15
@@ -19,6 +19,8 @@ namespace ComputeSharp.Tests
|
||||
public static int Sum(Float4 x) => (int)(x.X + x.Y + x.Z + x.W);
|
||||
|
||||
public static void Assign(int x, out int y) => y = x;
|
||||
|
||||
public static void ReadAndSquare(ref int x) => x *= x;
|
||||
}
|
||||
|
||||
[TestClass]
|
||||
@@ -75,6 +77,19 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Assert.IsTrue(result[0] == 7);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IntToRefIntFunc()
|
||||
{
|
||||
int[] data = { 3 };
|
||||
using ReadWriteBuffer<int> buffer = Gpu.Default.AllocateReadWriteBuffer(data);
|
||||
|
||||
Gpu.Default.For(1, id => StaticMethodsContainer.ReadAndSquare(ref buffer[0]));
|
||||
|
||||
buffer.GetData(data);
|
||||
|
||||
Assert.IsTrue(data[0] == 9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする