8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / dtrace / test / tst / common / strtoll / tst.strtoll.d
blob0b1812a53ce029f820f17ab73c1e7ef92ff63543
1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
17 * ASSERTION:
18 * Test the strtoll() subroutine.
20 * SECTION: Actions and Subroutines/strtoll()
23 #pragma D option quiet
25 BEGIN
28 /* minimum base (2) and maximum base (36): */
29 printf("%d\n", strtoll("0", 2));
30 printf("%d\n", strtoll("1", 36));
32 /* simple tests: */
33 printf("%d\n", strtoll("0x20", 16));
34 printf("%d\n", strtoll("-32", 10));
35 printf("%d\n", strtoll("010", 8));
36 printf("%d\n", strtoll("101010", 2));
38 /* INT64_MIN and INT64_MAX: */
39 printf("%d\n", strtoll("9223372036854775807"));
40 printf("%d\n", strtoll("-9223372036854775808"));
41 printf("%d\n", strtoll("0777777777777777777777", 8));
42 printf("%d\n", strtoll("-01000000000000000000000", 8));
44 /* wrapping: */
45 printf("%d\n", strtoll("1000000000000000000000", 8));
46 printf("%d\n", strtoll("-1000000000000000000001", 8));
48 /* hex without prefix: */
49 printf("%d\n", strtoll("baddcafe", 16));
51 /* stopping at first out-of-base character: */
52 printf("%d\n", strtoll("12j", 10));
53 printf("%d\n", strtoll("102", 2));
55 /* base 36: */
56 printf("%d\n", strtoll("-0DTrace4EverZ", 36));
58 /* base 10 is assumed: */
59 printf("%d\n", strtoll("1985"));
60 printf("%d\n", strtoll("-2012"));
62 /* empty string: */
63 printf("%d\n", strtoll(""));
65 exit(0);