run_test (const char *expr, const char *mem, size_t memlen, int expected)
run_test (const char *expr, const char *mem, size_t memlen, int icase, int expected)
run_test (const char *expr, const char *mem, size_t memlen, int expected){#ifdef _POSIX_CPUTIME  struct timespec start;  struct timespec finish;#endif  regex_t re;  int err;  size_t offset;  int cnt;#ifdef _POSIX_CPUTIME  if (use_clock)    use_clock = clock_gettime (cl, &start) == 0;#endif  err = regcomp (&re, expr, REG_NEWLINE);  if (err != REG_NOERROR)    {      char buf[200];      regerror (err, &re, buf, sizeof buf);      error (EXIT_FAILURE, 0, "cannot compile expression: %s", buf);    }  cnt = 0;  offset = 0;  assert (mem[memlen] == '\0');  while (offset < memlen)    {      regmatch_t ma[1];      const char *sp;      const char *ep;      err = regexec (&re, mem + offset, 1, ma, 0);      if (err == REG_NOMATCH)	break;      if (err != REG_NOERROR)	{	  char buf[200];	  regerror (err, &re, buf, sizeof buf);	  error (EXIT_FAILURE, 0, "cannot use expression: %s", buf);	}      assert (ma[0].rm_so >= 0);      sp = mem + offset + ma[0].rm_so;      while (sp > mem && sp[-1] != '\n')	--sp;      ep = mem + offset + ma[0].rm_so;      while (*ep != '\0' && *ep != '\n')	++ep;      printf ("match %d: \"%.*s\"\n", ++cnt, (int) (ep - sp), sp);      offset = ep + 1 - mem;    }  regfree (&re);#ifdef _POSIX_CPUTIME  if (use_clock)    {      use_clock = clock_gettime (cl, &finish) == 0;      if (use_clock)	{	  if (finish.tv_nsec < start.tv_nsec)	    {	      finish.tv_nsec -= start.tv_nsec - 1000000000;	      finish.tv_sec -= 1 + start.tv_sec;	    }	  else	    {	      finish.tv_nsec -= start.tv_nsec;	      finish.tv_sec -= start.tv_sec;	    }	  printf ("elapsed time: %ld.%09ld sec\n",		  finish.tv_sec, finish.tv_nsec);	}    }#endif  /* Return an error if the number of matches found is not match we     expect.  */  return cnt != expected;}