scc

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

commit e5399b363bcd8af06edc6bb4ba9edb034bcbe728
parent e74078b4eed9b2365e67d58f97d2964bec425aac
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Fri, 21 Mar 2025 11:43:34 +0100

tests/libc: Add 0045-wcscmp

Diffstat:
Mtests/libc/execute/.gitignore | 1+
Atests/libc/execute/0045-wcscmp.c | 36++++++++++++++++++++++++++++++++++++
Mtests/libc/execute/libc-tests.lst | 1+
3 files changed, 38 insertions(+), 0 deletions(-)

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