tests/libc: Add 0044-wcslen test - scc - simple c99 compiler
(HTM) git clone git://git.simple-cc.org/scc
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
(DIR) commit e9db6f680a03e9d71d1b4091560599c84448cd39
(DIR) parent 0827b4938a966940d42e0382c4fd16d325110c8d
(HTM) Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 21 Mar 2025 11:20:42 +0100
tests/libc: Add 0044-wcslen test
Diffstat:
M tests/libc/execute/.gitignore | 1 +
A tests/libc/execute/0044-wcslen.c | 28 ++++++++++++++++++++++++++++
M tests/libc/execute/libc-tests.lst | 1 +
3 files changed, 30 insertions(+), 0 deletions(-)
---
(DIR) 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
(DIR) 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;
+}
(DIR) 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