add Fibonacci sequence
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Thu, 26 Jan 2023 15:27:40 +0000 (16:27 +0100)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Thu, 26 Jan 2023 15:27:40 +0000 (16:27 +0100)
calc.c

diff --git a/calc.c b/calc.c
index ed67da48d9213056622de979c5e371cdaba10450..439ab24558124648d5b95bc062bb12398a3fb15a 100644 (file)
--- a/calc.c
+++ b/calc.c
@@ -299,4 +299,7 @@ int main (int argc, char *argv[])
 // test: echo -e '{\n{}\n{1, 2\n{sto (1, 1 + 1),\npow(2, {sto (1, 1 + 2), 2}, {rcl(2)})\n2 {sto (1, 1 + 1)}' | calc.exe | grep -c error | xargs test 6 =
 // test: echo -e '1 }\n1 )\n1 , 2\n ' | calc.exe | grep -c error | xargs test 3 =
 
+// Fibonacci sequence
+// test:  echo -e '{sto (1, 1), sto (2, 1), sto (10, 1), whl (inc (10) < 12 - 1, {sto (3, rcl (1) + rcl (2)), sto (1, rcl (2)), sto (2, rcl (3))})}' | calc.exe | grep '=> 144'
+
 /* vim: set ts=4 sw=4 et: */