xref: /haiku/src/tests/system/libroot/posix/fwide_test.c (revision c824d9d6ed8d28698a8029d90227aa0a16388d62)
1 /*
2  * Copyright 2012, Oliver Tappe, zooey@hirschkaefer.de
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include <stdio.h>
7 #include <wchar.h>
8 
9 
10 int
11 main(int argc, char** argv)
12 {
13 	int result = 0;
14 
15 	fprintf(stdout, "stdout should now be set to non-wide mode ...\n");
16 	result = fwide(stdout, 0);
17 	if (result != -1)
18 	{
19 		printf("PROBLEM: fwide(stdout, 0) = %d (expected -1)\n", result);
20 	}
21 
22 	fwprintf(stderr, L"stderr should now be set to non-wide mode ...\n");
23 	result = fwide(stderr, 0);
24 	if (result != 1)
25 	{
26 		printf("PROBLEM: fwide(stderr, 0) = %d (expected -1)\n", result);
27 	}
28 
29 	fprintf(stderr, "%s", "this should *not* be visible!\n");
30 	fwprintf(stdout, L"%ls", L"this should *not* be visible!\n");
31 
32 	fprintf(stderr, "%ls", L"this should *not* be visible!\n");
33 	fwprintf(stdout, L"%s", "this should *not* be visible!\n");
34 
35 	fprintf(stdout, "%ls", L"this *should* be visible!\n");
36 	fwprintf(stderr, L"%s", "this *should* be visible!\n");
37 
38 	fprintf(stdout, "%s", "this *should* be visible!\n");
39 	fwprintf(stderr, L"%ls", L"this *should* be visible!\n");
40 
41 	return 0;
42 }
43