commit 07da6751b9d1a6498e81c9d3b97ec3b552fa0b38
parent 3df1d6a8d761f5c1a5d423c55f1275248a9ce637
Author: jvoisin <julien.voisin@dustri.org>
Date: Mon, 11 Sep 2023 17:11:56 +0200
Add a bunch of wchar_t tests
Diffstat:
5 files changed, 66 insertions(+), 5 deletions(-)
diff --git a/tests/Makefile b/tests/Makefile
@@ -37,8 +37,6 @@ TARGETS= \
test_mbsrtowcs_static \
test_mbstowcs_dynamic \
test_mbstowcs_static \
- test_wmemset_dynamic \
- test_wmemset_static \
test_memchr_dynamic_read \
test_memchr_static_read \
test_memcpy_dynamic_read \
@@ -101,11 +99,17 @@ TARGETS= \
test_vsnprintf_dynamic \
test_vsnprintf_static \
test_vsprintf \
- test_write_dynamic \
- test_wmemmove_dynamic_write \
- test_wmemmove_static_write \
+ test_wcscat_static_write \
+ test_wcscpy_static_write \
+ test_wcsncpy_static_write \
+ test_wcsncat_static_write \
test_wmemcpy_dynamic_write \
test_wmemcpy_static_write \
+ test_wmemmove_dynamic_write \
+ test_wmemmove_static_write \
+ test_wmemset_dynamic \
+ test_wmemset_static \
+ test_write_dynamic \
test_write_static \
.SILENT:
diff --git a/tests/test_wcscat_static_write.c b/tests/test_wcscat_static_write.c
@@ -0,0 +1,14 @@
+#include "common.h"
+
+#include <wchar.h>
+
+int main(int argc, char** argv) {
+ wchar_t buffer[8] = {0};
+ wcscat(buffer, L"α");
+
+ CHK_FAIL_START
+ wcscat(buffer, L"αβγδεζηθικλμνξοπρστυφχψω");
+ CHK_FAIL_END
+
+ return ret;
+}
diff --git a/tests/test_wcscpy_static_write.c b/tests/test_wcscpy_static_write.c
@@ -0,0 +1,14 @@
+#include "common.h"
+
+#include <wchar.h>
+
+int main(int argc, char** argv) {
+ wchar_t buffer[8] = {0};
+ wcscpy(buffer, L"α");
+
+ CHK_FAIL_START
+ wcscpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω");
+ CHK_FAIL_END
+
+ return ret;
+}
diff --git a/tests/test_wcsncat_static_write.c b/tests/test_wcsncat_static_write.c
@@ -0,0 +1,15 @@
+#include "common.h"
+
+#include <wchar.h>
+
+int main(int argc, char** argv) {
+ wchar_t buffer[8] = {0};
+ wcsncat(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 2);
+ puts(buffer);
+
+ CHK_FAIL_START
+ wcsncat(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 1337);
+ CHK_FAIL_END
+
+ return ret;
+}
diff --git a/tests/test_wcsncpy_static_write.c b/tests/test_wcsncpy_static_write.c
@@ -0,0 +1,14 @@
+#include "common.h"
+
+#include <wchar.h>
+
+int main(int argc, char** argv) {
+ wchar_t buffer[8] = {0};
+ wcsncpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 1);
+
+ CHK_FAIL_START
+ wcsncpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 1337);
+ CHK_FAIL_END
+
+ return ret;
+}