X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=calc.c;h=6950ad57522676c10055730e805f0baf89681d2e;hb=f438579a2cbd62640bf5478026765baf04099cbb;hp=826c58f49ffa83ee80605552510380624e1ba24e;hpb=9b655f3f3f6e7bd384438b7e150aeb95d6c2b83f;p=calc.git diff --git a/calc.c b/calc.c index 826c58f..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)); @@ -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'