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 |
8 | ** |
9 | ** Purpose: Test #3 for the vswprintf function. |
10 | ** |
11 | ** |
12 | **===================================================================*/ |
13 | |
14 | #include <palsuite.h> |
15 | #include "../vswprintf.h" |
16 | |
17 | /* memcmp is used to verify the results, so this test is dependent on it. */ |
18 | /* ditto with wcslen */ |
19 | |
20 | |
21 | int __cdecl main(int argc, char *argv[]) |
22 | { |
23 | if (PAL_Initialize(argc, argv) != 0) |
24 | return(FAIL); |
25 | |
26 | DoStrTest(convert("foo %S" ), "bar" , convert("foo bar" )); |
27 | DoStrTest(convert("foo %hS" ), "bar" , convert("foo bar" )); |
28 | DoWStrTest(convert("foo %lS" ), convert("bar" ), convert("foo bar" )); |
29 | DoWStrTest(convert("foo %wS" ), convert("bar" ), convert("foo bar" )); |
30 | DoStrTest(convert("foo %LS" ), "bar" , convert("foo bar" )); |
31 | DoStrTest(convert("foo %I64S" ), "bar" , convert("foo bar" )); |
32 | DoStrTest(convert("foo %5S" ), "bar" , convert("foo bar" )); |
33 | DoStrTest(convert("foo %.2S" ), "bar" , convert("foo ba" )); |
34 | DoStrTest(convert("foo %5.2S" ), "bar" , convert("foo ba" )); |
35 | DoStrTest(convert("foo %-5S" ), "bar" , convert("foo bar " )); |
36 | DoStrTest(convert("foo %05S" ), "bar" , convert("foo 00bar" )); |
37 | DoStrTest(convert("foo %S" ), NULL, convert("foo (null)" )); |
38 | DoStrTest(convert("foo %hS" ), NULL, convert("foo (null)" )); |
39 | DoWStrTest(convert("foo %lS" ), NULL, convert("foo (null)" )); |
40 | DoWStrTest(convert("foo %wS" ), NULL, convert("foo (null)" )); |
41 | DoStrTest(convert("foo %LS" ), NULL, convert("foo (null)" )); |
42 | DoStrTest(convert("foo %I64S" ), NULL, convert("foo (null)" )); |
43 | |
44 | PAL_Terminate(); |
45 | return PASS; |
46 | } |
47 | |