For migrating the 'fnmatch' module to use char32_t, we need the equivalent of
'wmempcpy' for char32_t units.

This patch adds a function u32_pcpy() to libunistring and — as usual for
libunistring — also the corresponding functions for UTF-16 and UTF-8.


2023-07-21  Bruno Haible  <[email protected]>

        unistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: Add tests.
        * tests/unistr/test-pcpy.h: New file, based on tests/unistr/test-cpy.h.
        * tests/unistr/test-u8-pcpy.c: New file, based on
        tests/unistr/test-u8-cpy.c.
        * tests/unistr/test-u16-pcpy.c: New file, based on
        tests/unistr/test-u16-cpy.c.
        * tests/unistr/test-u32-pcpy.c: New file, based on
        tests/unistr/test-u32-cpy.c.
        * modules/unistr/u8-pcpy-tests: New file, based on
        modules/unistr/u8-cpy-tests.
        * modules/unistr/u16-pcpy-tests: New file, based on
        modules/unistr/u16-cpy-tests.
        * modules/unistr/u32-pcpy-tests: New file, based on
        modules/unistr/u32-cpy-tests.

        unistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: New modules.
        * lib/unistr.in.h (u8_pcpy, u16_pcpy, u32_pcpy): New declarations.
        * lib/unistr/u-pcpy.h: New file, based on lib/wmempcpy.c.
        * lib/unistr/u8-pcpy.c: New file, based on lib/unistr/u8-cpy.c.
        * lib/unistr/u16-pcpy.c: New file, based on lib/unistr/u16-cpy.c.
        * lib/unistr/u32-pcpy.c: New file, based on lib/unistr/u32-cpy.c.
        * modules/unistr/u8-pcpy: New file, based on modules/unistr/u8-cpy.
        * modules/unistr/u16-pcpy: New file, based on modules/unistr/u16-cpy.
        * modules/unistr/u32-pcpy: New file, based on modules/unistr/u32-cpy.

>From 07258bd5569095f8b581dfc68110549c4f84336a Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 21 Jul 2023 11:16:04 +0200
Subject: [PATCH 1/2] unistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: New
 modules.

* lib/unistr.in.h (u8_pcpy, u16_pcpy, u32_pcpy): New declarations.
* lib/unistr/u-pcpy.h: New file, based on lib/wmempcpy.c.
* lib/unistr/u8-pcpy.c: New file, based on lib/unistr/u8-cpy.c.
* lib/unistr/u16-pcpy.c: New file, based on lib/unistr/u16-cpy.c.
* lib/unistr/u32-pcpy.c: New file, based on lib/unistr/u32-cpy.c.
* modules/unistr/u8-pcpy: New file, based on modules/unistr/u8-cpy.
* modules/unistr/u16-pcpy: New file, based on modules/unistr/u16-cpy.
* modules/unistr/u32-pcpy: New file, based on modules/unistr/u32-cpy.
---
 ChangeLog               | 12 ++++++++++++
 lib/unistr.in.h         |  9 +++++++++
 lib/unistr/u-pcpy.h     | 22 ++++++++++++++++++++++
 lib/unistr/u16-pcpy.c   | 34 ++++++++++++++++++++++++++++++++++
 lib/unistr/u32-pcpy.c   | 26 ++++++++++++++++++++++++++
 lib/unistr/u8-pcpy.c    | 34 ++++++++++++++++++++++++++++++++++
 modules/unistr/u16-pcpy | 27 +++++++++++++++++++++++++++
 modules/unistr/u32-pcpy | 27 +++++++++++++++++++++++++++
 modules/unistr/u8-pcpy  | 27 +++++++++++++++++++++++++++
 9 files changed, 218 insertions(+)
 create mode 100644 lib/unistr/u-pcpy.h
 create mode 100644 lib/unistr/u16-pcpy.c
 create mode 100644 lib/unistr/u32-pcpy.c
 create mode 100644 lib/unistr/u8-pcpy.c
 create mode 100644 modules/unistr/u16-pcpy
 create mode 100644 modules/unistr/u32-pcpy
 create mode 100644 modules/unistr/u8-pcpy

diff --git a/ChangeLog b/ChangeLog
index b22d754cd1..820bf716b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2023-07-21  Bruno Haible  <[email protected]>
+
+	unistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: New modules.
+	* lib/unistr.in.h (u8_pcpy, u16_pcpy, u32_pcpy): New declarations.
+	* lib/unistr/u-pcpy.h: New file, based on lib/wmempcpy.c.
+	* lib/unistr/u8-pcpy.c: New file, based on lib/unistr/u8-cpy.c.
+	* lib/unistr/u16-pcpy.c: New file, based on lib/unistr/u16-cpy.c.
+	* lib/unistr/u32-pcpy.c: New file, based on lib/unistr/u32-cpy.c.
+	* modules/unistr/u8-pcpy: New file, based on modules/unistr/u8-cpy.
+	* modules/unistr/u16-pcpy: New file, based on modules/unistr/u16-cpy.
+	* modules/unistr/u32-pcpy: New file, based on modules/unistr/u32-cpy.
+
 2023-07-20  Bruno Haible  <[email protected]>
 
 	error-h: Fix dependencies.
diff --git a/lib/unistr.in.h b/lib/unistr.in.h
index d85ad51717..a4cc69912f 100644
--- a/lib/unistr.in.h
+++ b/lib/unistr.in.h
@@ -380,6 +380,15 @@ extern uint16_t *
 extern uint32_t *
        u32_cpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);
 
+/* Copy N units from SRC to DEST, returning pointer after last written unit.  */
+/* Similar to mempcpy().  */
+extern uint8_t *
+       u8_pcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);
+extern uint16_t *
+       u16_pcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);
+extern uint32_t *
+       u32_pcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);
+
 /* Copy N units from SRC to DEST, guaranteeing correct behavior for
    overlapping memory areas.  */
 /* Similar to memmove().  */
diff --git a/lib/unistr/u-pcpy.h b/lib/unistr/u-pcpy.h
new file mode 100644
index 0000000000..47ed1d6397
--- /dev/null
+++ b/lib/unistr/u-pcpy.h
@@ -0,0 +1,22 @@
+/* Copy piece of UTF-8/16/32 string, return pointer after last written unit.
+   Copyright (C) 2020-2023 Free Software Foundation, Inc.
+   Written by Bruno Haible <[email protected]>, 2023.
+
+   This file 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.
+
+   This file 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 this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+UNIT *
+FUNC (UNIT *dest, const UNIT *src, size_t n)
+{
+  return U_CPY (dest, src, n) + n;
+}
diff --git a/lib/unistr/u16-pcpy.c b/lib/unistr/u16-pcpy.c
new file mode 100644
index 0000000000..b0678f3b4c
--- /dev/null
+++ b/lib/unistr/u16-pcpy.c
@@ -0,0 +1,34 @@
+/* Copy piece of UTF-16 string, return pointer after last written unit.
+   Copyright (C) 2020-2023 Free Software Foundation, Inc.
+   Written by Bruno Haible <[email protected]>, 2023.
+
+   This file is free software.
+   It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
+   You can redistribute it and/or modify it under either
+     - the terms of the GNU Lesser General Public License as published
+       by the Free Software Foundation, either version 3, or (at your
+       option) any later version, or
+     - the terms of the GNU General Public License as published by the
+       Free Software Foundation; either version 2, or (at your option)
+       any later version, or
+     - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
+
+   This file 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 and the GNU General Public License
+   for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License and of the GNU General Public License along with this
+   program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+#define FUNC u16_pcpy
+#define UNIT uint16_t
+#define U_CPY u16_cpy
+#include "u-pcpy.h"
diff --git a/lib/unistr/u32-pcpy.c b/lib/unistr/u32-pcpy.c
new file mode 100644
index 0000000000..f822d299c1
--- /dev/null
+++ b/lib/unistr/u32-pcpy.c
@@ -0,0 +1,26 @@
+/* Copy piece of UTF-32 string, return pointer after last written unit.
+   Copyright (C) 2020-2023 Free Software Foundation, Inc.
+   Written by Bruno Haible <[email protected]>, 2023.
+
+   This file 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.
+
+   This file 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 this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+#define FUNC u32_pcpy
+#define UNIT uint32_t
+#define U_CPY u32_cpy
+#include "u-pcpy.h"
diff --git a/lib/unistr/u8-pcpy.c b/lib/unistr/u8-pcpy.c
new file mode 100644
index 0000000000..efe9c82870
--- /dev/null
+++ b/lib/unistr/u8-pcpy.c
@@ -0,0 +1,34 @@
+/* Copy piece of UTF-8 string, return pointer after last written unit.
+   Copyright (C) 2020-2023 Free Software Foundation, Inc.
+   Written by Bruno Haible <[email protected]>, 2023.
+
+   This file is free software.
+   It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
+   You can redistribute it and/or modify it under either
+     - the terms of the GNU Lesser General Public License as published
+       by the Free Software Foundation, either version 3, or (at your
+       option) any later version, or
+     - the terms of the GNU General Public License as published by the
+       Free Software Foundation; either version 2, or (at your option)
+       any later version, or
+     - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
+
+   This file 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 and the GNU General Public License
+   for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License and of the GNU General Public License along with this
+   program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "unistr.h"
+
+#define FUNC u8_pcpy
+#define UNIT uint8_t
+#define U_CPY u8_cpy
+#include "u-pcpy.h"
diff --git a/modules/unistr/u16-pcpy b/modules/unistr/u16-pcpy
new file mode 100644
index 0000000000..b5a8c14496
--- /dev/null
+++ b/modules/unistr/u16-pcpy
@@ -0,0 +1,27 @@
+Description:
+Copy piece of UTF-16 string, return pointer after last written unit.
+
+Files:
+lib/unistr/u16-pcpy.c
+lib/unistr/u-pcpy.h
+
+Depends-on:
+unistr/base
+unistr/u16-cpy
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([1.2], [unistr/u16-pcpy])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNISTR_U16_PCPY
+lib_SOURCES += unistr/u16-pcpy.c
+endif
+
+Include:
+"unistr.h"
+
+License:
+LGPLv3+ or GPLv2+
+
+Maintainer:
+all
diff --git a/modules/unistr/u32-pcpy b/modules/unistr/u32-pcpy
new file mode 100644
index 0000000000..f89b788df4
--- /dev/null
+++ b/modules/unistr/u32-pcpy
@@ -0,0 +1,27 @@
+Description:
+Copy piece of UTF-32 string, return pointer after last written unit.
+
+Files:
+lib/unistr/u32-pcpy.c
+lib/unistr/u-pcpy.h
+
+Depends-on:
+unistr/base
+unistr/u32-cpy
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([1.2], [unistr/u32-pcpy])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNISTR_U32_PCPY
+lib_SOURCES += unistr/u32-pcpy.c
+endif
+
+Include:
+"unistr.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/unistr/u8-pcpy b/modules/unistr/u8-pcpy
new file mode 100644
index 0000000000..be962fbb00
--- /dev/null
+++ b/modules/unistr/u8-pcpy
@@ -0,0 +1,27 @@
+Description:
+Copy piece of UTF-8 string, return pointer after last written unit.
+
+Files:
+lib/unistr/u8-pcpy.c
+lib/unistr/u-pcpy.h
+
+Depends-on:
+unistr/base
+unistr/u8-cpy
+
+configure.ac:
+gl_LIBUNISTRING_MODULE([1.2], [unistr/u8-pcpy])
+
+Makefile.am:
+if LIBUNISTRING_COMPILE_UNISTR_U8_PCPY
+lib_SOURCES += unistr/u8-pcpy.c
+endif
+
+Include:
+"unistr.h"
+
+License:
+LGPLv3+ or GPLv2+
+
+Maintainer:
+all
-- 
2.34.1

>From bb8dc8433993aa3963644a9fd67437097acf0060 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 21 Jul 2023 11:22:27 +0200
Subject: [PATCH 2/2] unistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: Add
 tests.

* tests/unistr/test-pcpy.h: New file, based on tests/unistr/test-cpy.h.
* tests/unistr/test-u8-pcpy.c: New file, based on
tests/unistr/test-u8-cpy.c.
* tests/unistr/test-u16-pcpy.c: New file, based on
tests/unistr/test-u16-cpy.c.
* tests/unistr/test-u32-pcpy.c: New file, based on
tests/unistr/test-u32-cpy.c.
* modules/unistr/u8-pcpy-tests: New file, based on
modules/unistr/u8-cpy-tests.
* modules/unistr/u16-pcpy-tests: New file, based on
modules/unistr/u16-cpy-tests.
* modules/unistr/u32-pcpy-tests: New file, based on
modules/unistr/u32-cpy-tests.
---
 ChangeLog                     | 15 ++++++++++++
 modules/unistr/u16-pcpy-tests | 14 +++++++++++
 modules/unistr/u32-pcpy-tests | 14 +++++++++++
 modules/unistr/u8-pcpy-tests  | 14 +++++++++++
 tests/unistr/test-pcpy.h      | 44 +++++++++++++++++++++++++++++++++++
 tests/unistr/test-u16-pcpy.c  | 28 ++++++++++++++++++++++
 tests/unistr/test-u32-pcpy.c  | 28 ++++++++++++++++++++++
 tests/unistr/test-u8-pcpy.c   | 28 ++++++++++++++++++++++
 8 files changed, 185 insertions(+)
 create mode 100644 modules/unistr/u16-pcpy-tests
 create mode 100644 modules/unistr/u32-pcpy-tests
 create mode 100644 modules/unistr/u8-pcpy-tests
 create mode 100644 tests/unistr/test-pcpy.h
 create mode 100644 tests/unistr/test-u16-pcpy.c
 create mode 100644 tests/unistr/test-u32-pcpy.c
 create mode 100644 tests/unistr/test-u8-pcpy.c

diff --git a/ChangeLog b/ChangeLog
index 820bf716b8..bd6e43518d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2023-07-21  Bruno Haible  <[email protected]>
 
+	unistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: Add tests.
+	* tests/unistr/test-pcpy.h: New file, based on tests/unistr/test-cpy.h.
+	* tests/unistr/test-u8-pcpy.c: New file, based on
+	tests/unistr/test-u8-cpy.c.
+	* tests/unistr/test-u16-pcpy.c: New file, based on
+	tests/unistr/test-u16-cpy.c.
+	* tests/unistr/test-u32-pcpy.c: New file, based on
+	tests/unistr/test-u32-cpy.c.
+	* modules/unistr/u8-pcpy-tests: New file, based on
+	modules/unistr/u8-cpy-tests.
+	* modules/unistr/u16-pcpy-tests: New file, based on
+	modules/unistr/u16-cpy-tests.
+	* modules/unistr/u32-pcpy-tests: New file, based on
+	modules/unistr/u32-cpy-tests.
+
 	unistr/u8-pcpy, unistr/u16-pcpy, unistr/u32-pcpy: New modules.
 	* lib/unistr.in.h (u8_pcpy, u16_pcpy, u32_pcpy): New declarations.
 	* lib/unistr/u-pcpy.h: New file, based on lib/wmempcpy.c.
diff --git a/modules/unistr/u16-pcpy-tests b/modules/unistr/u16-pcpy-tests
new file mode 100644
index 0000000000..ace26360cb
--- /dev/null
+++ b/modules/unistr/u16-pcpy-tests
@@ -0,0 +1,14 @@
+Files:
+tests/unistr/test-u16-pcpy.c
+tests/unistr/test-pcpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u16-pcpy
+check_PROGRAMS += test-u16-pcpy
+test_u16_pcpy_SOURCES = unistr/test-u16-pcpy.c
+test_u16_pcpy_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unistr/u32-pcpy-tests b/modules/unistr/u32-pcpy-tests
new file mode 100644
index 0000000000..4c897b1f21
--- /dev/null
+++ b/modules/unistr/u32-pcpy-tests
@@ -0,0 +1,14 @@
+Files:
+tests/unistr/test-u32-pcpy.c
+tests/unistr/test-pcpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u32-pcpy
+check_PROGRAMS += test-u32-pcpy
+test_u32_pcpy_SOURCES = unistr/test-u32-pcpy.c
+test_u32_pcpy_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/modules/unistr/u8-pcpy-tests b/modules/unistr/u8-pcpy-tests
new file mode 100644
index 0000000000..cdd9bfefba
--- /dev/null
+++ b/modules/unistr/u8-pcpy-tests
@@ -0,0 +1,14 @@
+Files:
+tests/unistr/test-u8-pcpy.c
+tests/unistr/test-pcpy.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-u8-pcpy
+check_PROGRAMS += test-u8-pcpy
+test_u8_pcpy_SOURCES = unistr/test-u8-pcpy.c
+test_u8_pcpy_LDADD = $(LDADD) $(LIBUNISTRING)
diff --git a/tests/unistr/test-pcpy.h b/tests/unistr/test-pcpy.h
new file mode 100644
index 0000000000..b54e3a90fb
--- /dev/null
+++ b/tests/unistr/test-pcpy.h
@@ -0,0 +1,44 @@
+/* Test of uN_pcpy() functions.
+   Copyright (C) 2010-2023 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <[email protected]>, 2023.  */
+
+int
+main ()
+{
+  /* Test small copying operations.  */
+  {
+    static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
+    size_t n;
+
+    for (n = 0; n <= SIZEOF (src); n++)
+      {
+        UNIT dest[1 + SIZEOF (src) + 1] =
+          { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+        UNIT *ret;
+        size_t i;
+
+        ret = U_PCPY (dest + 1, src, n);
+        ASSERT (ret == dest + 1 + n);
+        ASSERT (dest[0] == MAGIC);
+        for (i = 0; i < n; i++)
+          ASSERT (dest[1 + i] == src[i]);
+        ASSERT (dest[1 + n] == MAGIC);
+      }
+  }
+
+  return 0;
+}
diff --git a/tests/unistr/test-u16-pcpy.c b/tests/unistr/test-u16-pcpy.c
new file mode 100644
index 0000000000..8f82d9b78f
--- /dev/null
+++ b/tests/unistr/test-u16-pcpy.c
@@ -0,0 +1,28 @@
+/* Test of u16_pcpy() function.
+   Copyright (C) 2010-2023 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <[email protected]>, 2023.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint16_t
+#define U_PCPY u16_pcpy
+#define MAGIC 0xBADE
+#include "test-pcpy.h"
diff --git a/tests/unistr/test-u32-pcpy.c b/tests/unistr/test-u32-pcpy.c
new file mode 100644
index 0000000000..276fad4daf
--- /dev/null
+++ b/tests/unistr/test-u32-pcpy.c
@@ -0,0 +1,28 @@
+/* Test of u32_pcpy() function.
+   Copyright (C) 2010-2023 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <[email protected]>, 2023.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint32_t
+#define U_PCPY u32_pcpy
+#define MAGIC 0xBADFACE
+#include "test-pcpy.h"
diff --git a/tests/unistr/test-u8-pcpy.c b/tests/unistr/test-u8-pcpy.c
new file mode 100644
index 0000000000..d910020061
--- /dev/null
+++ b/tests/unistr/test-u8-pcpy.c
@@ -0,0 +1,28 @@
+/* Test of u8_pcpy() function.
+   Copyright (C) 2010-2023 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <[email protected]>, 2023.  */
+
+#include <config.h>
+
+#include "unistr.h"
+
+#include "macros.h"
+
+#define UNIT uint8_t
+#define U_PCPY u8_pcpy
+#define MAGIC 0xBA
+#include "test-pcpy.h"
-- 
2.34.1

Reply via email to