From 8fc760f4b4691a1a6bbe8738ee6320c2c17063d6 Mon Sep 17 00:00:00 2001 From: Chris Lane Date: Fri, 25 Nov 2016 15:26:33 +0000 Subject: [PATCH] Add fibonacci test --- tests/compile/success/fibonacci.src | 15 +++++++++++++++ tests/compile/success/output/fibonacci.out | 10 ++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/compile/success/fibonacci.src create mode 100644 tests/compile/success/output/fibonacci.out diff --git a/tests/compile/success/fibonacci.src b/tests/compile/success/fibonacci.src new file mode 100644 index 0000000..18ac3a2 --- /dev/null +++ b/tests/compile/success/fibonacci.src @@ -0,0 +1,15 @@ +// This test will evaluate to print fibonacci numbers less than 50. +main () { + var x = 50; + var a = 0; + var b = 1; + + print $a; + var temp = 0; + while ($b <= ($x-1)) { + print $b; + temp = $a + $b; + a = $b; + b = $temp; + }; +} diff --git a/tests/compile/success/output/fibonacci.out b/tests/compile/success/output/fibonacci.out new file mode 100644 index 0000000..f6cdd59 --- /dev/null +++ b/tests/compile/success/output/fibonacci.out @@ -0,0 +1,10 @@ +0 +1 +1 +2 +3 +5 +8 +13 +21 +34