1
/* Copyright (C) 1995, 1996 Tom Lord
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU Library General Public License as published by
5
* the Free Software Foundation; either version 2, or (at your option)
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Library General Public License for more details.
13
* You should have received a copy of the GNU Library General Public License
14
* along with this software; see the file COPYING. If not, write to
15
* the Free Software Foundation, 59 Temple Place - Suite 330,
16
* Boston, MA 02111-1307, USA.
33
struct a_test the_tests[] =
35
#include "testcases.h"
47
static char * last_pattern = 0;
54
if (!last_pattern || strcmp (last_pattern, t->pattern))
61
err = regcomp (&r, t->pattern, REG_EXTENDED);
66
regerror (err, &r, errmsg, 100);
67
printf ("test %d\n", id);
71
last_pattern = t->pattern;
74
err = regexec (&r, t->data, 10, regs, 0);
76
if (err != t->expected)
78
printf ("### test %d\n", id);
79
printf ("### pattern \"%s\" data \"%s\" wanted %d got %d\n",
80
t->pattern, t->data, t->expected, err);
81
for (x = 0; x < 10; ++x)
82
printf ("### reg %d == (%d, %d) %.*s\n",
86
regs[x].rm_eo - regs[x].rm_so,
87
t->data + regs[x].rm_so);
103
reps = (getenv ("RXREPS")
104
? atoi (getenv ("RXREPS"))
109
union dbmalloptarg val;
110
val.i = 1; dbmallopt (MALLOC_CKCHAIN, &val);
115
hi = (sizeof (the_tests) / sizeof (the_tests[0])) - 1;
126
for (x = lo; x < hi; ++x)
131
for (q = 0; q < reps; ++q)
132
run_a_test (x, &the_tests[x]);