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 vprintf function. Tests the octal specifier |
10 | ** (%o). |
11 | ** |
12 | ** |
13 | **==========================================================================*/ |
14 | |
15 | |
16 | |
17 | #include <palsuite.h> |
18 | #include "../vprintf.h" |
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)) |
28 | { |
29 | return FAIL; |
30 | } |
31 | |
32 | |
33 | DoNumTest("foo %o" , pos, "foo 52" ); |
34 | DoNumTest("foo %lo" , 0xFFFF, "foo 177777" ); |
35 | DoNumTest("foo %ho" , 0xFFFF, "foo 177777" ); |
36 | DoNumTest("foo %Lo" , pos, "foo 52" ); |
37 | DoI64Test("foo %I64o" , l, "42" , "foo 52" ); |
38 | DoNumTest("foo %3o" , pos, "foo 52" ); |
39 | DoNumTest("foo %-3o" , pos, "foo 52 " ); |
40 | DoNumTest("foo %.1o" , pos, "foo 52" ); |
41 | DoNumTest("foo %.3o" , pos, "foo 052" ); |
42 | DoNumTest("foo %03o" , pos, "foo 052" ); |
43 | DoNumTest("foo %#o" , pos, "foo 052" ); |
44 | DoNumTest("foo %+o" , pos, "foo 52" ); |
45 | DoNumTest("foo % o" , pos, "foo 52" ); |
46 | DoNumTest("foo %+o" , neg, "foo 37777777726" ); |
47 | DoNumTest("foo % o" , neg, "foo 37777777726" ); |
48 | |
49 | PAL_Terminate(); |
50 | return PASS; |
51 | } |
52 | |
53 | |