various numeric literals' tests
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user