1*23b5c241Stomee /*
2*23b5c241Stomee  * CDDL HEADER START
3*23b5c241Stomee  *
4*23b5c241Stomee  * The contents of this file are subject to the terms of the
5*23b5c241Stomee  * Common Development and Distribution License (the "License").
6*23b5c241Stomee  * You may not use this file except in compliance with the License.
7*23b5c241Stomee  *
8*23b5c241Stomee  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*23b5c241Stomee  * or http://www.opensolaris.org/os/licensing.
10*23b5c241Stomee  * See the License for the specific language governing permissions
11*23b5c241Stomee  * and limitations under the License.
12*23b5c241Stomee  *
13*23b5c241Stomee  * When distributing Covered Code, include this CDDL HEADER in each
14*23b5c241Stomee  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*23b5c241Stomee  * If applicable, add the following below this CDDL HEADER, with the
16*23b5c241Stomee  * fields enclosed by brackets "[]" replaced with your own identifying
17*23b5c241Stomee  * information: Portions Copyright [yyyy] [name of copyright owner]
18*23b5c241Stomee  *
19*23b5c241Stomee  * CDDL HEADER END
20*23b5c241Stomee  */
21*23b5c241Stomee 
22*23b5c241Stomee /*
23*23b5c241Stomee  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*23b5c241Stomee  * Use is subject to license terms.
25*23b5c241Stomee  */
26*23b5c241Stomee 
27*23b5c241Stomee /*
28*23b5c241Stomee  * ASSERTION:
29*23b5c241Stomee  * 	printa() test with/without tuple, with multiple aggregations and
30*23b5c241Stomee  * 	mismatched format strings, and sorting options.
31*23b5c241Stomee  *
32*23b5c241Stomee  * SECTION: Aggregations/Aggregations; Output Formatting, printa()
33*23b5c241Stomee  *
34*23b5c241Stomee  * NOTES: This test attempts to cover all multi-agg printa() corner cases.
35*23b5c241Stomee  */
36*23b5c241Stomee 
37*23b5c241Stomee #pragma D option quiet
38*23b5c241Stomee 
39*23b5c241Stomee BEGIN
40*23b5c241Stomee {
41*23b5c241Stomee 	@ = count();
42*23b5c241Stomee 	@a[1, 2] = sum(1);
43*23b5c241Stomee 	@b[1, 2] = sum(2);
44*23b5c241Stomee 	@a[1, 3] = sum(3);
45*23b5c241Stomee 	@b[2, 3] = sum(4);
46*23b5c241Stomee 	@c = sum(3);
47*23b5c241Stomee 	@d = sum(4);
48*23b5c241Stomee 	setopt("aggsortpos", "1");
49*23b5c241Stomee 	setopt("aggsortrev");
50*23b5c241Stomee 	printa(@);
51*23b5c241Stomee 	printa("count: %@d\n", @);
52*23b5c241Stomee 	printa(" ", @);
53*23b5c241Stomee 	printa(@a);
54*23b5c241Stomee 	printa(@a, @b);
55*23b5c241Stomee 	printa("%@d %@d\n", @c, @d);
56*23b5c241Stomee 	printa("%@d %@d\n", @c, @d);
57*23b5c241Stomee 	printa("%@d\n", @c, @d);
58*23b5c241Stomee 
59*23b5c241Stomee 	printa("[%d, %d] %@d %@d\n", @a, @b);
60*23b5c241Stomee 	setopt("aggsortkey");
61*23b5c241Stomee 	printa("[%d, %d] %@d %@d\n", @a, @b);
62*23b5c241Stomee 	setopt("aggsortpos", "0");
63*23b5c241Stomee 	setopt("aggsortkeypos", "1");
64*23b5c241Stomee 	printa("[%d, %d] %@d %@d\n", @a, @b);
65*23b5c241Stomee 
66*23b5c241Stomee 	printa("%@d %@d [%d, %d]\n", @a, @b);
67*23b5c241Stomee 	printa("[%d, %d]\n", @a, @b);
68*23b5c241Stomee 	printa("[%d]\n", @a, @b);
69*23b5c241Stomee 	printa("[%d] %@d %@d\n", @a, @b);
70*23b5c241Stomee 	printa("%@d %@d\n", @a, @b);
71*23b5c241Stomee 	printa("%@d %@d %@d\n", @a, @b);
72*23b5c241Stomee 	printa("[%d] %@d %@d %@d\n", @a, @b);
73*23b5c241Stomee 	printa("[%d, %d] %@d %@d %@d\n", @a, @b);
74*23b5c241Stomee 	exit(0);
75*23b5c241Stomee }
76