OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [strcspn.c] - Diff between revs 297 and 338

Only display areas with differences | Details | Blame | View Log

Rev 297 Rev 338
/* Copyright (C) 2000, 2004  Free Software Foundation.
/* Copyright (C) 2000, 2004  Free Software Foundation.
 
 
   Ensure all expected transformations of builtin strcspn occur and
   Ensure all expected transformations of builtin strcspn occur and
   perform correctly.
   perform correctly.
 
 
   Written by Kaveh R. Ghazi, 11/27/2000.  */
   Written by Kaveh R. Ghazi, 11/27/2000.  */
 
 
extern void abort (void);
extern void abort (void);
typedef __SIZE_TYPE__ size_t;
typedef __SIZE_TYPE__ size_t;
extern size_t strcspn (const char *, const char *);
extern size_t strcspn (const char *, const char *);
extern char *strcpy (char *, const char *);
extern char *strcpy (char *, const char *);
 
 
void
void
main_test (void)
main_test (void)
{
{
  const char *const s1 = "hello world";
  const char *const s1 = "hello world";
  char dst[64], *d2;
  char dst[64], *d2;
 
 
  if (strcspn (s1, "hello") != 0)
  if (strcspn (s1, "hello") != 0)
    abort();
    abort();
  if (strcspn (s1, "z") != 11)
  if (strcspn (s1, "z") != 11)
    abort();
    abort();
  if (strcspn (s1+4, "z") != 7)
  if (strcspn (s1+4, "z") != 7)
    abort();
    abort();
  if (strcspn (s1, "hello world") != 0)
  if (strcspn (s1, "hello world") != 0)
    abort();
    abort();
  if (strcspn (s1, "") != 11)
  if (strcspn (s1, "") != 11)
    abort();
    abort();
  strcpy (dst, s1);
  strcpy (dst, s1);
  if (strcspn (dst, "") != 11)
  if (strcspn (dst, "") != 11)
    abort();
    abort();
  strcpy (dst, s1); d2 = dst;
  strcpy (dst, s1); d2 = dst;
  if (strcspn (++d2, "") != 10 || d2 != dst+1)
  if (strcspn (++d2, "") != 10 || d2 != dst+1)
    abort();
    abort();
  strcpy (dst, s1); d2 = dst;
  strcpy (dst, s1); d2 = dst;
  if (strcspn (++d2+5, "") != 5 || d2 != dst+1)
  if (strcspn (++d2+5, "") != 5 || d2 != dst+1)
    abort();
    abort();
  if (strcspn ("", s1) != 0)
  if (strcspn ("", s1) != 0)
    abort();
    abort();
  strcpy (dst, s1);
  strcpy (dst, s1);
  if (strcspn ("", dst) != 0)
  if (strcspn ("", dst) != 0)
    abort();
    abort();
  strcpy (dst, s1); d2 = dst;
  strcpy (dst, s1); d2 = dst;
  if (strcspn ("", ++d2) != 0 || d2 != dst+1)
  if (strcspn ("", ++d2) != 0 || d2 != dst+1)
    abort();
    abort();
  strcpy (dst, s1); d2 = dst;
  strcpy (dst, s1); d2 = dst;
  if (strcspn ("", ++d2+5) != 0 || d2 != dst+1)
  if (strcspn ("", ++d2+5) != 0 || d2 != dst+1)
    abort();
    abort();
 
 
  /* Test at least one instance of the __builtin_ style.  We do this
  /* Test at least one instance of the __builtin_ style.  We do this
     to ensure that it works and that the prototype is correct.  */
     to ensure that it works and that the prototype is correct.  */
  if (__builtin_strcspn (s1, "z") != 11)
  if (__builtin_strcspn (s1, "z") != 11)
    abort();
    abort();
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.