aboutsummaryrefslogtreecommitdiff
path: root/tests/core
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/test_ccall.in19
-rw-r--r--tests/core/test_ccall.out23
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/core/test_ccall.in b/tests/core/test_ccall.in
new file mode 100644
index 00000000..6374ebb3
--- /dev/null
+++ b/tests/core/test_ccall.in
@@ -0,0 +1,19 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
+
+ extern "C" {
+ int get_int() { return 5; }
+ float get_float() { return 3.14; }
+ char * get_string() { return "hello world"; }
+ void print_int(int x) { printf("%d\n", x); }
+ void print_float(float x) { printf("%.2f\n", x); }
+ void print_string(char *x) { printf("%s\n", x); }
+ int multi(int x, float y, int z, char *str) { if (x) puts(str); return (x+y)*z; }
+ int * pointer(int *in) { printf("%d\n", *in); static int ret = 21; return &ret; }
+ }
+
+ int main(int argc, char **argv) {
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_ccall.out b/tests/core/test_ccall.out
new file mode 100644
index 00000000..526ed80d
--- /dev/null
+++ b/tests/core/test_ccall.out
@@ -0,0 +1,23 @@
+*
+number,5
+number,3.14
+string,hello world
+12
+undefined
+14.56
+undefined
+cheez
+undefined
+arr-ay
+undefined
+more
+number,10
+650
+number,21
+*
+atr
+10
+bret
+53
+*
+stack is ok.