added some tests to help demonstrate Still need to verify the results but looks good for now
This commit is contained in:
26
tests/sprint3/test/sp3_if_else.alpha
Normal file
26
tests/sprint3/test/sp3_if_else.alpha
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
type rec: [character: x; integer: y]
|
||||||
|
|
||||||
|
type T2: rec -> integer
|
||||||
|
|
||||||
|
type main: string -> integer
|
||||||
|
function entry: main
|
||||||
|
function bar: T2
|
||||||
|
|
||||||
|
bar (r,s) := {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry (arg) := {
|
||||||
|
[ integer: result ; rec: w]
|
||||||
|
if ( result = result ) then {
|
||||||
|
result := result + 8;
|
||||||
|
if ( result < w.y ) then {
|
||||||
|
result := 8;
|
||||||
|
} else {
|
||||||
|
result := 9;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result := bar('c', 7);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
27
tests/sprint3/test/sp3_if_while.alpha
Normal file
27
tests/sprint3/test/sp3_if_while.alpha
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
type rec: [character: x; integer: y]
|
||||||
|
|
||||||
|
type T2: rec -> integer
|
||||||
|
|
||||||
|
type main: string -> integer
|
||||||
|
function entry: main
|
||||||
|
function bar: T2
|
||||||
|
|
||||||
|
bar (r,s) := {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry (arg) := {
|
||||||
|
[ integer: result ; rec: w]
|
||||||
|
while ( result = result ) {
|
||||||
|
result := result + 8;
|
||||||
|
if ( result < w.y ) then {
|
||||||
|
while (true) {
|
||||||
|
result := 8;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result := 9;
|
||||||
|
}
|
||||||
|
result := bar('c', 7);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Reference in New Issue
Block a user