diff options
| author | jvoisin | 2026-05-04 17:02:12 +0200 |
|---|---|---|
| committer | jvoisin | 2026-05-10 01:10:32 +0200 |
| commit | e7c86620bb0c0f8b868d3e4c8dcdebeeffb99631 (patch) | |
| tree | dee45e3d0ba90fe49e17df891b4752524ea868ac /tests/test_mbsrtowcs_static.c | |
| parent | e8e2d1214a49f3c268fb5f3a92e8144b23e35243 (diff) | |
Diffstat (limited to '')
| -rw-r--r-- | tests/test_mbsrtowcs_static.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_mbsrtowcs_static.c b/tests/test_mbsrtowcs_static.c new file mode 100644 index 0000000..f90f29f --- /dev/null +++ b/tests/test_mbsrtowcs_static.c | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <wchar.h> | ||
| 4 | #include <string.h> | ||
| 5 | |||
| 6 | int main(int argc, char** argv) { | ||
| 7 | wchar_t buffer[4] = {0}; | ||
| 8 | const char *src = "ABCDEFGHIJ"; | ||
| 9 | const char *srcp = src; | ||
| 10 | mbstate_t st; | ||
| 11 | memset(&st, 0, sizeof(st)); | ||
| 12 | |||
| 13 | srcp = src; | ||
| 14 | mbsrtowcs(buffer, &srcp, 2, &st); | ||
| 15 | |||
| 16 | srcp = src; | ||
| 17 | memset(&st, 0, sizeof(st)); | ||
| 18 | CHK_FAIL_START | ||
| 19 | mbsrtowcs(buffer, &srcp, 16, &st); | ||
| 20 | CHK_FAIL_END | ||
| 21 | |||
| 22 | printf("%ls\n", buffer); | ||
| 23 | return ret; | ||
| 24 | } | ||
