Add test for fwide() and wide/non-wide streams.
This commit is contained in:
parent
e01182d02f
commit
c824d9d6ed
@ -37,6 +37,7 @@ SimpleTest xsi_msg_queue_test1 : xsi_msg_queue_test1.cpp ;
|
||||
SimpleTest xsi_sem_test1 : xsi_sem_test1.cpp ;
|
||||
|
||||
# wide character tests
|
||||
SimpleTest fwide_test : fwide_test.c ;
|
||||
SimpleTest gnulib-test-btowc : gnulib-test-btowc.c ;
|
||||
SimpleTest gnulib-test-mbrtowc : gnulib-test-mbrtowc.c ;
|
||||
#SimpleTest gnulib-test-mbsnrtowcs : gnulib-test-mbsnrtowcs.c ;
|
||||
|
42
src/tests/system/libroot/posix/fwide_test.c
Normal file
42
src/tests/system/libroot/posix/fwide_test.c
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2012, Oliver Tappe, zooey@hirschkaefer.de
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
fprintf(stdout, "stdout should now be set to non-wide mode ...\n");
|
||||
result = fwide(stdout, 0);
|
||||
if (result != -1)
|
||||
{
|
||||
printf("PROBLEM: fwide(stdout, 0) = %d (expected -1)\n", result);
|
||||
}
|
||||
|
||||
fwprintf(stderr, L"stderr should now be set to non-wide mode ...\n");
|
||||
result = fwide(stderr, 0);
|
||||
if (result != 1)
|
||||
{
|
||||
printf("PROBLEM: fwide(stderr, 0) = %d (expected -1)\n", result);
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s", "this should *not* be visible!\n");
|
||||
fwprintf(stdout, L"%ls", L"this should *not* be visible!\n");
|
||||
|
||||
fprintf(stderr, "%ls", L"this should *not* be visible!\n");
|
||||
fwprintf(stdout, L"%s", "this should *not* be visible!\n");
|
||||
|
||||
fprintf(stdout, "%ls", L"this *should* be visible!\n");
|
||||
fwprintf(stderr, L"%s", "this *should* be visible!\n");
|
||||
|
||||
fprintf(stdout, "%s", "this *should* be visible!\n");
|
||||
fwprintf(stderr, L"%ls", L"this *should* be visible!\n");
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user