@@ -65,3 +65,40 @@ TEST_CASE("struct pointer", "[Type]"){
65
65
REQUIRE (answ == Translate (code));
66
66
}
67
67
68
+ TEST_CASE (" func no args" , " [Func]" ){
69
+ std::string code = " int foo();" ;
70
+ std::string answ = " \t def foo(): native.CInt = native.extern\n " ;
71
+ REQUIRE (answ == Translate (code));
72
+ }
73
+
74
+ TEST_CASE (" func void args" , " [Func]" ){
75
+ std::string code = " int foo(void);" ;
76
+ std::string answ = " \t def foo(): native.CInt = native.extern\n " ;
77
+ REQUIRE (answ == Translate (code));
78
+ }
79
+
80
+ TEST_CASE (" func 1 arg" , " [Func]" ){
81
+ std::string code = " void foo(int a);" ;
82
+ std::string answ = " \t def foo(a: native.CInt): Unit = native.extern\n " ;
83
+ REQUIRE (answ == Translate (code));
84
+ }
85
+
86
+ TEST_CASE (" func 2 args" , " [Func]" ){
87
+ std::string code = " void foo(float a, int b);" ;
88
+ std::string answ = " \t def foo(a: native.CFloat, b: native.CInt): Unit = native.extern\n " ;
89
+ REQUIRE (answ == Translate (code));
90
+ }
91
+
92
+ TEST_CASE (" func anonymous args" , " [Func]" ){
93
+ std::string code = " void foo(float, int);" ;
94
+ std::string answ = " \t def foo(anonymous0: native.CFloat, anonymous1: native.CInt): Unit = native.extern\n " ;
95
+ REQUIRE (answ == Translate (code));
96
+ }
97
+
98
+ TEST_CASE (" func variadic args" , " [Func]" ){
99
+ std::string code = " double foo(double a, void* b, ...);" ;
100
+ std::string answ = " \t def foo(a: native.CDouble, b: native.Ptr[Byte], varArgs: native.CVararg*): native.CDouble = native.extern\n " ;
101
+ REQUIRE (answ == Translate (code));
102
+ }
103
+
104
+
0 commit comments