scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit e9db6f680a03e9d71d1b4091560599c84448cd39
parent 0827b4938a966940d42e0382c4fd16d325110c8d
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Fri, 21 Mar 2025 11:20:42 +0100

tests/libc: Add 0044-wcslen test

Diffstat:
Mtests/libc/execute/.gitignore | 1+
Atests/libc/execute/0044-wcslen.c | 28++++++++++++++++++++++++++++
Mtests/libc/execute/libc-tests.lst | 1+
3 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/tests/libc/execute/.gitignore b/tests/libc/execute/.gitignore @@ -39,4 +39,5 @@ 0039-mbrtowc 0040-wcrtomb 0041-mbrlen +0044-wcslen test.log diff --git a/tests/libc/execute/0044-wcslen.c b/tests/libc/execute/0044-wcslen.c @@ -0,0 +1,28 @@ +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> + +/* +output: +testing +done +end: +*/ + +int +main(void) +{ + wchar_t t1[] = {0, 0}; + wchar_t t2[] = {0}; + wchar_t t3[] = {0x31, 0}; + wchar_t t4[] = {0x31, 0x32, 0, 0x33, 0}; + + puts("testing"); + assert(wcslen(t1) == 0); + assert(wcslen(t2) == 0); + assert(wcslen(t3) == 1); + assert(wcslen(t4) == 2); + puts("done"); + + return 0; +} diff --git a/tests/libc/execute/libc-tests.lst b/tests/libc/execute/libc-tests.lst @@ -38,3 +38,4 @@ 0039-mbrtowc 0040-wcrtomb 0041-mbrlen +0044-wcslen