inter-procedural call test

This commit is contained in:
Vasily Levchenko
2016-10-10 23:13:28 +03:00
committed by Vasily Levchenko
parent 390edc146d
commit 97e31820ae
3 changed files with 16 additions and 1 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
TESTS := sum
TESTS := sum \
sum_foo_bar
BIN_TESTS=$(foreach t, ${TESTS},${t}_test)
@@ -0,0 +1,10 @@
extern void *resolve_symbol(const char*);
int
run_test() {
int (*sum)(int, int) = resolve_symbol("kfun:sumFooBar");
if (sum(2, 3) != 5) return 1;
return 0;
}
@@ -0,0 +1,4 @@
fun foo(a:Int):Int = a
fun bar(a:Int):Int = a
fun sumFooBar(a:Int, b:Int):Int = foo(a) + bar(b)