X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=calc.c;h=82ec9712dde481364f8359303c27313cc2915509;hb=686c4bc2a512a57b6c672792b6b44e2d61458dfb;hp=8aa124a959db68faadbe7cff587e2faa4490db64;hpb=ca3e2a2f00c7ccafb9b01ed89d51b632acc01ea8;p=calc.git diff --git a/calc.c b/calc.c index 8aa124a..82ec971 100644 --- a/calc.c +++ b/calc.c @@ -231,7 +231,8 @@ int main (int argc, char *argv[]) // test: echo "2 + * 3" | calc.exe | grep -q 'error' // test: echo "2 + cos(3 *)" | calc.exe | grep -q 'error' // test: echo "2 + (foo)" | calc.exe | grep -q 'error' -// test: echo "2 + cos (pi" | calc.exe | grep -q 'error' +// test: echo "2 + cos (pi +" | calc.exe | grep -q 'error' +// test: echo "2 + cos (pi" | calc.exe | grep -vq 'error' // test: echo "cos (1, 2)" | calc.exe | grep -q 'error' // test: echo "sqrt 2" | calc.exe | grep -q 'error' // test: echo "pow (2)" | calc.exe | grep -q 'error' @@ -242,7 +243,7 @@ int main (int argc, char *argv[]) // test: echo -e '1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1\n1 + 1' | calc.exe | grep -q 64 // test: echo -e '1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1\n1 + 1' | calc.exe | grep -q 2 // test: echo -e '-cos (1)\n1 + 1\n1 - 1\n1 * 1\n1 / 1\n3%2\n2^2\nsqrt (2)\ncos (0)\nsin (0)\natan (0)\nlog (1)\nexp (1)\nans\ne\npi\nsto (1)\nrcl (2)\ndisp\nhelp\nquit' | calc.exe -v 3 | grep -q bye -// test: echo -e '1 +\n1 -\n1 * 1\n1 /\n3%\n2^\nsqrt ()\ncos ()\nsin ()\natan ()\nlog ()\nexp ()\n1 + (' | calc.exe | grep -c error | xargs test 11 = +// test: echo -e '1 +\n1 -\n1 * 1\n1 /\n3%\n2^\nsqrt ()\ncos ()\nsin ()\natan ()\nlog ()\nexp ()\n1 + (' | calc.exe | grep -c error | xargs test 12 = // test: echo -e '1 + 1\nans' | calc.exe -p 3 | grep -c 2 | xargs test 2 = // test: echo -e 'sin (pi / 2)' | calc.exe -p 4 | grep -q 1 // test: echo -e 'e ^ 2' | calc.exe | grep -q '7\.38906' @@ -274,8 +275,11 @@ int main (int argc, char *argv[]) // test: echo -e '(3 == 4) | (2 > 2)' | calc.exe | grep -q '=> 0' // test: echo -e '!(3 == 4)' | calc.exe | grep -q '=> 1' // test: echo -e '!(3 == 3)' | calc.exe | grep -q '=> 0' -// test: echo -e '1 & 1\n1 | 1\n!1\nquit' | calc.exe -v 3 | grep -q bye +// test: echo -e '1 & 1\n1 | 1\n!(1)\nquit' | calc.exe -v 3 | grep -q bye // test: echo -e '(3 == 3) & (4 > 2)' | calc.exe | grep -q '=> 1' // test: echo -e '3 == 3 & 4 > 2' | calc.exe | grep -q '=> 1' +// test: echo -e '1 + quit' | calc.exe 2>&1 | grep -q error +// test: echo -e 'cos (quit)' | calc.exe 2>&1 | grep -q error +// test: echo -e '(quit)' | calc.exe 2>&1 | grep -q error /* vim: set ts=4 sw=4 et: */