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