added tests for sprint 2 and 3
This commit is contained in:
@ -0,0 +1,7 @@
|
||||
type rec: [integer: x; integer: y]
|
||||
type main: rec -> integer
|
||||
function test: main
|
||||
|
||||
test (arg, arg2) := {
|
||||
return 0;
|
||||
}
|
37
tests/sprint3/test/sp3_and_or_type_check.alpha
Normal file
37
tests/sprint3/test/sp3_and_or_type_check.alpha
Normal file
@ -0,0 +1,37 @@
|
||||
type rec: [integer: x; integer: y]
|
||||
type main: rec -> integer
|
||||
function test: main
|
||||
|
||||
test (arg, arg2) := {
|
||||
[integer:x; Boolean: b]
|
||||
while (true) {
|
||||
x := 0;
|
||||
}
|
||||
|
||||
while (7) {
|
||||
x := 1;
|
||||
}
|
||||
|
||||
if (true) {
|
||||
x := 1;
|
||||
} else {
|
||||
x := 0;
|
||||
}
|
||||
|
||||
if (x) {
|
||||
x := 0;
|
||||
} else {
|
||||
x := 1;
|
||||
}
|
||||
|
||||
b := b | b;
|
||||
b := b & b;
|
||||
b := 1 | b;
|
||||
b := b | 1;
|
||||
b := b & 1;
|
||||
b := 1 & b;
|
||||
b := 1 = 1;
|
||||
b := 1 = b;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,9 +1,18 @@
|
||||
entry(arg) := {
|
||||
[integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1; character : a]
|
||||
x := 3 + 2 * 8;
|
||||
x := 3 - 2 / 8;
|
||||
x := a * 2 % 8;
|
||||
b2 := 3 * 2 % 8;
|
||||
x := 3 % 2 * 8;
|
||||
x := 3 + arr - 8;
|
||||
type main: string -> integer
|
||||
type rec: [integer: x; integer: y]
|
||||
function entry: main
|
||||
|
||||
entry (arg) := {
|
||||
[integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1; character : a; rec : r]
|
||||
|
||||
x := 3 + 2 * 8;
|
||||
x := 3 - 2 / 8;
|
||||
x := a * 2 % 8;
|
||||
b2 := 3 * 2 % 8;
|
||||
x := 3 % 2 * 8;
|
||||
x := 3 + arr - 8;
|
||||
r.x;
|
||||
a.x;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user