diff --git a/tests/four/01.zwei b/tests/four/01.zwei deleted file mode 100755 index e646e91..0000000 --- a/tests/four/01.zwei +++ /dev/null @@ -1,3 +0,0 @@ -class a extends b{} - -2 \ No newline at end of file diff --git a/tests/four/02.zwei b/tests/four/02.zwei deleted file mode 100755 index cfb82a5..0000000 --- a/tests/four/02.zwei +++ /dev/null @@ -1,5 +0,0 @@ -class a {} - -class a {} - -2 \ No newline at end of file diff --git a/tests/four/03.zwei b/tests/four/03.zwei deleted file mode 100755 index a26e2db..0000000 --- a/tests/four/03.zwei +++ /dev/null @@ -1,15 +0,0 @@ -class A { - Int x; -} - -class B { - Int x; - Int equal(B that) { - return this.x == that.x - } -} - -{ - printInt(new B(1).equal(new A(2))); - printChar(10); -} diff --git a/tests/four/04.zwei b/tests/four/04.zwei deleted file mode 100755 index 47895f1..0000000 --- a/tests/four/04.zwei +++ /dev/null @@ -1,18 +0,0 @@ -class A { - Int x; -} - -class B { - Int x; - Int equal(B that) { - return this.x == that.x - } -} - -class C extends B{ -} - -{ - printInt(new B(1).equal(new C(2))); - printChar(10); -} diff --git a/tests/four/Factorial.zwei b/tests/four/Factorial.zwei deleted file mode 100755 index 6d1c0b7..0000000 --- a/tests/four/Factorial.zwei +++ /dev/null @@ -1,43 +0,0 @@ -class Factorial { - - // Recursive definition - Int factorial1(Int x) { - return if (x == 0) 1 - else x * this.factorial1(x - 1) - } - - // Tail-recursive definition - Int factorial2_aux(Int x, Int acc) { - return if (x == 0) acc - else this.factorial2_aux(x - 1, acc * x) - } - Int factorial2(Int x) { - return this.factorial2_aux(x, 1) - } - - // Iterative definition - Int factorial3(Int x) { - Int p = 1; - while (x > 0) { - p = p * x; - x = x - 1; - } - return p - } - -} - -class Example { - Null main() { - Factorial fac = new Factorial(); - Int x = 5; - printInt(fac.factorial1(x)); - printChar(10); - printInt(fac.factorial2(x)); - printChar(10); - printInt(fac.factorial3(x)); - printChar(10); - } -} - -new Example().main() diff --git a/tests/four/binopInt.zwei b/tests/four/binopInt.zwei deleted file mode 100755 index 0f314d2..0000000 --- a/tests/four/binopInt.zwei +++ /dev/null @@ -1,2 +0,0 @@ -3>=2 - diff --git a/tests/four/blockvar.zwei b/tests/four/blockvar.zwei deleted file mode 100755 index 4b5ac59..0000000 --- a/tests/four/blockvar.zwei +++ /dev/null @@ -1,4 +0,0 @@ -{ - Int x = 0; - Int y = x; -} diff --git a/tests/four/blockvar_2xerror0.zwei b/tests/four/blockvar_2xerror0.zwei deleted file mode 100755 index 29b53e9..0000000 --- a/tests/four/blockvar_2xerror0.zwei +++ /dev/null @@ -1,5 +0,0 @@ -{ - Int x = 0; - Int y = y; - Int n = z; -} diff --git a/tests/four/blockvar_error0.zwei b/tests/four/blockvar_error0.zwei deleted file mode 100755 index d26a63e..0000000 --- a/tests/four/blockvar_error0.zwei +++ /dev/null @@ -1,4 +0,0 @@ -{ - Int x = 0; - Int y = z; -} diff --git a/tests/four/blockvar_error1.zwei b/tests/four/blockvar_error1.zwei deleted file mode 100755 index 24d6022..0000000 --- a/tests/four/blockvar_error1.zwei +++ /dev/null @@ -1,4 +0,0 @@ -{ - Int x = 0; - Int x = 9; -} diff --git a/tests/four/class00-1.zwei b/tests/four/class00-1.zwei deleted file mode 100755 index e4c61f7..0000000 --- a/tests/four/class00-1.zwei +++ /dev/null @@ -1,3 +0,0 @@ -class SuperClassTest extends unknown {} - -2 \ No newline at end of file diff --git a/tests/four/class00-2.zwei b/tests/four/class00-2.zwei deleted file mode 100755 index 8ad0dc6..0000000 --- a/tests/four/class00-2.zwei +++ /dev/null @@ -1,5 +0,0 @@ -class ClassSymbolTest {} - -class ClassSymbolTest {} - -2 \ No newline at end of file diff --git a/tests/four/class00-3.zwei b/tests/four/class00-3.zwei deleted file mode 100755 index 57bc86a..0000000 --- a/tests/four/class00-3.zwei +++ /dev/null @@ -1,7 +0,0 @@ -class ClassMemberTest { - Int x; // success - RANDOM y; // 3/4 failure of clause 3 (incorrectly typed member) - Int bar() { Int a = 2; return a + 2 } // success -} - -2 \ No newline at end of file diff --git a/tests/four/class00-4.zwei b/tests/four/class00-4.zwei deleted file mode 100755 index fb47ac2..0000000 --- a/tests/four/class00-4.zwei +++ /dev/null @@ -1,7 +0,0 @@ -class ClassMemberTest { - Int x; // success - Null foo() { NONE; } // 4/4 failure of clause 3 (incorrectly typed member) - Int bar() { Int a = 2; return a + 2 } // success -} - -2 \ No newline at end of file diff --git a/tests/four/class00.zwei b/tests/four/class00.zwei deleted file mode 100755 index 7e4cdf4..0000000 --- a/tests/four/class00.zwei +++ /dev/null @@ -1,37 +0,0 @@ -// zweic - test program for class typing -// M. Ganguin, J. Ruffin 2005 - -// Class - -// Superclass typing -class SuperClassTest extends unknown {} // 1/4 failure of clause 1 (incorrectly typed superclass) - -// Class scope typing -class ClassSymbolTest {} class ClassSymbolTest {} // 2/4 failure of clause 2 (class already defined) - -// Class member typing -class ClassMemberTest { - Int x; // success - RANDOM y; // 3/4 failure of clause 3 (incorrectly typed member) - Null foo() { NONE; } // 4/4 failure of clause 3 (incorrectly typed member) - Int bar() { Int a = 2; return a + 2 } // success -} - -// Happy Day Scenario - -class WorkingClassTest { - Int x; - Null y; - Null foo() { - 2 + 2; - } - Int bar() { - Int z = this.x + 2; - return z - } -} // success - -{ - WorkingClassTest w = new WorkingClassTest(3, null); - return w.bar() -} diff --git a/tests/four/classes.zwei b/tests/four/classes.zwei deleted file mode 100755 index 36d06ac..0000000 --- a/tests/four/classes.zwei +++ /dev/null @@ -1,16 +0,0 @@ -class C0 -{ - Int b; -} - -class C1 -{ - Int b; - Int f1(Int a, Int b) - { - this.b; - printInt(a); - return b - } -} -null \ No newline at end of file diff --git a/tests/four/classes0.zwei b/tests/four/classes0.zwei deleted file mode 100755 index d96cac7..0000000 --- a/tests/four/classes0.zwei +++ /dev/null @@ -1,16 +0,0 @@ -class C0 -{ - Int b; -} - -class C1 extends C0 -{ - Int f1(Int a, Int b) - { - Int y = 0; - this.b; - printInt(a); - return y - } -} -null \ No newline at end of file diff --git a/tests/four/classes_error0.zwei b/tests/four/classes_error0.zwei deleted file mode 100755 index 6ae6c52..0000000 --- a/tests/four/classes_error0.zwei +++ /dev/null @@ -1,4 +0,0 @@ -class C1 {} -class C1 {} -null - diff --git a/tests/four/classes_error1.zwei b/tests/four/classes_error1.zwei deleted file mode 100755 index a4ccf0e..0000000 --- a/tests/four/classes_error1.zwei +++ /dev/null @@ -1,3 +0,0 @@ -class C1 {} -class C2 extends C3 {} -null \ No newline at end of file diff --git a/tests/four/classes_error2.zwei b/tests/four/classes_error2.zwei deleted file mode 100755 index 0e36668..0000000 --- a/tests/four/classes_error2.zwei +++ /dev/null @@ -1,5 +0,0 @@ -class C1 { - Int a; - Null a; -} -null \ No newline at end of file diff --git a/tests/four/expr_if.zwei b/tests/four/expr_if.zwei deleted file mode 100755 index c3293d7..0000000 --- a/tests/four/expr_if.zwei +++ /dev/null @@ -1,22 +0,0 @@ -class List { - Int isEmpty() { return this.isEmpty() } - Int head() { return this.head() } - List tail() { return this.tail() } - List cons(Int x) { return this.cons(x) } -} - -class Cons extends List { - Int head; - List tail; - Int isEmpty() { return false } - Int head() { return this.head } - List tail() { return this.tail } - List cons(Int x) { return new Cons(x, this) } -} - -class Nil extends List { - Int isEmpty() { return true } - List cons(Int x) { return new Cons(x, this) } -} - -if(3==2)"e1"else"e2" diff --git a/tests/four/expr_readChar.zwei b/tests/four/expr_readChar.zwei deleted file mode 100755 index 4fe4f78..0000000 --- a/tests/four/expr_readChar.zwei +++ /dev/null @@ -1 +0,0 @@ -readChar diff --git a/tests/four/expr_readInt.zwei b/tests/four/expr_readInt.zwei deleted file mode 100755 index 3e29b45..0000000 --- a/tests/four/expr_readInt.zwei +++ /dev/null @@ -1 +0,0 @@ -readInt diff --git a/tests/four/field00-1.zwei b/tests/four/field00-1.zwei deleted file mode 100755 index 198605d..0000000 --- a/tests/four/field00-1.zwei +++ /dev/null @@ -1,3 +0,0 @@ -class C { UNKNOWN a; } // 1/2 failure of clause 1 (incorrect field type) - -2 \ No newline at end of file diff --git a/tests/four/field00-2.zwei b/tests/four/field00-2.zwei deleted file mode 100755 index 21a9b17..0000000 --- a/tests/four/field00-2.zwei +++ /dev/null @@ -1,3 +0,0 @@ -class B { B b; } // success of clause 2 (recursive class definition) - -2 \ No newline at end of file diff --git a/tests/four/field00-3.zwei b/tests/four/field00-3.zwei deleted file mode 100755 index 85b8a3a..0000000 --- a/tests/four/field00-3.zwei +++ /dev/null @@ -1,9 +0,0 @@ -class foo { - Int a; // success - Null a; // 2/2 failure of clause 3 (field already defined) -} - -{ - foo f = new foo(1); - f.a; // success of clause 4 (class with new field is in scope) -} \ No newline at end of file diff --git a/tests/four/field00.zwei b/tests/four/field00.zwei deleted file mode 100755 index 3978f23..0000000 --- a/tests/four/field00.zwei +++ /dev/null @@ -1,21 +0,0 @@ -// zweic - test program for field typing -// M. Ganguin, J. Ruffin 2005 - -// Field - -// Containing class typing - -class C { UNKNOWN a; } // 1/2 failure of clause 1 (incorrect field type) -class B { B b; } // success of clause 2 (recursive class definition) - -// field name check - -class foo { - Int a; // success - Null a; // 2/2 failure of clause 3 (field already defined) -} - -{ - foo f = new foo(1); - f.a; // success of clause 4 (class with new field is in scope) -} diff --git a/tests/four/functions_error0.zwei b/tests/four/functions_error0.zwei deleted file mode 100755 index ff0049b..0000000 --- a/tests/four/functions_error0.zwei +++ /dev/null @@ -1,5 +0,0 @@ -class C1 { - Int f1(){} - Int f1(){} -} -null \ No newline at end of file diff --git a/tests/four/functions_error1.zwei b/tests/four/functions_error1.zwei deleted file mode 100755 index 7bc19b0..0000000 --- a/tests/four/functions_error1.zwei +++ /dev/null @@ -1,5 +0,0 @@ -class C1 { - Null f1(){} - Int f2(){} -} -null \ No newline at end of file diff --git a/tests/four/method00-1.zwei b/tests/four/method00-1.zwei deleted file mode 100755 index c40f734..0000000 --- a/tests/four/method00-1.zwei +++ /dev/null @@ -1,7 +0,0 @@ -// Method - -class MethodTest { - UNKNOWN foo() {} // 1/5 failure of clause 1 (incorrectly typed return type) -} - -2 \ No newline at end of file diff --git a/tests/four/method00-2.zwei b/tests/four/method00-2.zwei deleted file mode 100755 index 3bc12a5..0000000 --- a/tests/four/method00-2.zwei +++ /dev/null @@ -1,5 +0,0 @@ -class MethodTest { - Null bar(Int a, Null b, UNKNOWN c) {} // 2/5 failure of clause 1 (incorrectly typed arguments) -} - -2 \ No newline at end of file diff --git a/tests/four/method00-3.zwei b/tests/four/method00-3.zwei deleted file mode 100755 index a62d908..0000000 --- a/tests/four/method00-3.zwei +++ /dev/null @@ -1,19 +0,0 @@ -// zweic - test program for method typing -// M. Ganguin, J. Ruffin 2005 - -class foo {} -class bar extends foo {} -class baz extends bar {} - -// Method - -class MethodTest { - - bar overrideTest(bar a, bar b) { return new bar() } // success of clause 3 - - foo overrideTest(bar a, bar b) { // 3/5 failure of clauses 3 and 4 (return type not subtype of bar) - return new bar() - } -} - -0 diff --git a/tests/four/method00-4.zwei b/tests/four/method00-4.zwei deleted file mode 100755 index 541eb1a..0000000 --- a/tests/four/method00-4.zwei +++ /dev/null @@ -1,17 +0,0 @@ -class foo {} -class bar extends foo {} -class baz extends bar {} - -// Method - -class MethodTest { - - bar overrideTest(bar a, bar b) { return new bar() } // success of clause 3 - - bar overrideTest(baz a, bar b) { // 4/5 failure of clauses 3 and 4 (parameter type not supertype of bar) - return new bar() - } - -} - -0 \ No newline at end of file diff --git a/tests/four/method00-5.zwei b/tests/four/method00-5.zwei deleted file mode 100755 index 66e0c52..0000000 --- a/tests/four/method00-5.zwei +++ /dev/null @@ -1,12 +0,0 @@ -class foo {} -class bar extends foo {} -class baz extends bar {} - -// Method - -class MethodTest { - bar returnExpressionTypeTest() { return new foo() } // 5/5 failure of clause 7 (expression type not subtype of declared return type) - -} - -0 \ No newline at end of file diff --git a/tests/four/method00-6.zwei b/tests/four/method00-6.zwei deleted file mode 100755 index 6f9b378..0000000 --- a/tests/four/method00-6.zwei +++ /dev/null @@ -1,9 +0,0 @@ -// Method - -class MethodTest { - MethodTest classReturnTest() { // success of clause 2 (containing class as return type) - return this - } -} - -0 diff --git a/tests/four/method00-7.zwei b/tests/four/method00-7.zwei deleted file mode 100755 index f912336..0000000 --- a/tests/four/method00-7.zwei +++ /dev/null @@ -1,20 +0,0 @@ -// zweic - test program for method typing -// M. Ganguin, J. Ruffin 2005 - -class foo {} -class bar extends foo {} -class baz extends bar {} - -// Method - -class MethodTest { - - bar overrideTest(bar a, bar b) { return new bar() } // success of clause 3 - - baz overrideTest(foo a, foo b) { // successful override - return new baz() // success (polymorphism) - } - -} - -0 diff --git a/tests/four/method00-8.zwei b/tests/four/method00-8.zwei deleted file mode 100755 index 8386d72..0000000 --- a/tests/four/method00-8.zwei +++ /dev/null @@ -1,18 +0,0 @@ -// zweic - test program for method typing -// M. Ganguin, J. Ruffin 2005 - -class foo {} -class bar extends foo {} -class baz extends bar {} - -// Method - -class MethodTest { - Null varScopeTest(Int a, foo f) { - Int b = a; // success of clause 6 (parameter in variable scope) - foo g = f; // success of clause 6 (parameter in variable scope) - MethodTest m = this; // success of clause 6 (this in variable scope) - } -} - -0 diff --git a/tests/four/method00-9.zwei b/tests/four/method00-9.zwei deleted file mode 100755 index 9df4a27..0000000 --- a/tests/four/method00-9.zwei +++ /dev/null @@ -1,15 +0,0 @@ -// zweic - test program for method typing -// M. Ganguin, J. Ruffin 2005 - -class foo {} -class bar extends foo {} -class baz extends bar {} - -// Method - -class MethodTest { - bar returnExpressionTypeTest2() { return new baz() } // success of clause 7 - -} - -0 diff --git a/tests/four/method00.zwei b/tests/four/method00.zwei deleted file mode 100755 index d637cea..0000000 --- a/tests/four/method00.zwei +++ /dev/null @@ -1,45 +0,0 @@ -// zweic - test program for method typing -// M. Ganguin, J. Ruffin 2005 - -class foo {} -class bar extends foo {} -class baz extends bar {} - -// Method - -class MethodTest { - UNKNOWN foo() {} // 1/5 failure of clause 1 (incorrectly typed return type) - - Null bar(Int a, Null b, UNKNOWN c) {} // 2/5 failure of clause 1 (incorrectly typed arguments) - - MethodTest classReturnTest() { // success of clause 2 (containing class as return type) - return this - } - - bar overrideTest(bar a, bar b) { return new bar() } // success of clause 3 - - foo overrideTest(bar a, bar b) { // 3/5 failure of clauses 3 and 4 (return type not subtype of bar) - return new bar() - } - - bar overrideTest(baz a, bar b) { // 4/5 failure of clauses 3 and 4 (parameter type not supertype of bar) - return new bar() - } - - baz overrideTest(foo a, foo b) { // successful override - return new baz() // success (polymorphism) - } - - Null varScopeTest(Int a, foo f) { - Int b = a; // success of clause 6 (parameter in variable scope) - foo g = f; // success of clause 6 (parameter in variable scope) - MethodTest m = this; // success of clause 6 (this in variable scope) - } - - bar returnExpressionTypeTest() { return new foo() } // 5/5 failure of clause 7 (expression type not subtype of declared return type) - - bar returnExpressionTypeTest2() { return new baz() } // success of clause 7 - -} - -0 diff --git a/tests/four/new.zwei b/tests/four/new.zwei deleted file mode 100755 index 8acf2b4..0000000 --- a/tests/four/new.zwei +++ /dev/null @@ -1,6 +0,0 @@ -class c1 { -Int a; -Int b; -Null g; -} -new c1(7, 2, null) diff --git a/tests/four/new_error0.zwei b/tests/four/new_error0.zwei deleted file mode 100755 index ae585ee..0000000 --- a/tests/four/new_error0.zwei +++ /dev/null @@ -1,6 +0,0 @@ -class c1 { -Int a; -Int b; -Null g; -} -new c1(null, 7, 8) diff --git a/tests/four/new_error1.zwei b/tests/four/new_error1.zwei deleted file mode 100755 index 9684d02..0000000 --- a/tests/four/new_error1.zwei +++ /dev/null @@ -1,6 +0,0 @@ -class c1 { -Int a; -Int b; -Null g; -} -new c1(7, null) diff --git a/tests/four/null.zwei b/tests/four/null.zwei deleted file mode 100755 index d234dd4..0000000 --- a/tests/four/null.zwei +++ /dev/null @@ -1,4 +0,0 @@ -class C1 { - Null a; -} -null \ No newline at end of file diff --git a/tests/four/printChar.zwei b/tests/four/printChar.zwei deleted file mode 100755 index 8db60f0..0000000 --- a/tests/four/printChar.zwei +++ /dev/null @@ -1,3 +0,0 @@ -{ - printChar(readInt); -} \ No newline at end of file diff --git a/tests/four/printChar_error0.zwei b/tests/four/printChar_error0.zwei deleted file mode 100755 index ff56775..0000000 --- a/tests/four/printChar_error0.zwei +++ /dev/null @@ -1,3 +0,0 @@ -{ - printChar("str1"); -} \ No newline at end of file diff --git a/tests/four/printInt.zwei b/tests/four/printInt.zwei deleted file mode 100755 index a3058a8..0000000 --- a/tests/four/printInt.zwei +++ /dev/null @@ -1,3 +0,0 @@ -{ - printInt(2); -} \ No newline at end of file diff --git a/tests/four/program00-1.zwei b/tests/four/program00-1.zwei deleted file mode 100755 index f53d1eb..0000000 --- a/tests/four/program00-1.zwei +++ /dev/null @@ -1,3 +0,0 @@ -class foo { RANDOM k; } - -1 \ No newline at end of file diff --git a/tests/four/program00-2.zwei b/tests/four/program00-2.zwei deleted file mode 100755 index 2a037ef..0000000 --- a/tests/four/program00-2.zwei +++ /dev/null @@ -1,3 +0,0 @@ -class foo { Int k; } - -k // 2/2 failure of clause 2 (incorrectly typed expression) diff --git a/tests/four/program00.zwei b/tests/four/program00.zwei deleted file mode 100755 index 0c4733d..0000000 --- a/tests/four/program00.zwei +++ /dev/null @@ -1,6 +0,0 @@ -// zweic - test program for... program testing -// M. Ganguin, J. Ruffin 2005 - -class foo { RANDOM k; } // 1/2 failure of clause 1 (incorrect classes) - -k // 2/2 failure of clause 2 (incorrectly typed expression) diff --git a/tests/four/select.zwei b/tests/four/select.zwei deleted file mode 100755 index 243038f..0000000 --- a/tests/four/select.zwei +++ /dev/null @@ -1,6 +0,0 @@ -class c1 { -Int a; -Int b; -Null g; -} -new c1(5, 7, null).a diff --git a/tests/four/statement-do.zwei b/tests/four/statement-do.zwei deleted file mode 100755 index a535f38..0000000 --- a/tests/four/statement-do.zwei +++ /dev/null @@ -1,10 +0,0 @@ -// Do -class DoTest { - Null foo() { - Null k = null; - 2 + k; // 1/1 failure of clause 1 (incorrectly typed expression) - 2 + 2; // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/statement-printChar.zwei b/tests/four/statement-printChar.zwei deleted file mode 100755 index f55b033..0000000 --- a/tests/four/statement-printChar.zwei +++ /dev/null @@ -1,12 +0,0 @@ -// PrintChar - -class foo{} - -class PrintCharTest { - Null foo() { - printChar(new foo()); // 1/1 failure of clause 1 (type must be Int) - printChar(2); //success - } -} - -0 \ No newline at end of file diff --git a/tests/four/statement-printInt.zwei b/tests/four/statement-printInt.zwei deleted file mode 100755 index 3a345f7..0000000 --- a/tests/four/statement-printInt.zwei +++ /dev/null @@ -1,12 +0,0 @@ -// PrintInt - -class foo {} - -class PrintIntTest { - Null foo() { - printInt(new foo()); // 1/1 failure of clause 1 (type must be Int) - printInt(2); //success - } -} - -1 \ No newline at end of file diff --git a/tests/four/statement-set.zwei b/tests/four/statement-set.zwei deleted file mode 100755 index 0ee42db..0000000 --- a/tests/four/statement-set.zwei +++ /dev/null @@ -1,17 +0,0 @@ -class foo {} -class bar extends foo {} -class baz {} - -// Set -class SetTest { - Null foo() { - Int n = 1; - bar b = new bar(); - s = 2; // 1/3 failure of clause 1 (nonexistent variable) - n = new foo(); // 2/3 failure of clauses 2 and 3 (subtype mismatch) - b = new foo(); // 3/3 failure of clauses 2 and 3 (inverted sub- and supertypes) - b = new bar(); // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/statement-var.zwei b/tests/four/statement-var.zwei deleted file mode 100755 index 9323e6a..0000000 --- a/tests/four/statement-var.zwei +++ /dev/null @@ -1,16 +0,0 @@ -// Var -class foo {} -class bar extends foo {} -class baz {} -class VarTest { - Null foo() { - Int n = 1; - nonexistent ne = new nonexistent(); // 1/4 failure of clause 1 (nonexistent type) - baz b = new foo(); // 2/4 failure of clause 2 (subtype mismatch) - bar f = new foo(); // 3/4 failure of clause 2 (inverted sub- and supertypes) - Int n = 2; // 4/4 failure of clause 3 (variable n already exists) - Int z = 3; // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/statement-while.zwei b/tests/four/statement-while.zwei deleted file mode 100755 index 42b1970..0000000 --- a/tests/four/statement-while.zwei +++ /dev/null @@ -1,12 +0,0 @@ -// While -class WhileTest { - Null foo() { - Int t = 0; - Null n = null; - while(n) {} // 1/2 failure of clause 1 (condition type not Int) - while(t) { Int s = null; } // 2/2 failure of clause 2 (incorrectly typed statement) - while(t) { Int s = 0; } // correct - } -} - -1 \ No newline at end of file diff --git a/tests/four/statement00.zwei b/tests/four/statement00.zwei deleted file mode 100755 index 4db29a1..0000000 --- a/tests/four/statement00.zwei +++ /dev/null @@ -1,67 +0,0 @@ -// zweic - test program for statement testing -// M. Ganguin, J. Ruffin 2005 - -// While -class WhileTest { - Null foo() { - Int t = 0; - Null n = null; - while(n) {} // 1/2 failure of clause 1 (condition type not Int) - while(t) { Int s = null; } // 2/2 failure of clause 2 (incorrectly typed statement) - while(t) { Int s = 0; } // correct - } -} - -// Var -class foo {} -class bar extends foo {} -class baz {} -class VarTest { - Null foo() { - Int n = 1; - nonexistent ne = new nonexistent(); // 1/4 failure of clause 1 (nonexistent type) - baz b = new foo(); // 2/4 failure of clause 2 (subtype mismatch) - bar f = new foo(); // 3/4 failure of clause 2 (inverted sub- and supertypes) - Int n = 2; // 4/4 failure of clause 3 (variable n already exists) - Int z = 3; // success - } -} - -// Set -class SetTest { - Null foo() { - Int n = 1; - bar b = new bar(); - s = 2; // 1/3 failure of clause 1 (nonexistent variable) - n = new foo(); // 2/3 failure of clauses 2 and 3 (subtype mismatch) - b = new foo(); // 3/3 failure of clauses 2 and 3 (inverted sub- and supertypes) - b = new bar(); // success - } -} - -// Do -class DoTest { - Null foo() { - Null k = null; - 2 + k; // 1/1 failure of clause 1 (incorrectly typed expression) - 2 + 2; // success - } -} - -// PrintInt -class PrintIntTest { - Null foo() { - printInt(new foo()); // 1/1 failure of clause 1 (type must be Int) - printInt(2); //success - } -} - -// PrintChar -class PrintCharTest { - Null foo() { - printChar(new foo()); // 1/1 failure of clause 1 (type must be Int) - printChar(2); //success - } -} - -0 diff --git a/tests/four/term-binop.zwei b/tests/four/term-binop.zwei deleted file mode 100755 index 3549c41..0000000 --- a/tests/four/term-binop.zwei +++ /dev/null @@ -1,15 +0,0 @@ -// Binop -class BinOpTest { - Null foo() { - Int x1 = 2; - Int x2 = 3; - Null z = null; - k + x2; // 1/4 failure of clause 1 (nonexistent ident) - x1 + l; // 2/4 failure of clause 2 (nonexistent ident) - z + x2; // 3/4 failure of clause 1 (type of ident not Int) - x1 + z; // 4/4 failure of clause 2 (type of ident not Int) - x1 + x2; // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/term-block.zwei b/tests/four/term-block.zwei deleted file mode 100755 index bf35a65..0000000 --- a/tests/four/term-block.zwei +++ /dev/null @@ -1,38 +0,0 @@ -// Block - -// Select -class bar { - Int h; -} - -class bof extends bar {} - -class IfTest { - Null foo() { - Int t = 0; - - bar b = new bar(2); - bar z = new bof(3); - - bar y = if (t) b else z; // 7/7 failure of clause 3 (return type mismatch) - } -} - -class BlockTest { - Null foo() { - { - Int x = null; // 1/2 failure of clause 1 (incorrectly typed statement in block) - return x - }; - { - Int x = 2; - return y // 2/2 failure of clause 2 (expression not in block scope) - }; - { - Int x = 2; - return x // success - }; - } -} - -0 \ No newline at end of file diff --git a/tests/four/term-call.zwei b/tests/four/term-call.zwei deleted file mode 100755 index b1697d7..0000000 --- a/tests/four/term-call.zwei +++ /dev/null @@ -1,28 +0,0 @@ -// Call - -class foo { - Int y; -} - -class bar { - Int h; -} - -class bof extends bar {} - -class baz { - Int x; - Null works(Int a, bar c) {} - Null foo() { - bof b = new bof(1); - foo h = new foo(1); - baz z = new baz(1); - k.foo(); // 1/4 failure of clauses 1 and 2 (nonexistent ident) - h.gneuh(); // 2/4 failure of clause 3 (nonexistent method) - z.works(1); // 3/4 failure of clause 3 (wrong number of arguments) - z.works(1, h); // 4/4 failure of clause 4 (parameter not subtype of bof) - z.works(2, b); // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/term-ident.zwei b/tests/four/term-ident.zwei deleted file mode 100755 index c368639..0000000 --- a/tests/four/term-ident.zwei +++ /dev/null @@ -1,11 +0,0 @@ -// Ident -class foo { - Int y; - Null bar() { - Int x = 0; - y; // 1/1 failure of clause 1 - x; // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/term-if.zwei b/tests/four/term-if.zwei deleted file mode 100755 index 20356e7..0000000 --- a/tests/four/term-if.zwei +++ /dev/null @@ -1,33 +0,0 @@ -// If - -class foo { - Int y; -} - -class bar { - Int h; -} - -class bof extends bar {} - -class IfTest { - Null foo() { - Int t = 0; - Null n = null; - - bar b = new bar(2); - bof z = new bof(3); - - if(k) {} else {}; // 1/7 failure of clause 1 (nonexistent condition) - if(n) {} else {}; // 2/7 failure of clause 1 (condition not Int) - if(t) {gorh g = null;return g} else 2; // 3/7 failure of clause 2 (unknown type) - if(t) 2 else {gorh g = null;return g }; // 4/7 failure of clause 2 (unknown type) - if(t) {foo f = new foo(1);return f} else 2; // 5/7 failure of clause 3 (LUB not found) - if(t) 2 else {foo f = new foo(2);return f}; // 6/7 failure of clause 3 (LUB not found) - bof y = if (t) b else z; // 7/7 failure of clause 3 (return type mismatch) - if(t) 2 else 3; // success - if(t) b else z; // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/term-new.zwei b/tests/four/term-new.zwei deleted file mode 100755 index 4ce7b83..0000000 --- a/tests/four/term-new.zwei +++ /dev/null @@ -1,24 +0,0 @@ -// New - -class foo { - Int y; -} - -class bar { - Int h; -} - -class bof extends bar {} - -class testnew { - Int x; - Null foo() { - bof bof = new bof(3); - new unknown(); // 1/3 failure of clause 1 (nonexistent class) - bar b = new bar(); // 2/3 failure of clauses 2 and 3 (wrong number of arguments) - bar c = new bar(bof); // 3/3 failure of clauses 2 and 3 (argument not subtype of Int) - foo f = new foo(1); // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/term-objComp.zwei b/tests/four/term-objComp.zwei deleted file mode 100755 index ee16673..0000000 --- a/tests/four/term-objComp.zwei +++ /dev/null @@ -1,27 +0,0 @@ -// ObjComp - -class foo { - Int y; -} - -class bar { - Int h; -} - -class bof extends bar {} - -class ObjCompTest { - Null foo() { - bar b = new bar(1); - bof z = new bof(1); - foo f = new foo(2); - f + b; // 1/5 failure of clause 1 (binop not == or !=) - k == b; // 2/5 failure of clause 2 (nonexistent ident) - b == l; // 3/5 failure of clause 2 (nonexistent ident) - f == b; // 4/5 failure of clause 3 (subtype mismatch) - b == f; // 5/5 failure of clause 3 (subtype mismatch) - z == b; // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/term-select.zwei b/tests/four/term-select.zwei deleted file mode 100755 index 0b1a41e..0000000 --- a/tests/four/term-select.zwei +++ /dev/null @@ -1,19 +0,0 @@ -// Select - -class foo { - Int y; -} - -class bar { - Int h; - Null foo() { - foo f = new foo(1); - this.h; // success in returning own attributes - k.h; // 1/2 failure of clauses 1 and 2 (nonexistent ident) - bar h = new bar(1); // success of recursive class definition - f.x; // 2/2 failure of clause 3 - f.y; // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/term-unop.zwei b/tests/four/term-unop.zwei deleted file mode 100755 index 6e6fa13..0000000 --- a/tests/four/term-unop.zwei +++ /dev/null @@ -1,13 +0,0 @@ -// UnOp -class UnOpTest { - Null foo() { - Int x = 2; - Null z = null; - -y; // 1/2 failure of clause 1 (nonexistent ident) - -z; // 2/2 failure of clause 1 (ident not of type Int) - -x; // success - !x; // success - } -} - -1 \ No newline at end of file diff --git a/tests/four/term00.zwei b/tests/four/term00.zwei deleted file mode 100755 index 5f3b190..0000000 --- a/tests/four/term00.zwei +++ /dev/null @@ -1,142 +0,0 @@ -// zweic - test program for term typing checks -// M. Ganguin, J. Ruffin 2005 - -// Ident -class foo { - Int y; - Null bar() { - Int x = 0; - y; // 1/1 failure of clause 1 - x; // success - } -} - -// Select -class bar { - Int h; - Null foo() { - foo f = new foo(1); - k.h; // 1/2 failure of clauses 1 and 2 (nonexistent ident) - bar h = new bar(1); // success of recursive class definition - f.x; // 2/2 failure of clause 3 - f.y; // success - } -} - -// Call -class bof extends bar { -} -class baz { - Int x; - Null works(Int a, bar c) {} - Null foo() { - bof b = new bof(1); - foo h = new foo(1); - baz z = new baz(1); - k.foo(); // 1/4 failure of clauses 1 and 2 (nonexistent ident) - h.gneuh(); // 2/4 failure of clause 3 (nonexistent method) - z.works(1); // 3/4 failure of clause 3 (wrong number of arguments) - z.works(1, h); // 4/4 failure of clause 4 (parameter not subtype of bof) - z.works(2, b); // success - } -} - -// New -class testnew { - Int x; - Null foo() { - new unknown(); // 1/3 failure of clause 1 (nonexistent class) - bar b = new bar(); // 2/3 failure of clauses 2 and 3 (wrong number of arguments) - bar c = new bar(bof); // 3/3 failure of clauses 2 and 3 (argument not subtype of Int) - foo f = new foo(1); // success - } -} - -// IntLit : untestable -// NullLit : untestable - -// UnOp -class UnOpTest { - Null foo() { - Int x = 2; - Null z = null; - -y; // 1/2 failure of clause 1 (nonexistent ident) - -z; // 2/2 failure of clause 1 (ident not of type Int) - -x; // success - !x; // success - } -} - -// Binop -class BinOpTest { - Null foo() { - Int x1 = 2; - Int x2 = 3; - Null z = null; - k + x2; // 1/4 failure of clause 1 (nonexistent ident) - x1 + l; // 2/4 failure of clause 2 (nonexistent ident) - z + x2; // 3/4 failure of clause 1 (type of ident not Int) - x1 + z; // 4/4 failure of clause 2 (type of ident not Int) - x1 + x2; // success - } -} - -// ObjComp -class ObjCompTest { - Null foo() { - bar b = new bar(1); - bof z = new bof(1); - foo f = new foo(2); - f + b; // 1/5 failure of clause 1 (binop not == or !=) - k == b; // 2/5 failure of clause 2 (nonexistent ident) - b == l; // 3/5 failure of clause 2 (nonexistent ident) - f == b; // 4/5 failure of clause 3 (subtype mismatch) - b == f; // 5/5 failure of clause 3 (subtype mismatch) - z == b; // success - } -} - -// ReadInt : untestable -// ReadChar : untestable - -// If -class IfTest { - Null foo() { - Int t = 0; - Null n = null; - - bar b = new bar(2); - bof z = new bof(3); - - if(k) {} else {}; // 1/7 failure of clause 1 (nonexistent condition) - if(n) {} else {}; // 2/7 failure of clause 1 (condition not Int) - if(t) {gorh g = null;return g} else 2; // 3/7 failure of clause 2 (unknown type) - if(t) 2 else {gorh g = null;return g }; // 4/7 failure of clause 2 (unknown type) - if(t) {foo f = new foo(1);return f} else 2; // 5/7 failure of clause 3 (LUB not found) - if(t) 2 else {foo f = new foo(2);return f}; // 6/7 failure of clause 3 (LUB not found) - bof y = if (t) b else z; // 7/7 failure of clause 3 (return type mismatch) - if(t) 2 else 3; // success - if(t) b else z; // success - } -} - -// Block - -class BlockTest { - Null foo() { - { - Int x = null; // 1/2 failure of clause 1 (incorrectly typed statement in block) - return x - }; - { - Int x = 2; - return y // 2/2 failure of clause 2 (expression not in block scope) - }; - { - Int x = 2; - return x // success - }; - } -} - -0 diff --git a/tests/four/unop.zwei b/tests/four/unop.zwei deleted file mode 100755 index a83d1d5..0000000 --- a/tests/four/unop.zwei +++ /dev/null @@ -1 +0,0 @@ --3 diff --git a/tests/four/unopa.zwei b/tests/four/unopa.zwei deleted file mode 100755 index 386d600..0000000 --- a/tests/four/unopa.zwei +++ /dev/null @@ -1,4 +0,0 @@ -{ - Int a = 0; - -a; -} \ No newline at end of file diff --git a/tests/four/unopa_error1.zwei b/tests/four/unopa_error1.zwei deleted file mode 100755 index 77be693..0000000 --- a/tests/four/unopa_error1.zwei +++ /dev/null @@ -1,4 +0,0 @@ -{ - Int a = 0; - -b; -} \ No newline at end of file diff --git a/tests/four/varScope_error0.zwei b/tests/four/varScope_error0.zwei deleted file mode 100755 index 051ecbe..0000000 --- a/tests/four/varScope_error0.zwei +++ /dev/null @@ -1,13 +0,0 @@ -class C0 -{ - Int f0 () - { - Int a = 0; - return a - } - Int f1 () - { - return a - } -} -null \ No newline at end of file