X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=calc.c;h=8081c804963290490c166fef5eb5cf1d1ef2425c;hb=715580ff81a00316fb8033d4ca2ceae4a2cafd94;hp=eee39fe0b54cc34dcd1fb13eab0f0d85d94ef08a;hpb=db660e6002e8834814ea9beb943dc8dd951fe21c;p=calc.git diff --git a/calc.c b/calc.c index eee39fe..8081c80 100644 --- a/calc.c +++ b/calc.c @@ -133,7 +133,6 @@ int main (int argc, char *argv[]) } /* format */ - char format[9] = "=> %..g\n"; format[5] = '0' + precision; /* completion list*/ @@ -336,7 +335,10 @@ int main (int argc, char *argv[]) // test: echo -e '1 }\n1 )\n1 , 2\n ' | calc.exe | grep -c error | xargs test 3 = // test: echo -e 'si\t\t (pi / 2)' | calc.exe | grep -q '=> 1' +// Gauss sequence +// test: echo -e '{sto (1, 0), sto (10, 0), while (inc (10) < 100, {sto (1, rcl (1) + rcl (10)), print (rcl (1))})}' | calc.exe | grep -q '=> 5050' + // Fibonacci sequence -// test: echo -e '{sto (1, 1), sto (2, 1), sto (10, 1), while (inc (10) < 12 - 1, {sto (3, rcl (1) + rcl (2)), sto (1, rcl (2)), sto (2, rcl (3))})}' | calc.exe | grep '=> 144' +// test: echo -e '{sto (1, 1), sto (2, 1), sto (10, 1), while (inc (10) < 12 - 1, {sto (3, rcl (1) + rcl (2)), sto (1, rcl (2)), print (sto (2, rcl (3)))})}' | calc.exe | grep '=> 144' /* vim: set ts=4 sw=4 et: */