From 07da6751b9d1a6498e81c9d3b97ec3b552fa0b38 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 11 Sep 2023 17:11:56 +0200 Subject: Add a bunch of wchar_t tests --- tests/Makefile | 14 +++++++++----- tests/test_wcscat_static_write.c | 14 ++++++++++++++ tests/test_wcscpy_static_write.c | 14 ++++++++++++++ tests/test_wcsncat_static_write.c | 15 +++++++++++++++ tests/test_wcsncpy_static_write.c | 14 ++++++++++++++ 5 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 tests/test_wcscat_static_write.c create mode 100644 tests/test_wcscpy_static_write.c create mode 100644 tests/test_wcsncat_static_write.c create mode 100644 tests/test_wcsncpy_static_write.c diff --git a/tests/Makefile b/tests/Makefile index 8f17906..7f846c2 100644 --- 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 new file mode 100644 index 0000000..3ad6a20 --- /dev/null +++ b/tests/test_wcscat_static_write.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +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 new file mode 100644 index 0000000..ce292db --- /dev/null +++ b/tests/test_wcscpy_static_write.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +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 new file mode 100644 index 0000000..812d9fd --- /dev/null +++ b/tests/test_wcsncat_static_write.c @@ -0,0 +1,15 @@ +#include "common.h" + +#include + +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 new file mode 100644 index 0000000..163d563 --- /dev/null +++ b/tests/test_wcsncpy_static_write.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include + +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; +} -- cgit v1.3