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: test2.c
8**
9** Purpose: Test #2 for the wprintf function. Tests the string specifier
10** (%s).
11**
12**
13**==========================================================================*/
14
15
16#include <palsuite.h>
17#include "../wprintf.h"
18
19
20
21int __cdecl main(int argc, char *argv[])
22{
23
24 if (PAL_Initialize(argc, argv))
25 {
26 return FAIL;
27 }
28
29
30 DoStrTest(u"foo %s", u"bar", u"foo bar");
31 DoStrTest(u"foo %ws", u"bar", u"foo bar");
32 DoStrTest(u"foo %ls", u"bar", u"foo bar");
33 DoStrTest(u"foo %ws", u"bar", u"foo bar");
34 DoStrTest(u"foo %Ls", u"bar", u"foo bar");
35 DoStrTest(u"foo %I64s", u"bar", u"foo bar");
36 DoStrTest(u"foo %5s", u"bar", u"foo bar");
37 DoStrTest(u"foo %.2s", u"bar", u"foo ba");
38 DoStrTest(u"foo %5.2s", u"bar", u"foo ba");
39 DoStrTest(u"foo %-5s", u"bar", u"foo bar ");
40 DoStrTest(u"foo %05s", u"bar", u"foo 00bar");
41 DoStrTest(u"foo %s", NULL, u"foo (null)");
42 DoStrTest(u"foo %hs", NULL, u"foo (null)");
43 DoStrTest(u"foo %ls", NULL, u"foo (null)");
44 DoStrTest(u"foo %ws", NULL, u"foo (null)");
45 DoStrTest(u"foo %Ls", NULL, u"foo (null)");
46 DoStrTest(u"foo %I64s", NULL, u"foo (null)");
47
48 PAL_Terminate();
49 return PASS;
50}
51
52