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 printf function. Tests the wide string
10** specifier (%S).
11**
12**
13**==========================================================================*/
14
15
16
17#include <palsuite.h>
18#include "../printf.h"
19
20
21
22int __cdecl main(int argc, char *argv[])
23{
24 if (PAL_Initialize(argc, argv))
25 {
26 return FAIL;
27 }
28
29 DoWStrTest("foo %S", convert("bar"), "foo bar");
30 DoStrTest("foo %hS", "bar", "foo bar");
31 DoWStrTest("foo %lS", convert("bar"), "foo bar");
32 DoWStrTest("foo %wS", convert("bar"), "foo bar");
33 DoWStrTest("foo %LS", convert("bar"), "foo bar");
34 DoWStrTest("foo %I64S", convert("bar"), "foo bar");
35 DoWStrTest("foo %5S", convert("bar"), "foo bar");
36 DoWStrTest("foo %.2S", convert("bar"), "foo ba");
37 DoWStrTest("foo %5.2S", convert("bar"), "foo ba");
38 DoWStrTest("foo %-5S", convert("bar"), "foo bar ");
39 DoWStrTest("foo %05S", convert("bar"), "foo 00bar");
40 DoWStrTest("foo %S", NULL, "foo (null)");
41 DoStrTest("foo %hS", NULL, "foo (null)");
42 DoWStrTest("foo %lS", NULL, "foo (null)");
43 DoWStrTest("foo %wS", NULL, "foo (null)");
44 DoWStrTest("foo %LS", NULL, "foo (null)");
45 DoWStrTest("foo %I64S", NULL, "foo (null)");
46
47 PAL_Terminate();
48 return PASS;
49}
50
51
52