1178476Sjb/*
2178476Sjb * CDDL HEADER START
3178476Sjb *
4178476Sjb * The contents of this file are subject to the terms of the
5178476Sjb * Common Development and Distribution License (the "License").
6178476Sjb * You may not use this file except in compliance with the License.
7178476Sjb *
8178476Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9178476Sjb * or http://www.opensolaris.org/os/licensing.
10178476Sjb * See the License for the specific language governing permissions
11178476Sjb * and limitations under the License.
12178476Sjb *
13178476Sjb * When distributing Covered Code, include this CDDL HEADER in each
14178476Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15178476Sjb * If applicable, add the following below this CDDL HEADER, with the
16178476Sjb * fields enclosed by brackets "[]" replaced with your own identifying
17178476Sjb * information: Portions Copyright [yyyy] [name of copyright owner]
18178476Sjb *
19178476Sjb * CDDL HEADER END
20178476Sjb */
21178476Sjb
22178476Sjb/*
23178476Sjb * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24178476Sjb * Use is subject to license terms.
25178476Sjb */
26178476Sjb
27178476Sjb#pragma	ident	"%Z%%M%	%I%	%E% SMI"
28178476Sjb
29178476Sjb
30178476Sjb/*
31178476Sjb * ASSERTION:
32178476Sjb * 	Signed integer keys print and sort as expected.
33178476Sjb *
34178476Sjb * SECTION: Aggregations, Printing Aggregations
35178476Sjb *
36178476Sjb * NOTES: DTrace sorts integer keys as unsigned values, yet prints 32-
37178476Sjb * and 64-bit integers as signed values. Since the Java DTrace API is
38178476Sjb * expected to emulate this behavior, this test was added to ensure that
39178476Sjb * the behavior is preserved. Consistency with trace() output is also
40178476Sjb * tested.
41178476Sjb */
42178476Sjb
43178476Sjb#pragma D option quiet
44178476Sjb#pragma D option aggsortkey
45178476Sjb
46178476SjbBEGIN
47178476Sjb{
48178476Sjb	trace((char)-2);
49178476Sjb	trace("\n");
50178476Sjb	trace((char)-1);
51178476Sjb	trace("\n");
52178476Sjb	trace((char)0);
53178476Sjb	trace("\n");
54178476Sjb	trace((char)1);
55178476Sjb	trace("\n");
56178476Sjb	trace((char)2);
57178476Sjb	trace("\n");
58178476Sjb	trace("\n");
59178476Sjb
60178476Sjb	trace((short)-2);
61178476Sjb	trace("\n");
62178476Sjb	trace((short)-1);
63178476Sjb	trace("\n");
64178476Sjb	trace((short)0);
65178476Sjb	trace("\n");
66178476Sjb	trace((short)1);
67178476Sjb	trace("\n");
68178476Sjb	trace((short)2);
69178476Sjb	trace("\n");
70178476Sjb	trace("\n");
71178476Sjb
72178476Sjb	trace(-2);
73178476Sjb	trace("\n");
74178476Sjb	trace(-1);
75178476Sjb	trace("\n");
76178476Sjb	trace(0);
77178476Sjb	trace("\n");
78178476Sjb	trace(1);
79178476Sjb	trace("\n");
80178476Sjb	trace(2);
81178476Sjb	trace("\n");
82178476Sjb	trace("\n");
83178476Sjb
84178476Sjb	trace((long long)-2);
85178476Sjb	trace("\n");
86178476Sjb	trace((long long)-1);
87178476Sjb	trace("\n");
88178476Sjb	trace((long long)0);
89178476Sjb	trace("\n");
90178476Sjb	trace((long long)1);
91178476Sjb	trace("\n");
92178476Sjb	trace((long long)2);
93178476Sjb	trace("\n");
94178476Sjb
95178476Sjb	@i8[(char)-2] = sum(-2);
96178476Sjb	@i8[(char)-1] = sum(-1);
97178476Sjb	@i8[(char)0] = sum(0);
98178476Sjb	@i8[(char)1] = sum(1);
99178476Sjb	@i8[(char)2] = sum(2);
100178476Sjb
101178476Sjb	@i16[(short)-2] = sum(-2);
102178476Sjb	@i16[(short)-1] = sum(-1);
103178476Sjb	@i16[(short)0] = sum(0);
104178476Sjb	@i16[(short)1] = sum(1);
105178476Sjb	@i16[(short)2] = sum(2);
106178476Sjb
107178476Sjb	@i32[-2] = sum(-2);
108178476Sjb	@i32[-1] = sum(-1);
109178476Sjb	@i32[0] = sum(0);
110178476Sjb	@i32[1] = sum(1);
111178476Sjb	@i32[2] = sum(2);
112178476Sjb
113178476Sjb	@i64[(long long)-2] = sum(-2);
114178476Sjb	@i64[(long long)-1] = sum(-1);
115178476Sjb	@i64[(long long)0] = sum(0);
116178476Sjb	@i64[(long long)1] = sum(1);
117178476Sjb	@i64[(long long)2] = sum(2);
118178476Sjb
119178476Sjb	exit(0);
120178476Sjb}
121