about summary refs log tree commit diff
path: root/wcsmbs
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-03-19 10:15:27 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-11 14:21:32 -0300
commit4b717562c4768883a87f62d67610c0a48e911445 (patch)
tree1aceb449aab6f90216299930f8356c9463fe3649 /wcsmbs
parent686d5420253bd76b1b7458f91d6ef9fc1a12b229 (diff)
downloadglibc-4b717562c4768883a87f62d67610c0a48e911445.tar.gz
glibc-4b717562c4768883a87f62d67610c0a48e911445.tar.xz
glibc-4b717562c4768883a87f62d67610c0a48e911445.zip
wcsmbs: Add test-wcsstr
Parametrize test-strstr.c so it can be used to check wcsstr.

Checked on x86_64-linux-gnu and aarch64-linux-gnu.

Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'wcsmbs')
-rw-r--r--wcsmbs/Makefile1
-rw-r--r--wcsmbs/test-wcsstr.c20
-rw-r--r--wcsmbs/wcsstr.c6
3 files changed, 26 insertions, 1 deletions
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index f3333c6a4b..1cddd8cc6d 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -163,6 +163,7 @@ tests := \
   test-wcspbrk \
   test-wcsrchr \
   test-wcsspn \
+  test-wcsstr \
   test-wmemchr \
   test-wmemcmp \
   test-wmemset \
diff --git a/wcsmbs/test-wcsstr.c b/wcsmbs/test-wcsstr.c
new file mode 100644
index 0000000000..23d6517255
--- /dev/null
+++ b/wcsmbs/test-wcsstr.c
@@ -0,0 +1,20 @@
+/* Test wcsstr function.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#define WIDE 1
+#include <string/test-strstr.c>
diff --git a/wcsmbs/wcsstr.c b/wcsmbs/wcsstr.c
index 78f1cc9ce0..b49630c1cf 100644
--- a/wcsmbs/wcsstr.c
+++ b/wcsmbs/wcsstr.c
@@ -28,8 +28,12 @@
 
 #include <wchar.h>
 
+#ifndef WCSSTR
+# define WCSSTR wcsstr
+#endif
+
 wchar_t *
-wcsstr (const wchar_t *haystack, const wchar_t *needle)
+WCSSTR (const wchar_t *haystack, const wchar_t *needle)
 {
   wchar_t b, c;