xref: /illumos-gate/usr/src/cmd/dtrace/test/tst/common/funcs/tst.substr.d.out (revision 2a8d6eba033e4713ab12b61178f0513f1f075482)
1#!/usr/perl5/bin/perl
2
3BEGIN {
4	if (substr("foobarbazbop", 3) ne "barbazbop") {
5		printf("perl => substr(\"foobarbazbop\", 3) = \"%s\"\n",
6		    substr("foobarbazbop", 3));
7		printf("   D => substr(\"foobarbazbop\", 3) = \"%s\"\n",
8		    "barbazbop");
9		$failed++;
10	}
11
12	if (substr("foobarbazbop", 300) ne "") {
13		printf("perl => substr(\"foobarbazbop\", 300) = \"%s\"\n",
14		    substr("foobarbazbop", 300));
15		printf("   D => substr(\"foobarbazbop\", 300) = \"%s\"\n",
16		    "");
17		$failed++;
18	}
19
20	if (substr("foobarbazbop", -10) ne "obarbazbop") {
21		printf("perl => substr(\"foobarbazbop\", -10) = \"%s\"\n",
22		    substr("foobarbazbop", -10));
23		printf("   D => substr(\"foobarbazbop\", -10) = \"%s\"\n",
24		    "obarbazbop");
25		$failed++;
26	}
27
28	if (substr("foobarbazbop", 0) ne "foobarbazbop") {
29		printf("perl => substr(\"foobarbazbop\", 0) = \"%s\"\n",
30		    substr("foobarbazbop", 0));
31		printf("   D => substr(\"foobarbazbop\", 0) = \"%s\"\n",
32		    "foobarbazbop");
33		$failed++;
34	}
35
36	if (substr("foobarbazbop", 1) ne "oobarbazbop") {
37		printf("perl => substr(\"foobarbazbop\", 1) = \"%s\"\n",
38		    substr("foobarbazbop", 1));
39		printf("   D => substr(\"foobarbazbop\", 1) = \"%s\"\n",
40		    "oobarbazbop");
41		$failed++;
42	}
43
44	if (substr("foobarbazbop", 11) ne "p") {
45		printf("perl => substr(\"foobarbazbop\", 11) = \"%s\"\n",
46		    substr("foobarbazbop", 11));
47		printf("   D => substr(\"foobarbazbop\", 11) = \"%s\"\n",
48		    "p");
49		$failed++;
50	}
51
52	if (substr("foobarbazbop", 12) ne "") {
53		printf("perl => substr(\"foobarbazbop\", 12) = \"%s\"\n",
54		    substr("foobarbazbop", 12));
55		printf("   D => substr(\"foobarbazbop\", 12) = \"%s\"\n",
56		    "");
57		$failed++;
58	}
59
60	if (substr("foobarbazbop", 13) ne "") {
61		printf("perl => substr(\"foobarbazbop\", 13) = \"%s\"\n",
62		    substr("foobarbazbop", 13));
63		printf("   D => substr(\"foobarbazbop\", 13) = \"%s\"\n",
64		    "");
65		$failed++;
66	}
67
68	if (substr("foobarbazbop", 8, 20) ne "zbop") {
69		printf("perl => substr(\"foobarbazbop\", 8, 20) = \"%s\"\n",
70		    substr("foobarbazbop", 8, 20));
71		printf("   D => substr(\"foobarbazbop\", 8, 20) = \"%s\"\n",
72		    "zbop");
73		$failed++;
74	}
75
76	if (substr("foobarbazbop", 4, 4) ne "arba") {
77		printf("perl => substr(\"foobarbazbop\", 4, 4) = \"%s\"\n",
78		    substr("foobarbazbop", 4, 4));
79		printf("   D => substr(\"foobarbazbop\", 4, 4) = \"%s\"\n",
80		    "arba");
81		$failed++;
82	}
83
84	if (substr("foobarbazbop", 5, 8) ne "rbazbop") {
85		printf("perl => substr(\"foobarbazbop\", 5, 8) = \"%s\"\n",
86		    substr("foobarbazbop", 5, 8));
87		printf("   D => substr(\"foobarbazbop\", 5, 8) = \"%s\"\n",
88		    "rbazbop");
89		$failed++;
90	}
91
92	if (substr("foobarbazbop", 5, 9) ne "rbazbop") {
93		printf("perl => substr(\"foobarbazbop\", 5, 9) = \"%s\"\n",
94		    substr("foobarbazbop", 5, 9));
95		printf("   D => substr(\"foobarbazbop\", 5, 9) = \"%s\"\n",
96		    "rbazbop");
97		$failed++;
98	}
99
100	if (substr("foobarbazbop", 400, 20) ne "") {
101		printf("perl => substr(\"foobarbazbop\", 400, 20) = \"%s\"\n",
102		    substr("foobarbazbop", 400, 20));
103		printf("   D => substr(\"foobarbazbop\", 400, 20) = \"%s\"\n",
104		    "");
105		$failed++;
106	}
107
108	if (substr("foobarbazbop", 400, 0) ne "") {
109		printf("perl => substr(\"foobarbazbop\", 400, 0) = \"%s\"\n",
110		    substr("foobarbazbop", 400, 0));
111		printf("   D => substr(\"foobarbazbop\", 400, 0) = \"%s\"\n",
112		    "");
113		$failed++;
114	}
115
116	if (substr("foobarbazbop", 400, -1) ne "") {
117		printf("perl => substr(\"foobarbazbop\", 400, -1) = \"%s\"\n",
118		    substr("foobarbazbop", 400, -1));
119		printf("   D => substr(\"foobarbazbop\", 400, -1) = \"%s\"\n",
120		    "");
121		$failed++;
122	}
123
124	if (substr("foobarbazbop", 3, 0) ne "") {
125		printf("perl => substr(\"foobarbazbop\", 3, 0) = \"%s\"\n",
126		    substr("foobarbazbop", 3, 0));
127		printf("   D => substr(\"foobarbazbop\", 3, 0) = \"%s\"\n",
128		    "");
129		$failed++;
130	}
131
132	if (substr("foobarbazbop", 3, -1) ne "barbazbo") {
133		printf("perl => substr(\"foobarbazbop\", 3, -1) = \"%s\"\n",
134		    substr("foobarbazbop", 3, -1));
135		printf("   D => substr(\"foobarbazbop\", 3, -1) = \"%s\"\n",
136		    "barbazbo");
137		$failed++;
138	}
139
140	if (substr("foobarbazbop", 3, -4) ne "barba") {
141		printf("perl => substr(\"foobarbazbop\", 3, -4) = \"%s\"\n",
142		    substr("foobarbazbop", 3, -4));
143		printf("   D => substr(\"foobarbazbop\", 3, -4) = \"%s\"\n",
144		    "barba");
145		$failed++;
146	}
147
148	if (substr("foobarbazbop", 3, -20) ne "") {
149		printf("perl => substr(\"foobarbazbop\", 3, -20) = \"%s\"\n",
150		    substr("foobarbazbop", 3, -20));
151		printf("   D => substr(\"foobarbazbop\", 3, -20) = \"%s\"\n",
152		    "");
153		$failed++;
154	}
155
156	if (substr("foobarbazbop", -10, -5) ne "obarb") {
157		printf("perl => substr(\"foobarbazbop\", -10, -5) = \"%s\"\n",
158		    substr("foobarbazbop", -10, -5));
159		printf("   D => substr(\"foobarbazbop\", -10, -5) = \"%s\"\n",
160		    "obarb");
161		$failed++;
162	}
163
164	if (substr("foobarbazbop", 0, 400) ne "foobarbazbop") {
165		printf("perl => substr(\"foobarbazbop\", 0, 400) = \"%s\"\n",
166		    substr("foobarbazbop", 0, 400));
167		printf("   D => substr(\"foobarbazbop\", 0, 400) = \"%s\"\n",
168		    "foobarbazbop");
169		$failed++;
170	}
171
172	if (substr("foobarbazbop", -1, 400) ne "p") {
173		printf("perl => substr(\"foobarbazbop\", -1, 400) = \"%s\"\n",
174		    substr("foobarbazbop", -1, 400));
175		printf("   D => substr(\"foobarbazbop\", -1, 400) = \"%s\"\n",
176		    "p");
177		$failed++;
178	}
179
180	if (substr("foobarbazbop", -1, 0) ne "") {
181		printf("perl => substr(\"foobarbazbop\", -1, 0) = \"%s\"\n",
182		    substr("foobarbazbop", -1, 0));
183		printf("   D => substr(\"foobarbazbop\", -1, 0) = \"%s\"\n",
184		    "");
185		$failed++;
186	}
187
188	if (substr("foobarbazbop", -1, -1) ne "") {
189		printf("perl => substr(\"foobarbazbop\", -1, -1) = \"%s\"\n",
190		    substr("foobarbazbop", -1, -1));
191		printf("   D => substr(\"foobarbazbop\", -1, -1) = \"%s\"\n",
192		    "");
193		$failed++;
194	}
195
196	if (substr("foobarbazbop", -24, 24) ne "foobarbazbop") {
197		printf("perl => substr(\"foobarbazbop\", -24, 24) = \"%s\"\n",
198		    substr("foobarbazbop", -24, 24));
199		printf("   D => substr(\"foobarbazbop\", -24, 24) = \"%s\"\n",
200		    "foobarbazbop");
201		$failed++;
202	}
203
204	if (substr("foobarbazbop", -24, 12) ne "") {
205		printf("perl => substr(\"foobarbazbop\", -24, 12) = \"%s\"\n",
206		    substr("foobarbazbop", -24, 12));
207		printf("   D => substr(\"foobarbazbop\", -24, 12) = \"%s\"\n",
208		    "");
209		$failed++;
210	}
211
212	if (substr("foobarbazbop", -24, 13) ne "f") {
213		printf("perl => substr(\"foobarbazbop\", -24, 13) = \"%s\"\n",
214		    substr("foobarbazbop", -24, 13));
215		printf("   D => substr(\"foobarbazbop\", -24, 13) = \"%s\"\n",
216		    "f");
217		$failed++;
218	}
219
220	if (substr("foobarbazbop", -12, 12) ne "foobarbazbop") {
221		printf("perl => substr(\"foobarbazbop\", -12, 12) = \"%s\"\n",
222		    substr("foobarbazbop", -12, 12));
223		printf("   D => substr(\"foobarbazbop\", -12, 12) = \"%s\"\n",
224		    "foobarbazbop");
225		$failed++;
226	}
227
228	if (substr("foobarbazbop", -12, 11) ne "foobarbazbo") {
229		printf("perl => substr(\"foobarbazbop\", -12, 11) = \"%s\"\n",
230		    substr("foobarbazbop", -12, 11));
231		printf("   D => substr(\"foobarbazbop\", -12, 11) = \"%s\"\n",
232		    "foobarbazbo");
233		$failed++;
234	}
235
236	if (substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100, 10) ne "") {
237		printf("perl => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100, 10) = \"%s\"\n",
238		    substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100, 10));
239		printf("   D => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100, 10) = \"%s\"\n",
240		    "");
241		$failed++;
242	}
243
244	if (substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100) ne "") {
245		printf("perl => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100) = \"%s\"\n",
246		    substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100));
247		printf("   D => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100) = \"%s\"\n",
248		    "");
249		$failed++;
250	}
251
252	exit($failed);
253}
254
255