X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=calc.c;h=6950ad57522676c10055730e805f0baf89681d2e;hb=f438579a2cbd62640bf5478026765baf04099cbb;hp=1a8dd679200f7b2847e365b9df8bba525d2d6f4f;hpb=2d0cd54c457714ca3eb97cfad3cc892612248353;p=calc.git diff --git a/calc.c b/calc.c index 1a8dd67..6950ad5 100644 --- a/calc.c +++ b/calc.c @@ -216,7 +216,7 @@ int main (int argc, char *argv[]) } element_t *element = parser (line[i], NULL, -9); if (element == ERROR_OP) { - VERBOSE (WARNING, fprintf (stdout, "error while parsing: '%s'\n", line[i]); fflush (stdout)); + VERBOSE (WARNING, fprintf (stdout, "error while parsing: '%s'\n", line[i])); ret = 1; } else if (element != NULL) { VERBOSE (INFO, print_element (element, 0)); @@ -291,7 +291,7 @@ int main (int argc, char *argv[]) // test: echo "-cos (0) + 1" | calc.exe | grep -q '=> -0' // test: echo "-cos(0)+1" | calc.exe | grep -q '=> -0' // test: echo "quit" | calc.exe | grep -q 'bye' -// test: echo "help" | calc.exe | grep -q 'miscellaneous' +// test: echo "help" | calc.exe | grep -q 'misc\.' // test: echo "1 + 2 *" | calc.exe | grep -q 'error' // test: echo "* 1 - 2" | calc.exe | grep -q 'error' // test: echo "2 + * 3" | calc.exe | grep -q 'error' @@ -367,6 +367,12 @@ int main (int argc, char *argv[]) // test: echo -e 'print (1)' | calc.exe -v 3 | grep -q Print // test: echo -e 'si\t\t (pi / 2)' | calc.exe | grep -q '=> 1' // test: echo -e '1 + 1;\nans + 1' | calc.exe | grep -qv 2 +// test: echo -e 'mem (3)\nsto (4, pi)' | calc.exe | grep -q "invalid index" +// test: echo -e 'disp' | calc.exe | grep -q "storage: 0 0 0 0 0 0 0 0 0 0" +// test: echo -e 'sto (3, 10)\ndisp' | calc.exe | grep -q "storage: 0 0 10 0 0 0 0 0 0 0" +// test: echo -e 'rcl (3)\ndisp' | calc.exe | grep -q "storage: 0 0 0 0 0 0 0 0 0 0" +// test: echo -e 'inc (2)\ndisp' | calc.exe | grep -q "storage: 0 1 0 0 0 0 0 0 0 0" +// test: echo -e 'dec (2)\ndisp' | calc.exe | grep -q "storage: 0 -1 0 0 0 0 0 0 0 0" // 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'