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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [strstr.c] - Blame information for rev 688

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* Copyright (C) 2000  Free Software Foundation.
2
 
3
   Ensure all expected transformations of builtin strstr occur and
4
   perform correctly.
5
 
6
   Written by Kaveh R. Ghazi, 11/6/2000.  */
7
 
8
extern void abort(void);
9
extern char *strstr (const char *, const char *);
10
 
11
void
12
main_test (void)
13
{
14
  const char *const foo = "hello world";
15
 
16
  if (strstr (foo, "") != foo)
17
    abort();
18
  if (strstr (foo + 4, "") != foo + 4)
19
    abort();
20
  if (strstr (foo, "h") != foo)
21
    abort();
22
  if (strstr (foo, "w") != foo + 6)
23
    abort();
24
  if (strstr (foo + 6, "o") != foo + 7)
25
    abort();
26
  if (strstr (foo + 1, "world") != foo + 6)
27
    abort();
28
 
29
  /* Test at least one instance of the __builtin_ style.  We do this
30
     to ensure that it works and that the prototype is correct.  */
31
  if (__builtin_strstr (foo + 1, "world") != foo + 6)
32
    abort();
33
}

powered by: WebSVN 2.1.0

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