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 using the 33178476Sjb * aggsortkeypos and aggsortrev options 34178476Sjb * 35178476Sjb * SECTION: Aggregations, Printing Aggregations 36178476Sjb * 37178476Sjb * NOTES: DTrace sorts integer keys as unsigned values, yet prints 32- 38178476Sjb * and 64-bit integers as signed values. Since the Java DTrace API is 39178476Sjb * expected to emulate this behavior, this test was added to ensure that 40178476Sjb * the behavior is preserved. 41178476Sjb */ 42178476Sjb 43178476Sjb#pragma D option quiet 44178476Sjb#pragma D option aggsortkey 45178476Sjb#pragma D option aggsortkeypos=1 46178476Sjb#pragma D option aggsortrev 47178476Sjb 48178476SjbBEGIN 49178476Sjb{ 50178476Sjb @i8["cat", (char)-2] = sum(-2); 51178476Sjb @i8["dog", (char)-2] = sum(-22); 52178476Sjb @i8["mouse", (char)-2] = sum(-222); 53178476Sjb @i8["cat", (char)-1] = sum(-1); 54178476Sjb @i8["dog", (char)-1] = sum(-11); 55178476Sjb @i8["mouse", (char)-1] = sum(-111); 56178476Sjb @i8["cat", (char)0] = sum(0); 57178476Sjb @i8["dog", (char)0] = sum(10); 58178476Sjb @i8["mouse", (char)0] = sum(100); 59178476Sjb @i8["cat", (char)1] = sum(1); 60178476Sjb @i8["dog", (char)1] = sum(11); 61178476Sjb @i8["mouse", (char)1] = sum(111); 62178476Sjb @i8["cat", (char)2] = sum(2); 63178476Sjb @i8["dog", (char)2] = sum(22); 64178476Sjb @i8["mouse", (char)2] = sum(222); 65178476Sjb 66178476Sjb @i16["mouse", (short)-2] = sum(-2); 67178476Sjb @i16["dog", (short)-2] = sum(-22); 68178476Sjb @i16["cat", (short)-2] = sum(-222); 69178476Sjb @i16["mouse", (short)-1] = sum(-1); 70178476Sjb @i16["dog", (short)-1] = sum(-11); 71178476Sjb @i16["cat", (short)-1] = sum(-111); 72178476Sjb @i16["mouse", (short)0] = sum(0); 73178476Sjb @i16["dog", (short)0] = sum(10); 74178476Sjb @i16["cat", (short)0] = sum(100); 75178476Sjb @i16["mouse", (short)1] = sum(1); 76178476Sjb @i16["dog", (short)1] = sum(11); 77178476Sjb @i16["cat", (short)1] = sum(111); 78178476Sjb @i16["mouse", (short)2] = sum(2); 79178476Sjb @i16["dog", (short)2] = sum(22); 80178476Sjb @i16["cat", (short)2] = sum(222); 81178476Sjb 82178476Sjb @i32["mouse", -2] = sum(-2); 83178476Sjb @i32["bear", -2] = sum(-22); 84178476Sjb @i32["cat", -2] = sum(-222); 85178476Sjb @i32["mouse", -1] = sum(-1); 86178476Sjb @i32["bear", -1] = sum(-11); 87178476Sjb @i32["cat", -1] = sum(-111); 88178476Sjb @i32["mouse", 0] = sum(0); 89178476Sjb @i32["bear", 0] = sum(10); 90178476Sjb @i32["cat", 0] = sum(100); 91178476Sjb @i32["mouse", 1] = sum(1); 92178476Sjb @i32["bear", 1] = sum(11); 93178476Sjb @i32["cat", 1] = sum(111); 94178476Sjb @i32["mouse", 2] = sum(2); 95178476Sjb @i32["bear", 2] = sum(22); 96178476Sjb @i32["cat", 2] = sum(222); 97178476Sjb 98178476Sjb @i64["cat", (long long)-2] = sum(-2); 99178476Sjb @i64["bear", (long long)-2] = sum(-22); 100178476Sjb @i64["dog", (long long)-2] = sum(-222); 101178476Sjb @i64["cat", (long long)-1] = sum(-1); 102178476Sjb @i64["bear", (long long)-1] = sum(-11); 103178476Sjb @i64["dog", (long long)-1] = sum(-111); 104178476Sjb @i64["cat", (long long)0] = sum(0); 105178476Sjb @i64["bear", (long long)0] = sum(10); 106178476Sjb @i64["dog", (long long)0] = sum(100); 107178476Sjb @i64["cat", (long long)1] = sum(1); 108178476Sjb @i64["bear", (long long)1] = sum(11); 109178476Sjb @i64["dog", (long long)1] = sum(111); 110178476Sjb @i64["cat", (long long)2] = sum(2); 111178476Sjb @i64["bear", (long long)2] = sum(22); 112178476Sjb @i64["dog", (long long)2] = sum(222); 113178476Sjb 114178476Sjb exit(0); 115178476Sjb} 116