summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.cpp
blob: c5515a8640c9f0cb1c0f062a6b3d4905c7fe7d8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*============================================================================
**
** Source:      test7.c
**
** Purpose:     Tests the wide char specifier (%C).
**              This test is modeled after the sprintf series.
**
**
**==========================================================================*/

#include <palsuite.h>
#include "../fwprintf.h"

/* 
 * Depends on memcmp, strlen, fopen, fseek and fgets.
 */

int __cdecl main(int argc, char *argv[])
{
    WCHAR wb = (WCHAR) 'b';
    
    if (PAL_Initialize(argc, argv))
    {
        return FAIL;
    }


    DoCharTest(convert("foo %C"), 'c', "foo c");
    DoWCharTest(convert("foo %hc"), wb, "foo b");
    DoCharTest(convert("foo %lC"), 'c', "foo c");
    DoCharTest(convert("foo %LC"), 'c', "foo c");
    DoCharTest(convert("foo %I64C"), 'c', "foo c");
    DoCharTest(convert("foo %5C"), 'c', "foo     c");
    DoCharTest(convert("foo %.0C"), 'c', "foo c");
    DoCharTest(convert("foo %-5C"), 'c', "foo c    ");
    DoCharTest(convert("foo %05C"), 'c', "foo 0000c");
    DoCharTest(convert("foo % C"), 'c', "foo c");
    DoCharTest(convert("foo %#C"), 'c', "foo c");

    PAL_Terminate();
    return PASS;
}