xref: /illumos-gate/usr/src/cmd/dtrace/test/tst/common/funcs/tst.substr.d.out (revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0)
1#!/usr/perl5/bin/perl
2
3BEGIN {
4	if (substr("foobarbazbop", 3) != "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) != "") {
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) != "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) != "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) != "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) != "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) != "") {
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) != "") {
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) != "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) != "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) != "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) != "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) != "") {
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) != "") {
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) != "") {
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) != "") {
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) != "") {
133		printf("perl => substr(\"foobarbazbop\", 3, -1) = \"%s\"\n",
134		    substr("foobarbazbop", 3, -1));
135		printf("   D => substr(\"foobarbazbop\", 3, -1) = \"%s\"\n",
136		    "");
137		$failed++;
138	}
139
140	if (substr("foobarbazbop", 0, 400) != "foobarbazbop") {
141		printf("perl => substr(\"foobarbazbop\", 0, 400) = \"%s\"\n",
142		    substr("foobarbazbop", 0, 400));
143		printf("   D => substr(\"foobarbazbop\", 0, 400) = \"%s\"\n",
144		    "foobarbazbop");
145		$failed++;
146	}
147
148	if (substr("foobarbazbop", -1, 400) != "p") {
149		printf("perl => substr(\"foobarbazbop\", -1, 400) = \"%s\"\n",
150		    substr("foobarbazbop", -1, 400));
151		printf("   D => substr(\"foobarbazbop\", -1, 400) = \"%s\"\n",
152		    "p");
153		$failed++;
154	}
155
156	if (substr("foobarbazbop", -1, 0) != "") {
157		printf("perl => substr(\"foobarbazbop\", -1, 0) = \"%s\"\n",
158		    substr("foobarbazbop", -1, 0));
159		printf("   D => substr(\"foobarbazbop\", -1, 0) = \"%s\"\n",
160		    "");
161		$failed++;
162	}
163
164	if (substr("foobarbazbop", -1, -1) != "") {
165		printf("perl => substr(\"foobarbazbop\", -1, -1) = \"%s\"\n",
166		    substr("foobarbazbop", -1, -1));
167		printf("   D => substr(\"foobarbazbop\", -1, -1) = \"%s\"\n",
168		    "");
169		$failed++;
170	}
171
172	if (substr("foobarbazbop", -24, 24) != "foobarbazbop") {
173		printf("perl => substr(\"foobarbazbop\", -24, 24) = \"%s\"\n",
174		    substr("foobarbazbop", -24, 24));
175		printf("   D => substr(\"foobarbazbop\", -24, 24) = \"%s\"\n",
176		    "foobarbazbop");
177		$failed++;
178	}
179
180	if (substr("foobarbazbop", -24, 12) != "") {
181		printf("perl => substr(\"foobarbazbop\", -24, 12) = \"%s\"\n",
182		    substr("foobarbazbop", -24, 12));
183		printf("   D => substr(\"foobarbazbop\", -24, 12) = \"%s\"\n",
184		    "");
185		$failed++;
186	}
187
188	if (substr("foobarbazbop", -24, 13) != "f") {
189		printf("perl => substr(\"foobarbazbop\", -24, 13) = \"%s\"\n",
190		    substr("foobarbazbop", -24, 13));
191		printf("   D => substr(\"foobarbazbop\", -24, 13) = \"%s\"\n",
192		    "f");
193		$failed++;
194	}
195
196	if (substr("foobarbazbop", -12, 12) != "foobarbazbop") {
197		printf("perl => substr(\"foobarbazbop\", -12, 12) = \"%s\"\n",
198		    substr("foobarbazbop", -12, 12));
199		printf("   D => substr(\"foobarbazbop\", -12, 12) = \"%s\"\n",
200		    "foobarbazbop");
201		$failed++;
202	}
203
204	if (substr("foobarbazbop", -12, 11) != "foobarbazbo") {
205		printf("perl => substr(\"foobarbazbop\", -12, 11) = \"%s\"\n",
206		    substr("foobarbazbop", -12, 11));
207		printf("   D => substr(\"foobarbazbop\", -12, 11) = \"%s\"\n",
208		    "foobarbazbo");
209		$failed++;
210	}
211
212	exit($failed);
213}
214
215