X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/6cf3716c3166d6d41cdbeea45d018b1760184421..9553083c729070877095948ba2d48553690ac9e9:/tests/torture.at diff --git a/tests/torture.at b/tests/torture.at index a8837b22..338c1648 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -56,6 +56,7 @@ print < #include +#include #define MAX $max ]AT_YYLEX_DECLARE[ ]AT_YYERROR_DECLARE[ @@ -77,8 +78,8 @@ for my $size (1 .. $max) print < ]AT_YYERROR_DEFINE[ static int yylex (void) @@ -199,8 +201,7 @@ yylex (void) static int counter = 1; if (counter <= MAX) return counter++; - if (counter++ != MAX + 1) - abort (); + assert (counter++ == MAX + 1); return 0; } @@ -328,8 +329,7 @@ yylex (void) static int counter = 1; if (counter > MAX) { - if (counter++ != MAX + 1) - abort (); + assert (counter++ == MAX + 1); return 0; } if (return_token) @@ -401,11 +401,11 @@ AT_DATA([input.y], exp: WAIT_FOR_EOF exp | ; %% ]AT_YYERROR_DEFINE[ +#include static int yylex (void) { - if (yylval < 0) - abort (); + assert (0 <= yylval); if (yylval--) return WAIT_FOR_EOF; else @@ -417,13 +417,12 @@ main (int argc, const char **argv) { char *endp; YYSTYPE yylval_init; - if (argc != 2) - abort (); + assert (argc == 2); yylval_init = strtol (argv[1], &endp, 10); - if (! (argv[1] != endp - && 0 <= yylval_init && yylval_init <= INT_MAX - && errno != ERANGE)) - abort (); + assert (argv[1] != endp); + assert (0 <= yylval_init); + assert (yylval_init <= INT_MAX); + assert (errno != ERANGE); yydebug = 1; { int count; @@ -438,8 +437,7 @@ main (int argc, const char **argv) [[ new_status = yypull_parse (ps); ]], [[ new_status = yyparse (); -]])[ if (count > 0 && new_status != status) - abort (); +]])[ assert (0 <= count || new_status == status); status = new_status; } ]m4_bmatch([$2], [%push-],