diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-03-07 17:47:31 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-03-07 23:17:37 +0100 |
| commit | 50d6472d56091d0fece3fb87837a3931215603e4 (patch) | |
| tree | 99459427dab6085a41b687fb0919d442215a8a31 /progs/tests/factorial.sy | |
| parent | 3974ce7c4f0623cef3fcf0abf95d8be6a54d3b44 (diff) | |
| download | sylt-50d6472d56091d0fece3fb87837a3931215603e4.tar.gz | |
move the tests
Diffstat (limited to 'progs/tests/factorial.sy')
| -rw-r--r-- | progs/tests/factorial.sy | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/progs/tests/factorial.sy b/progs/tests/factorial.sy new file mode 100644 index 0000000..770bc33 --- /dev/null +++ b/progs/tests/factorial.sy @@ -0,0 +1,12 @@ +factorial :: fn n: int -> int { + if n <= 1 { + ret 1 + } + ret n * factorial(n - 1) +} + +start :: fn { + factorial(5) <=> 120 + factorial(6) <=> 720 + factorial(12) <=> 479001600 +} |
