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