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