TEST: convertion unit tests into run tests
This commit is contained in:
committed by
vvlevchenko
parent
7fd4b4fe34
commit
3fe59cc46c
@@ -1,12 +0,0 @@
|
||||
extern void *resolve_symbol(const char*);
|
||||
|
||||
int
|
||||
run_test() {
|
||||
int (*globalTest)() = resolve_symbol("kfun:globalTest(Int)");
|
||||
int (*getGlobal)() = resolve_symbol("kfun:<get-globalValue>()");
|
||||
|
||||
if (getGlobal() != 1) return 1;
|
||||
if (globalTest(41) != 42) return 1;
|
||||
if (getGlobal() != 42) return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -6,4 +6,11 @@ var global:Int
|
||||
fun globalTest(i:Int):Int {
|
||||
global += i
|
||||
return global
|
||||
}
|
||||
|
||||
|
||||
fun main(args:Array<String>) {
|
||||
if (global != 1) throw Error()
|
||||
if (globalTest(41) != 42) throw Error()
|
||||
if (global != 42) throw Error()
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
extern void *resolve_symbol(const char*);
|
||||
|
||||
int
|
||||
run_test() {
|
||||
int (*primary_constructor)(int, int) = resolve_symbol("kfun:primaryConstructorCall(Int;Int)");
|
||||
int (*secondary_constructor)(int) = resolve_symbol("kfun:secondaryConstructorCall(Int)");
|
||||
|
||||
if (primary_constructor(0xdeadbeef, 41) != 42) return 1;
|
||||
|
||||
if (secondary_constructor(41) != 42) return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -5,4 +5,9 @@ class B(val a:Int, b:Int) {
|
||||
|
||||
fun primaryConstructorCall(a:Int, b:Int) = B(a, b).pos
|
||||
|
||||
fun secondaryConstructorCall(a:Int) = B(a).pos
|
||||
fun secondaryConstructorCall(a:Int) = B(a).pos
|
||||
|
||||
fun main(args:Array<String>) {
|
||||
if (primaryConstructorCall(0xdeadbeef.toInt(), 41) != 42) throw Error()
|
||||
if (secondaryConstructorCall(41) != 42) throw Error()
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
extern void *resolve_symbol(const char*);
|
||||
|
||||
int
|
||||
run_test() {
|
||||
int (*foo)(int, int) = resolve_symbol("kfun:foo(Int;Int)");
|
||||
|
||||
if (foo(2, 3) != 5) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -17,4 +17,8 @@ fun foo(i:Int) : Unit {}
|
||||
fun foo(i:Int, j:Int):Int {
|
||||
val c = D(i, j)
|
||||
return c.c
|
||||
}
|
||||
|
||||
fun main(args:Array<String>) {
|
||||
if (foo(2, 3) != 5) throw Error()
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
extern void *resolve_symbol(const char*);
|
||||
|
||||
int
|
||||
run_test() {
|
||||
int (*fortyTwo)() = resolve_symbol("kfun:fortyTwo()");
|
||||
|
||||
if (fortyTwo() != 42) return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -2,4 +2,8 @@ class A(val a:Int) {
|
||||
fun foo(i:Int) = a + i
|
||||
}
|
||||
|
||||
fun fortyTwo() = A(41).foo(1)
|
||||
fun fortyTwo() = A(41).foo(1)
|
||||
|
||||
fun main(args:Array<String>) {
|
||||
if (fortyTwo() != 42) throw Error()
|
||||
}
|
||||
Reference in New Issue
Block a user