Tests for "PLUSEQ" and "MINUSEQ"

This commit is contained in:
Konstantin Anisimov
2016-11-02 18:32:17 +03:00
committed by vvlevchenko
parent a022b7d1ab
commit ea149fab4e
5 changed files with 38 additions and 0 deletions
+8
View File
@@ -202,3 +202,11 @@ task bool_yes(type: UnitKonanTest) {
source = "codegen/function/boolean.kt"
}
task plus_eq(type: UnitKonanTest) {
source = "codegen/function/plus_eq.kt"
}
task minus_eq(type: UnitKonanTest) {
source = "codegen/function/minus_eq.kt"
}
@@ -0,0 +1,10 @@
extern void *resolve_symbol(const char*);
int
run_test() {
int (*plus_eq)(int) = resolve_symbol("kfun:minus_eq");
if (plus_eq(23) != 12) return 1;
return 0;
}
@@ -0,0 +1,5 @@
fun minus_eq(a: Int): Int {
var b = 11
b -= a
return b
}
@@ -0,0 +1,10 @@
extern void *resolve_symbol(const char*);
int
run_test() {
int (*plus_eq)(int) = resolve_symbol("kfun:plus_eq");
if (plus_eq(3) != 14) return 1;
return 0;
}
@@ -0,0 +1,5 @@
fun plus_eq(a: Int): Int {
var b = 11
b += a
return b
}