Skip to content

Commit

Permalink
(#72) CodeGen: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Jul 23, 2022
1 parent 57a23f2 commit 2627dcb
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 4 deletions.
14 changes: 12 additions & 2 deletions Cesium.CodeGen.Tests/CodeGenMethodTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,18 @@ int main()
}");

[Fact]
public Task FunctionPtrTest() => DoTest(@"typedef int (*foo)(void);
int main() {
public Task FunctionPtrTest() => DoTest(@"typedef void (*foo)(void);
int main()
{
foo unused;
return 0;
}");

[Fact]
public Task FunctionPtrWithParamsTest() => DoTest(@"typedef int (*foo)(int x);
int main()
{
foo unused;
return 0;
}");
}
4 changes: 2 additions & 2 deletions Cesium.CodeGen.Tests/CodeGenTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ public Task ArrayDeclaration() => DoTest(@"int main()
}");

[Fact]
public Task StructFunctionMemberDeclaration() => DoTest(@"typedef struct { void bar(int unused); } foo;
public Task StructFunctionMemberDeclaration() => DoTest(@"typedef struct { void (*bar)(int unused); } foo;
int main(void) {}");

[Fact]
public Task BasicTypeDef() => DoTest(@"typedef int foo;
int main(void) { foo x; }");
int main(void) { foo x; return 0; }");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
System.Int32 <Module>::main()
Locals:
method System.Void *() V_0
IL_0000: ldc.i4 0
IL_0005: ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
System.Int32 <Module>::main()
Locals:
method System.Int32 *(System.Int32) V_0
IL_0000: ldc.i4 0
IL_0005: ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Module: Primary
Type: <Module>
Methods:
System.Int32 <Module>::main()
Locals:
System.Int32 V_0
IL_0000: ldc.i4 0
IL_0005: ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Module: Primary
Type: <Module>
Methods:
System.Int32 <Module>::main()
IL_0000: ldc.i4.0
IL_0001: ret

Type: foo
Fields:
method System.Void *(System.Int32) foo::bar
Init with: []

0 comments on commit 2627dcb

Please sign in to comment.