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