aboutsummaryrefslogtreecommitdiff
path: root/tests/core
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 17:36:07 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:36:02 +0200
commita716a809a7467655a3fe4d47e35848cce37a4f88 (patch)
treece5335d1dd5e5dec343c7dd9e192dcbc88e33f7f /tests/core
parente01c9f0a85798f35684fa1b7e4473ecd68238535 (diff)
Use do_run_from_file() for test_ccall
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.