add test files

This commit is contained in:
pTalanov
2012-02-27 21:55:57 +04:00
parent 645a3a9f2f
commit c21ea8aa86
240 changed files with 16998 additions and 0 deletions
@@ -0,0 +1,9 @@
package foo
class A() {
fun div(other : A) = "hooray"
}
fun box() = ((A() / A()) == "hooray")
@@ -0,0 +1,11 @@
package foo
class A(t : Int) {
var i = t
fun compareTo(other : A) = (this.i - other.i)
}
fun box() : Boolean{
return (A(3) > A(2)) && (A(2) >= A(2)) && (A(1) >= A(0)) && (A(2) <= A(2)) && (A(3) <= A(4)) && (A(0) < A(100))
}
@@ -0,0 +1,9 @@
package foo
class A() {
fun not() = "hooray"
}
fun box() = (!A() == "hooray")
@@ -0,0 +1,32 @@
package foo
class MyInt(i : Int) {
var b = i
fun inc() : MyInt {
b = b + 1;
return this;
}
}
class A() {
var gc = 0
var sc = 0
var b = MyInt(0)
get() {
gc = gc + 1;
return $b;
}
set(a : MyInt) {
sc = sc + 1;
}
}
fun box() : Boolean {
val t = A()
val d = t.b++;
return (t.sc == 1) && (t.gc == 1);
}
@@ -0,0 +1,28 @@
package foo
import java.util.*
class ArrayWrapper<T>() {
val contents = ArrayList<T>()
fun add(item: T) {
contents.add(item)
}
fun plusAssign(rhs: ArrayWrapper<T>) {
contents.addAll(rhs.contents)
}
fun get(index: Int): T {
return contents.get(index)
}
}
fun box(): String {
var v1 = ArrayWrapper<String>()
val v2 = ArrayWrapper<String>()
v1.add("foo")
v2.add("bar")
v1 += v2
return if (v1.contents.size() == 2) "OK" else "fail"
}
@@ -0,0 +1,21 @@
package foo
var a = MyInt()
class MyInt() {
var b = 0
fun inc() : MyInt {
val res = MyInt();
res.b = b;
res.b++;
return res;
}
}
fun box() : Boolean {
a++;
a++;
return (a.b == 2);
}
@@ -0,0 +1,13 @@
package foo
class A() {
fun plus() = "hooray"
fun minus() = "not really"
}
fun box() : Boolean {
var c = A()
return (+c + -c == "hooraynot really")
}
@@ -0,0 +1,17 @@
package foo
class A() {
var message = ""
fun plusAssign(other : A) {
message = message + "!"
}
}
fun box() : Boolean {
var c = A()
c += A()
c += A()
return c.message == "!!"
}
@@ -0,0 +1,12 @@
package foo
class myInt(a : Int) {
val value = a;
fun plus(other : myInt) : myInt = myInt(value + other.value)
}
fun box() : Boolean {
return (myInt(3) + myInt(5)).value == 8
}
@@ -0,0 +1,18 @@
package foo
class MyInt() {
var b = 0
fun inc() : MyInt {
val res = MyInt()
res.b++;
return res;
}
}
fun box() : Boolean {
var c = MyInt()
c++;
return (c.b == 1);
}
@@ -0,0 +1,18 @@
package foo
var a = MyInt()
class MyInt() {
var b = 0
fun inc() : MyInt {
b = b + 1;
return this;
}
}
fun box() : Boolean {
val d = a++;
return (a.b == 1) && (d.b == 1);
}
@@ -0,0 +1,18 @@
package foo
class MyInt() {
var b = 0
fun dec() : MyInt {
val res = MyInt()
res.b++;
return res;
}
}
fun box() : Boolean {
var c = MyInt()
--c;
return (c.b == 1);
}
@@ -0,0 +1,17 @@
package foo
class MyInt() {
var b = 0
fun dec() : MyInt {
b = b + 1;
return this;
}
}
fun box() : Boolean {
var c = MyInt()
val d = --c;
return (c.b == 1);
}
@@ -0,0 +1,15 @@
package foo
class MyInt(i : Int) {
var b = i
fun inc() : MyInt {
b = b++;
return this;
}
}
fun box() : Boolean {
var t = MyInt(0)
t++;
return (t.b == 0)
}
@@ -0,0 +1,15 @@
package foo
class MyInt(i : Int) {
var b = i
fun inc() : MyInt {
b++;
return this;
}
}
fun box() : Boolean {
var t = MyInt(0)
t++;
return (t.b == 1)
}
@@ -0,0 +1,15 @@
package foo
class A() {
var p = "yeah"
fun mod(other : A) : A {
return A();
}
}
fun box() : Boolean {
var c = A()
val d = c;
c %= A();
return (c != d) && (c.p == "yeah")
}