1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | /*============================================================================ |
6 | ** |
7 | ** Source: test3.c (fprintf) |
8 | ** |
9 | ** Purpose: Tests the wide string specifier (%S). |
10 | ** This test is modeled after the fprintf series. |
11 | ** |
12 | ** |
13 | **==========================================================================*/ |
14 | |
15 | #include <palsuite.h> |
16 | #include "../fprintf.h" |
17 | |
18 | /* |
19 | * Depends on memcmp, strlen, fopen, fseek and fgets. |
20 | */ |
21 | |
22 | int __cdecl main(int argc, char *argv[]) |
23 | { |
24 | if (PAL_Initialize(argc, argv) != 0) |
25 | return(FAIL); |
26 | |
27 | DoWStrTest("foo %S" , convert("bar" ), "foo bar" ); |
28 | DoStrTest("foo %hS" , "bar" , "foo bar" ); |
29 | DoWStrTest("foo %lS" , convert("bar" ), "foo bar" ); |
30 | DoWStrTest("foo %wS" , convert("bar" ), "foo bar" ); |
31 | DoWStrTest("foo %LS" , convert("bar" ), "foo bar" ); |
32 | DoWStrTest("foo %I64S" , convert("bar" ), "foo bar" ); |
33 | DoWStrTest("foo %5S" , convert("bar" ), "foo bar" ); |
34 | DoWStrTest("foo %.2S" , convert("bar" ), "foo ba" ); |
35 | DoWStrTest("foo %5.2S" , convert("bar" ), "foo ba" ); |
36 | DoWStrTest("foo %-5S" , convert("bar" ), "foo bar " ); |
37 | DoWStrTest("foo %05S" , convert("bar" ), "foo 00bar" ); |
38 | DoWStrTest("foo %S" , NULL, "foo (null)" ); |
39 | DoStrTest("foo %hS" , NULL, "foo (null)" ); |
40 | DoWStrTest("foo %lS" , NULL, "foo (null)" ); |
41 | DoWStrTest("foo %wS" , NULL, "foo (null)" ); |
42 | DoWStrTest("foo %LS" , NULL, "foo (null)" ); |
43 | DoWStrTest("foo %I64S" , NULL, "foo (null)" ); |
44 | |
45 | PAL_Terminate(); |
46 | return PASS; |
47 | } |
48 | |
49 | |
50 | |