tests: use assert instead of plain abort.

* tests/actions.at, tests/calc.at, tests/conflicts.at,
* tests/cxx-type.at, tests/glr-regression.at, tests/input.at,
* tests/named-refs.at, tests/regression.at, tests/torture.at,
* tests/local.at:
Prefer assert to abort.
This commit is contained in:
Akim Demaille
2012-06-26 10:20:35 +02:00
parent 0e16927b48
commit 77519a7d18
10 changed files with 51 additions and 62 deletions

View File

@@ -32,6 +32,7 @@ AT_DATA_GRAMMAR([glr-regr1.y],
%{
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define YYSTYPE int
static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1);
@@ -80,8 +81,7 @@ yylex (void)
for (;;)
{
int ch;
if (feof (stdin))
abort ();
assert (!feof (stdin));
ch = getchar ();
if (ch == EOF)
return 0;
@@ -128,6 +128,7 @@ AT_DATA_GRAMMAR([glr-regr2a.y],
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
%}
@@ -177,8 +178,7 @@ yylex (void)
{
char buf[50];
char *s;
if (feof (stdin))
abort ();
assert (!feof (stdin));
switch (fscanf (input, " %1[a-z,]", buf))
{
case 1:
@@ -190,8 +190,7 @@ yylex (void)
}
if (fscanf (input, "%49s", buf) != 1)
return 0;
if (sizeof buf - 1 <= strlen (buf))
abort ();
assert (strlen (buf) < sizeof buf - 1);
s = (char *) malloc (strlen (buf) + 1);
strcpy (s, buf);
yylval = s;
@@ -242,6 +241,7 @@ AT_DATA_GRAMMAR([glr-regr3.y],
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
static int MergeRule (int x0, int x1);
]AT_YYERROR_DECLARE[
@@ -302,8 +302,7 @@ int T[] = { T1, T2, T3, T4 };
int yylex (void)
{
char inp[3];
if (feof (stdin))
abort ();
assert (!feof (stdin));
if (fscanf (input, "%2s", inp) == EOF)
return 0;
switch (inp[0])
@@ -935,6 +934,7 @@ AT_DATA_GRAMMAR([glr-regr12.y],
%{
# include <stdlib.h>
# include <assert.h>
static int merge (YYSTYPE, YYSTYPE);
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
@@ -1003,8 +1003,7 @@ yylex (void)
{
static int const input[] = { PARENT_RHS_AFTER, 0 };
static size_t toknum;
if (! (toknum < sizeof input / sizeof *input))
abort ();
assert (toknum < sizeof input / sizeof *input);
if (input[toknum] == PARENT_RHS_AFTER)
parent_rhs_after_value = 1;
return input[toknum++];
@@ -1064,6 +1063,7 @@ AT_DATA_GRAMMAR([glr-regr13.y],
%{
#include <stdio.h>
#include <assert.h>
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
static void print_lookahead (char const *);
@@ -1122,8 +1122,7 @@ yylex (void)
{
static char const input[] = "ab";
static size_t toknum;
if (! (toknum < sizeof input))
abort ();
assert (toknum < sizeof input);
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = toknum + 1;
yylval.value = input[toknum] + 'A' - 'a';
@@ -1212,6 +1211,7 @@ AT_DATA_GRAMMAR([glr-regr14.y],
%{
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
static void print_lookahead (char const *);
@@ -1328,8 +1328,7 @@ yylex (void)
{
static char const input[] = "abcdddd";
static size_t toknum;
if (! (toknum < sizeof input))
abort ();
assert (toknum < sizeof input);
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = toknum + 1;
yylval.value = input[toknum] + 'A' - 'a';
@@ -1492,6 +1491,7 @@ AT_DATA_GRAMMAR([glr-regr16.y],
%{
# include <stdlib.h>
# include <assert.h>
]AT_YYERROR_DECLARE[
]AT_YYLEX_DECLARE[
static int lookahead_value = 0;
@@ -1512,8 +1512,7 @@ yylex (void)
{
static char const input[] = "ab";
static size_t toknum;
if (! (toknum < sizeof input))
abort ();
assert (toknum < sizeof input);
if (input[toknum] == 'b')
lookahead_value = 1;
return input[toknum++];
@@ -1593,6 +1592,7 @@ empty1: ;
empty2: ;
%%
# include <assert.h>
static void
yyerror (YYLTYPE *locp, char const *msg)
@@ -1606,8 +1606,7 @@ yylex (YYSTYPE *lvalp, YYLTYPE *llocp)
{
static char const input[] = "ab";
static size_t toknum;
if (! (toknum < sizeof input))
abort ();
assert (toknum < sizeof input);
lvalp->dummy = 0;
llocp->first_line = llocp->last_line = 2;
llocp->first_column = toknum + 1;