| 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: test6.c (fprintf) |
| 8 | ** |
| 9 | ** Purpose: Tests the char specifier (%c). |
| 10 | ** This test is modeled after the fprintf series. |
| 11 | ** |
| 12 | ** |
| 13 | **==========================================================================*/ |
| 14 | |
| 15 | #include <palsuite.h> |
| 16 | #include "../fprintf.h" |
| 17 | |
| 18 | /* |
| 19 | * Depends on memcmp, strlen, fopen, fseek and fgets. |
| 20 | */ |
| 21 | |
| 22 | int __cdecl main(int argc, char *argv[]) |
| 23 | { |
| 24 | WCHAR wc = (WCHAR) 'c'; |
| 25 | |
| 26 | if (PAL_Initialize(argc, argv) != 0) |
| 27 | return(FAIL); |
| 28 | |
| 29 | DoCharTest("foo %c" , 'b', "foo b" ); |
| 30 | DoCharTest("foo %hc" , 'b', "foo b" ); |
| 31 | DoWCharTest("foo %lc" , wc, "foo c" ); |
| 32 | DoCharTest("foo %Lc" , 'b', "foo b" ); |
| 33 | DoCharTest("foo %I64c" , 'b', "foo b" ); |
| 34 | DoCharTest("foo %5c" , 'b', "foo b" ); |
| 35 | DoCharTest("foo %.0c" , 'b', "foo b" ); |
| 36 | DoCharTest("foo %-5c" , 'b', "foo b " ); |
| 37 | DoCharTest("foo %05c" , 'b', "foo 0000b" ); |
| 38 | DoCharTest("foo % c" , 'b', "foo b" ); |
| 39 | DoCharTest("foo %#c" , 'b', "foo b" ); |
| 40 | |
| 41 | PAL_Terminate(); |
| 42 | return PASS; |
| 43 | } |
| 44 | |
| 45 | |
| 46 | |
| 47 | |