test-stpcpy.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Test stpcpy functions.
  2. Copyright (C) 1999-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library 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 GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #define STRCPY_RESULT(dst, len) ((dst) + (len))
  16. #define TEST_MAIN
  17. #ifndef WIDE
  18. # define TEST_NAME "stpcpy"
  19. #else
  20. # define TEST_NAME "wcpcpy"
  21. #endif /* !WIDE */
  22. #include "test-string.h"
  23. #ifndef WIDE
  24. # define CHAR char
  25. # define STPCPY stpcpy
  26. #else
  27. # include <wchar.h>
  28. # define CHAR wchar_t
  29. # define STPCPY wcpcpy
  30. #endif /* !WIDE */
  31. IMPL (STPCPY, 1)
  32. /* Also check the generic implementation. */
  33. #undef STPCPY
  34. #undef weak_alias
  35. #define weak_alias(a, b)
  36. #undef libc_hidden_def
  37. #define libc_hidden_def(a)
  38. #undef libc_hidden_builtin_def
  39. #define libc_hidden_builtin_def(a)
  40. #undef attribute_hidden
  41. #define attribute_hidden
  42. #ifndef WIDE
  43. # define STPCPY __stpcpy_default
  44. # include "string/stpcpy.c"
  45. IMPL (__stpcpy_default, 1)
  46. #else
  47. # define __wcslen wcslen
  48. # define __wmemcpy wmemcpy
  49. # define WCPCPY __wcpcpy_default
  50. # include "wcsmbs/wcpcpy.c"
  51. IMPL (__wcpcpy_default, 1)
  52. #endif
  53. #undef CHAR
  54. #include "test-strcpy.c"