Skip to content

Commit

Permalink
(#354) CodeGen: more tests for the various types of pointer interop
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Oct 31, 2023
1 parent 19b4a1e commit 2d4c688
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions Cesium.CodeGen.Tests/CodeGenNetInteropTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,42 @@ public static class Test
public static int Func(FPtr<Func<int>> ptr) => 1;
}
", """
__cli_import("Test::Func")
int Func(int (*ptr)());
__cli_import("Test::Func")
int Func(int (*ptr)());
int myFunc()
{
return 0;
}
int myFunc()
{
return 0;
}
int main(void)
{
return Func(&myFunc);
}
""");
int main(void)
{
return Func(&myFunc);
}
""");

[Theory]
[InlineData(TargetArchitectureSet.Dynamic)]
[InlineData(TargetArchitectureSet.Wide)]
public Task FunctionPointerInterop(TargetArchitectureSet architecture) => DoTest(
architecture,
"""
public static class Test
{
public static int Func(delegate*<int> ptr) => 1;
}
""", """
__cli_import("Test::Func")
int Func(int (*ptr)());
int myFunc()
{
return 0;
}
int main(void)
{
return Func(&myFunc);
}
""");
}

0 comments on commit 2d4c688

Please sign in to comment.