Browse Source

Factorial test.

pull/50/head
Rafal Kupiec 2 years ago
parent
commit
6927c5c038
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
2 changed files with 16 additions and 0 deletions
  1. +15
    -0
      tests/factorial_test.aer
  2. +1
    -0
      tests/factorial_test.exp

+ 15
- 0
tests/factorial_test.aer View File

@ -0,0 +1,15 @@
class Program {
function factorial(int $num) {
if($num == 0 || $num == 1)
return 1;
else
return $num * $this->factorial($num - 1);
}
function main() {
int $num = 7;
print('Factorial of ', $num, ' is ', $this->factorial($num), '.');
}
}

+ 1
- 0
tests/factorial_test.exp View File

@ -0,0 +1 @@
Factorial of 7 is 5040.

Loading…
Cancel
Save