various numeric literals' tests

This commit is contained in:
Konstantin Anisimov
2016-10-28 12:27:12 +03:00
parent cc47ed98f3
commit f02e0af5a2
7 changed files with 48 additions and 1 deletions
+14 -1
View File
@@ -88,4 +88,17 @@ task aritmetic(type: KonanTest) {
task sum1(type: KonanTest) {
source = "codegen/function/sum_foo_bar.kt"
}
}
task sum2(type: KonanTest) {
source = "codegen/function/sum_imm.kt"
}
task sum_3const(type: KonanTest) {
source = "codegen/function/sum_3const.kt"
}
// TODO: waiting for boolean to be implemented
//task bool_yes(type: KonanTest) {
// source = "codegen/function/boolean.kt"
//}
@@ -0,0 +1,10 @@
extern void *resolve_symbol(const char*);
int
run_test() {
int (*bool_yes)() = resolve_symbol("kfun:bool_yes");
if (!bool_yes()) return 1;
return 0;
}
@@ -0,0 +1 @@
fun bool_yes(): Boolean = true
@@ -0,0 +1,10 @@
extern void *resolve_symbol(const char*);
int
run_test() {
int (*sum3)() = resolve_symbol("kfun:sum3");
if (sum3() != 36) return 1;
return 0;
}
@@ -0,0 +1,2 @@
fun sum3():Int = sum(1, 2, 33)
fun sum(a:Int, b:Int, c:Int): Int = a + b + c
@@ -0,0 +1,10 @@
extern void *resolve_symbol(const char*);
int
run_test() {
int (*sum)(int) = resolve_symbol("kfun:sum");
if (sum(2) != 35) return 1;
return 0;
}
@@ -0,0 +1 @@
fun sum(a:Int): Int = a + 33