| 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: test10.c |
| 8 | ** |
| 9 | ** Purpose: Test #10 for the vsprintf function. |
| 10 | ** |
| 11 | ** |
| 12 | **===================================================================*/ |
| 13 | |
| 14 | #include <palsuite.h> |
| 15 | #include "../vsprintf.h" |
| 16 | |
| 17 | /* |
| 18 | * Notes: memcmp is used, as is strlen. |
| 19 | */ |
| 20 | |
| 21 | int __cdecl main(int argc, char *argv[]) |
| 22 | { |
| 23 | int neg = -42; |
| 24 | int pos = 42; |
| 25 | INT64 l = 42; |
| 26 | |
| 27 | if (PAL_Initialize(argc, argv) != 0) |
| 28 | { |
| 29 | return(FAIL); |
| 30 | } |
| 31 | |
| 32 | DoNumTest("foo %o" , pos, "foo 52" ); |
| 33 | DoNumTest("foo %lo" , 0xFFFF, "foo 177777" ); |
| 34 | DoNumTest("foo %ho" , 0xFFFF, "foo 177777" ); |
| 35 | DoNumTest("foo %Lo" , pos, "foo 52" ); |
| 36 | DoI64Test("foo %I64o" , l, "42" , "foo 52" ); |
| 37 | DoNumTest("foo %3o" , pos, "foo 52" ); |
| 38 | DoNumTest("foo %-3o" , pos, "foo 52 " ); |
| 39 | DoNumTest("foo %.1o" , pos, "foo 52" ); |
| 40 | DoNumTest("foo %.3o" , pos, "foo 052" ); |
| 41 | DoNumTest("foo %03o" , pos, "foo 052" ); |
| 42 | DoNumTest("foo %#o" , pos, "foo 052" ); |
| 43 | DoNumTest("foo %+o" , pos, "foo 52" ); |
| 44 | DoNumTest("foo % o" , pos, "foo 52" ); |
| 45 | DoNumTest("foo %+o" , neg, "foo 37777777726" ); |
| 46 | DoNumTest("foo % o" , neg, "foo 37777777726" ); |
| 47 | |
| 48 | PAL_Terminate(); |
| 49 | return PASS; |
| 50 | } |
| 51 | |