xref: /illumos-gate/usr/src/cmd/dtrace/test/tst/common/predicates/tst.complex.d (revision 3d393ee6c37fa10ac512ed6d36109ad616dc7c1a)
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 #pragma	ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  * ASSERTION:
31  * 	Complex operations and if,then test.
32  *	Call 'n' permutation and combination of operations over if,then.
33  *	Match expected output in tst.complex.d.out
34  *
35  * SECTION: Program Structure/Predicates
36  *
37  */
38 
39 #pragma D option quiet
40 
41 BEGIN
42 {
43 	i = 0;
44 	j = 0;
45 }
46 
47 tick-10ms
48 /i < 10/
49 {
50 	i++;
51 	j++;
52 	printf("\n\n%d\n------\n", i);
53 }
54 
55 tick-10ms
56 /i == 5 || i == 10/
57 {
58 	printf("i == 5 (or) i == 10\n");
59 }
60 
61 tick-10ms
62 /i <= 5/
63 {
64 	printf("i <= 5\n");
65 }
66 
67 tick-10ms
68 /j >= 5/
69 {
70 	printf("j >= 5\n");
71 }
72 
73 tick-10ms
74 /j >= 5 || i <= 5/
75 {
76 	printf("i >= 5 || j >= 5\n");
77 }
78 
79 tick-10ms
80 /j >= 5 && i <= 5/
81 {
82 	printf("j >= 5 && i <= 55\n");
83 }
84 
85 tick-10ms
86 /i < 5/
87 {
88 	printf("i < 5\n");
89 }
90 
91 tick-10ms
92 /i == 2 || j == 2/
93 {
94 	printf("i == 2 (or) j == 2\n");
95 }
96 
97 tick-10ms
98 /i == 2 && j == 2/
99 {
100 	printf("i == 2 (and) j == 2\n");
101 }
102 
103 tick-10ms
104 /j != 10/
105 {
106 	printf("j != 10\n");
107 }
108 
109 tick-10ms
110 /j == 5 || i == 2/
111 {
112 	printf("j == 5 || i == 2\n");
113 }
114 
115 tick-10ms
116 /j == 5 && i == 2/
117 {
118 	printf("j == 5 && i == 2\n");
119 }
120 
121 tick-10ms
122 /i == 10/
123 {
124 	printf("i == 10\n");
125 	exit(0);
126 }
127