Code tweaks, added basic test
このコミットが含まれているのは:
1 親
99d4a04c54
コミット
2b310aba25
2ファイル変更
+37
-5
検索条件に一致するファイルはありません
@@ -0,0 +1,28 @@
|
||||
using System.Reflection.Emit;
|
||||
using ComputeSharp.Shaders.Extensions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ComputeSharp.Tests.Internals
|
||||
{
|
||||
[TestClass]
|
||||
[TestCategory("DynamicMethod")]
|
||||
public class DynamicMethodTests
|
||||
{
|
||||
public delegate int Square(int x);
|
||||
|
||||
public void TestSquare()
|
||||
{
|
||||
Square square = DynamicMethod<Square>.New(il =>
|
||||
{
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
il.Emit(OpCodes.Dup);
|
||||
il.Emit(OpCodes.Mul);
|
||||
il.Emit(OpCodes.Ret);
|
||||
});
|
||||
|
||||
int result = square(2); // result = 2 * 2
|
||||
|
||||
Assert.IsTrue(result == 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする