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