mirror of
https://git.code.sf.net/p/mingw-w64/mingw-w64
synced 2024-11-23 01:44:43 +08:00
crt: Add snwprintf test
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
53a9374004
commit
1e2529bf12
@ -4196,6 +4196,9 @@ testcase_progs = \
|
||||
testcases/t_swprintf \
|
||||
testcases/t_swprintf0 \
|
||||
testcases/t_swprintf1 \
|
||||
testcases/t_snwprintf \
|
||||
testcases/t_snwprintf0 \
|
||||
testcases/t_snwprintf1 \
|
||||
testcases/t_setjmp \
|
||||
testcases/t_sigv \
|
||||
testcases/t_speed_powl \
|
||||
|
1
mingw-w64-crt/testcases/t_snwprintf.c
Normal file
1
mingw-w64-crt/testcases/t_snwprintf.c
Normal file
@ -0,0 +1 @@
|
||||
#include "t_snwprintf_tmpl.h"
|
2
mingw-w64-crt/testcases/t_snwprintf0.c
Normal file
2
mingw-w64-crt/testcases/t_snwprintf0.c
Normal file
@ -0,0 +1,2 @@
|
||||
#define __USE_MINGW_ANSI_STDIO 0
|
||||
#include "t_snwprintf_tmpl.h"
|
2
mingw-w64-crt/testcases/t_snwprintf1.c
Normal file
2
mingw-w64-crt/testcases/t_snwprintf1.c
Normal file
@ -0,0 +1,2 @@
|
||||
#define __USE_MINGW_ANSI_STDIO 1
|
||||
#include "t_snwprintf_tmpl.h"
|
18
mingw-w64-crt/testcases/t_snwprintf_tmpl.h
Normal file
18
mingw-w64-crt/testcases/t_snwprintf_tmpl.h
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main() {
|
||||
int i;
|
||||
wchar_t buffer[10] = L"XXXXXXXXXX";
|
||||
int ret = snwprintf(buffer, 3, L"%ls", L"AAA");
|
||||
if (ret != 3 || wmemcmp(buffer, L"AA\0XXXXXXX", 10) != 0) {
|
||||
fprintf(stderr, "ret: expected=3 got=%d\n", ret);
|
||||
fprintf(stderr, "buffer:");
|
||||
for (i = 0; i < 10; i++) {
|
||||
fprintf(stderr, " 0x%02x", (int)(wint_t)buffer[i]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user