Browse Source

Test a for() loop as well.

pull/50/head
Rafal Kupiec 1 year ago
parent
commit
9d97eb228a
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
2 changed files with 71 additions and 0 deletions
  1. +20
    -0
      tests/loop_for_test.aer
  2. +51
    -0
      tests/loop_for_test.exp

+ 20
- 0
tests/loop_for_test.aer View File

@ -0,0 +1,20 @@
class Program {
public void main() {
int $c = 4;
for(int $a = 0; $a < 10; $a++) {
for(int $b = 0; $b < 10; $b++) {
int $c = 2;
if($b == 2) {
continue;
}
if($b == 6) {
break;
}
print("Hello variables: $a $b $c\n");
}
}
print("Variable \$c: $c\n");
}
}

+ 51
- 0
tests/loop_for_test.exp View File

@ -0,0 +1,51 @@
Hello variables: 0 0 2
Hello variables: 0 1 2
Hello variables: 0 3 2
Hello variables: 0 4 2
Hello variables: 0 5 2
Hello variables: 1 0 2
Hello variables: 1 1 2
Hello variables: 1 3 2
Hello variables: 1 4 2
Hello variables: 1 5 2
Hello variables: 2 0 2
Hello variables: 2 1 2
Hello variables: 2 3 2
Hello variables: 2 4 2
Hello variables: 2 5 2
Hello variables: 3 0 2
Hello variables: 3 1 2
Hello variables: 3 3 2
Hello variables: 3 4 2
Hello variables: 3 5 2
Hello variables: 4 0 2
Hello variables: 4 1 2
Hello variables: 4 3 2
Hello variables: 4 4 2
Hello variables: 4 5 2
Hello variables: 5 0 2
Hello variables: 5 1 2
Hello variables: 5 3 2
Hello variables: 5 4 2
Hello variables: 5 5 2
Hello variables: 6 0 2
Hello variables: 6 1 2
Hello variables: 6 3 2
Hello variables: 6 4 2
Hello variables: 6 5 2
Hello variables: 7 0 2
Hello variables: 7 1 2
Hello variables: 7 3 2
Hello variables: 7 4 2
Hello variables: 7 5 2
Hello variables: 8 0 2
Hello variables: 8 1 2
Hello variables: 8 3 2
Hello variables: 8 4 2
Hello variables: 8 5 2
Hello variables: 9 0 2
Hello variables: 9 1 2
Hello variables: 9 3 2
Hello variables: 9 4 2
Hello variables: 9 5 2
Variable $c: 4

Loading…
Cancel
Save