// test: echo -e 'sto (1, 4)\ninc (1)\ninc (1)\ndec (1)\ninc (1)\nrcl (1) == 6' | calc.exe -v 3 | grep -q '=> 1'
// test: echo -e 'inc\ninc (\ndec\ndec (' | calc.exe | grep -c error | xargs test 4 =
// test: echo -e 'inc (11)\ndec (0)' | calc.exe | grep -c invalid | xargs test 2 =
-// test: echo -e 'whl (inc (1) < 100, sto (2, rcl (1) + rcl (2)))' | calc.exe | grep -q '=> 5050'
-// test: echo -e 'whl\nwhl (inc (1) < 3,\nwhl (inc (1) < 100, sto (2, rcl (1) + rcl (2))' | calc.exe | grep -c error | xargs test 3 =
-// test: echo -e 'whl (0, 1)' | calc.exe -v 3 | grep -q While
+// test: echo -e 'while (inc (1) < 100, sto (2, rcl (1) + rcl (2)))' | calc.exe | grep -q '=> 5050'
+// test: echo -e 'while\nwhile (inc (1) < 3,\nwhile (inc (1) < 100, sto (2, rcl (1) + rcl (2))' | calc.exe | grep -c error | xargs test 3 =
+// test: echo -e 'while (0, 1)' | calc.exe -v 3 | grep -q While
// test: echo -e '{sto (1, 1 + 1), rcl (1) * 3}' | calc.exe -v 3 | grep -q 'Program'
// test: echo -e '{sto (1, 1 + 1), rcl (1) * 3}' | calc.exe | grep -q '=> 6'
// 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'
+// 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'
/* vim: set ts=4 sw=4 et: */
{ "help", Help, 0, 4, 9},
{ "!", Not, 1, 1, 6},
{ "cond", Cond, 3, 4, 5},
- { "whl", While, 2, 3, 5}
+ { "while", While, 2, 5, 5}
};
#define NB_CONSTANTS 3
fprintf (stdout, "storage functions:");
fprintf (stdout, " sto rcl inc dec\n");
fprintf (stdout, "conditional functions:");
- fprintf (stdout, " cond\n");
+ fprintf (stdout, " cond while\n");
fprintf (stdout, "miscellaneous functions:");
fprintf (stdout, " quit help\n");
fprintf (stdout, "supported constants:");