test-stpcpy.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Test stpcpy functions.
  2. Copyright (C) 1999-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Written by Jakub Jelinek <jakub@redhat.com>, 1999.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <http://www.gnu.org/licenses/>. */
  16. #define STRCPY_RESULT(dst, len) ((dst) + (len))
  17. #define TEST_MAIN
  18. #ifndef WIDE
  19. # define TEST_NAME "stpcpy"
  20. #else
  21. # define TEST_NAME "wcpcpy"
  22. #endif /* !WIDE */
  23. #include "test-string.h"
  24. #ifndef WIDE
  25. # define CHAR char
  26. # define SIMPLE_STPCPY simple_stpcpy
  27. # define STPCPY stpcpy
  28. #else
  29. # include <wchar.h>
  30. # define CHAR wchar_t
  31. # define SIMPLE_STPCPY simple_wcpcpy
  32. # define STPCPY wcpcpy
  33. #endif /* !WIDE */
  34. CHAR *SIMPLE_STPCPY (CHAR *, const CHAR *);
  35. IMPL (SIMPLE_STPCPY, 0)
  36. IMPL (STPCPY, 1)
  37. CHAR *
  38. SIMPLE_STPCPY (CHAR *dst, const CHAR *src)
  39. {
  40. while ((*dst++ = *src++) != '\0');
  41. return dst - 1;
  42. }
  43. #undef CHAR
  44. #include "test-strcpy.c"