examples: bistromathic: strengthen tests

* examples/c/bistromathic/bistromathic.test: here.
* examples/test: Be clearer on failing tests.
This commit is contained in:
Akim Demaille
2020-02-29 12:11:37 +01:00
parent 388e12ac0f
commit c4a7e7a1ab
4 changed files with 21 additions and 7 deletions

View File

@@ -45,9 +45,20 @@ run 0 '0.16
cat >input <<EOF cat >input <<EOF
* *
EOF EOF
run 0 "err: 1.1: syntax error: expected end of file or - or ( or end of line or double precision number or function or variable before *" run 0 'err: 1.1: syntax error: expected end of file or - or ( or end of line or double precision number or function or variable before *'
cat >input <<EOF cat >input <<EOF
1 + 2 * * 3 1 + 2 * * 3
EOF EOF
run 0 "err: 1.9: syntax error: expected - or ( or double precision number or function or variable before *" run 0 'err: 1.9: syntax error: expected - or ( or double precision number or function or variable before *'
cat >input <<EOF
100%
EOF
run 0 '100
err: 1.4: error: invalid character'
cat >input <<EOF
1 / 0
EOF
run 0 'err: 1.1-5: error: division by zero'

View File

@@ -123,7 +123,7 @@ exp:
{ {
if ($r == 0) if ($r == 0)
{ {
yyerror (&@$, "division by zero"); yyerror (&@$, "error: division by zero");
YYERROR; YYERROR;
} }
else else

View File

@@ -62,6 +62,6 @@
<<EOF>> return TOK_EOF; <<EOF>> return TOK_EOF;
. yyerror (yylloc, "syntax error, invalid character"); . yyerror (yylloc, "error: invalid character");
%% %%
/* Epilogue (C code). */ /* Epilogue (C code). */

View File

@@ -90,9 +90,12 @@ run ()
echo "$me: PASS: $number" echo "$me: PASS: $number"
else else
echo "$me: FAIL: $number" echo "$me: FAIL: $number"
echo "$me: expected output: $out_exp" echo "$me: input:"
echo "$me: effective output: $out_eff" sed -e 's/^/ /' input
cat err_eff echo "$me: expected output:"
echo "$out_exp" | sed -e 's/^/ /'
echo "$me: effective output:"
echo "$out_eff" | sed -e 's/^/ /'
exit=false exit=false
fi fi
else else