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