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