Annotation of embedaddon/php/ext/standard/tests/strings/strcasecmp.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: strcasecmp() function
3: --INI--
4: precision = 12
5: --FILE--
6: <?php
7: /* Compares two strings in case-insensitive manner */
8:
9: echo "#### Basic and Possible operations ####";
10: /* creating an array of strings to be compared */
11: $arrays = array(
12: array("a", 'A', chr(128), chr(255), chr(256)),
13: array("acc", "Acc", 'aC', "acCc", 'acd', "?acc", 'Acc!', "$!acc", ";acc"),
14: array("1", "0", 0, "-1", -1, NULL, null, "", TRUE, true, FALSE, "string"),
15: array(10.5, 1.5, 9.5, 11.5, 100.5, 10.5E1, -10.5, 10, 0.5)
16: );
17:
18: /* loop through to go each and every element in an array
19: and comparing the elements with one and other */
20: foreach($arrays as $str1_arr){
21: echo "\n*** comparing the strings in an \n";
22: print_r($str1_arr);
23: for ($i=0; $i<count($str1_arr); $i++){
24: echo "\nIteration $i\n";
25: for($j=0; $j<count($str1_arr); $j++){
26: echo "- strcasecmp of '$str1_arr[$i]' and '$str1_arr[$j]' is => ";
27: var_dump(strcasecmp($str1_arr[$i], $str1_arr[$j]));
28: }
29: }
30: }
31:
32:
33:
34: echo "\n#### Testing Miscelleneous inputs ####\n";
35:
36: echo "--- Testing objects ---\n";
37: /* we get "Catchable fatal error: saying Object of class could not be converted
38: to string" by default when an object is passed instead of string.
39: The error can be avoided by chosing the __toString magix method as follows: */
40:
41: class string1 {
42: function __toString() {
43: return "Hello, world";
44: }
45: }
46: $obj_string1 = new string1;
47:
48: class string2 {
49: function __toString() {
50: return "hello, world\0";
51: }
52: }
53: $obj_string2 = new string2;
54:
55: var_dump(strcasecmp("$obj_string1", "$obj_string2"));
56:
57:
58: echo "\n--- Testing arrays ---\n";
59: $str_arr = array("hello", "?world", "!$%**()%**[][[[&@#~!");
60: var_dump(strcasecmp("hello?world,!$%**()%**[][[[&@#~!", $str_arr));
61: var_dump(strcasecmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[1]"));
62: var_dump(strcasecmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[2]"));
63:
64: echo "\n--- Testing Resources ---\n";
65: $filename1 = "dummy.txt";
66: $filename2 = "dummy1.txt";
67:
68: $file1 = fopen($filename1, "w"); // creating new file
69: $file2 = fopen($filename2, "w"); // creating new file
70:
71: /* getting resource type for file handle */
72: $string1 = get_resource_type($file1);
73: $string2 = get_resource_type($file2);
74: $string3 = (int)get_resource_type($file2);
75:
76: /* string1 and string2 of same "stream" type */
77: var_dump(strcasecmp($string1, $string2)); // int(0)
78:
79: /* string1 is of "stream" type & string3 is of "int" type */
80: var_dump(strcasecmp($string1, $string3)); // int(1)
81:
82: fclose($file1); // closing the file "dummy.txt"
83: fclose($file2); // closing the file "dummy1.txt"
84:
85: unlink("$filename1"); // deletes "dummy.txt"
86: unlink("$filename2"); // deletes "dummy1.txt"
87:
88:
89: echo "\n--- Testing a longer and heredoc string ---\n";
90: $string = <<<EOD
91: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
92: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
93: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
94: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
95: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
96: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
97: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
98: @#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
99: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
100: EOD;
101: var_dump(strcasecmp($string, $string));
102: var_dump(strcasecmp($string, "xyz0123456789"));
103: var_dump(strcasecmp($string, "&&&"));
104:
105: echo "\n--- Testing a heredoc null string ---\n";
106: $str = <<<EOD
107: EOD;
108: var_dump(strcasecmp($str, "\0"));
109: var_dump(strcasecmp($str, NULL));
110: var_dump(strcasecmp($str, "0"));
111:
112:
113: echo "\n--- Testing simple and complex syntax strings ---\n";
114: $str = 'world';
115:
116: /* Simple syntax */
117: var_dump(strcasecmp("Hello, world", "$str"));
118: var_dump(strcasecmp("Hello, world'S", "$str'S"));
119: var_dump(strcasecmp("Hello, worldS", "$strS"));
120:
121: /* String with curly braces, complex syntax */
122: var_dump(strcasecmp("Hello, worldS", "${str}S"));
123: var_dump(strcasecmp("Hello, worldS", "{$str}S"));
124:
125: echo "\n--- Testing binary safe and binary chars ---\n";
126: var_dump(strcasecmp("Hello\0world", "Hello"));
127: var_dump(strcasecmp("Hello\0world", "Helloworld"));
128: var_dump(strcasecmp("\x0", "\0"));
129: var_dump(strcasecmp("\000", "\0"));
130: var_dump(strcasecmp("\x00", ""));
131: var_dump(strcasecmp("\x00", NULL));
132: var_dump(strcasecmp("\000", NULL));
133:
134: echo "\n--- Comparing long float values ---\n";
135: /* Here two different outputs, which depends on the rounding value
136: before converting to string. Here Precision = 12 */
137: var_dump(strcasecmp(10.55555555555555555555555555, 10.5555555556)); // int(0)
138: var_dump(strcasecmp(10.55555555555555555555555555, 10.555555556)); // int(-1)
139: var_dump(strcasecmp(10.55555555595555555555555555, 10.555555556)); // int(0)
140:
141: echo "\n#### checking error conditions ####";
142: strcasecmp();
143: strcasecmp("");
144: strcasecmp("HI");
145: strcasecmp("Hi", "Hello", "World");
146:
147: echo "Done\n";
148: ?>
149: --EXPECTF--
150: #### Basic and Possible operations ####
151: *** comparing the strings in an
152: Array
153: (
154: [0] => a
155: [1] => A
156: [2] => €
157: [3] => ÿ
158: [4] =>
159: )
160:
161: Iteration 0
162: - strcasecmp of 'a' and 'a' is => int(0)
163: - strcasecmp of 'a' and 'A' is => int(0)
164: - strcasecmp of 'a' and '€' is => int(-%d)
165: - strcasecmp of 'a' and 'ÿ' is => int(-%d)
166: - strcasecmp of 'a' and ' ' is => int(%d)
167:
168: Iteration 1
169: - strcasecmp of 'A' and 'a' is => int(0)
170: - strcasecmp of 'A' and 'A' is => int(0)
171: - strcasecmp of 'A' and '€' is => int(-%d)
172: - strcasecmp of 'A' and 'ÿ' is => int(-%d)
173: - strcasecmp of 'A' and ' ' is => int(%d)
174:
175: Iteration 2
176: - strcasecmp of '€' and 'a' is => int(%d)
177: - strcasecmp of '€' and 'A' is => int(%d)
178: - strcasecmp of '€' and '€' is => int(0)
179: - strcasecmp of '€' and 'ÿ' is => int(-%d)
180: - strcasecmp of '€' and ' ' is => int(%d)
181:
182: Iteration 3
183: - strcasecmp of 'ÿ' and 'a' is => int(%d)
184: - strcasecmp of 'ÿ' and 'A' is => int(%d)
185: - strcasecmp of 'ÿ' and '€' is => int(%d)
186: - strcasecmp of 'ÿ' and 'ÿ' is => int(0)
187: - strcasecmp of 'ÿ' and ' ' is => int(%d)
188:
189: Iteration 4
190: - strcasecmp of ' ' and 'a' is => int(-%d)
191: - strcasecmp of ' ' and 'A' is => int(-%d)
192: - strcasecmp of ' ' and '€' is => int(-%d)
193: - strcasecmp of ' ' and 'ÿ' is => int(-%d)
194: - strcasecmp of ' ' and ' ' is => int(0)
195:
196: *** comparing the strings in an
197: Array
198: (
199: [0] => acc
200: [1] => Acc
201: [2] => aC
202: [3] => acCc
203: [4] => acd
204: [5] => ?acc
205: [6] => Acc!
206: [7] => $!acc
207: [8] => ;acc
208: )
209:
210: Iteration 0
211: - strcasecmp of 'acc' and 'acc' is => int(0)
212: - strcasecmp of 'acc' and 'Acc' is => int(0)
213: - strcasecmp of 'acc' and 'aC' is => int(%d)
214: - strcasecmp of 'acc' and 'acCc' is => int(-%d)
215: - strcasecmp of 'acc' and 'acd' is => int(-%d)
216: - strcasecmp of 'acc' and '?acc' is => int(%d)
217: - strcasecmp of 'acc' and 'Acc!' is => int(-%d)
218: - strcasecmp of 'acc' and '$!acc' is => int(%d)
219: - strcasecmp of 'acc' and ';acc' is => int(%d)
220:
221: Iteration 1
222: - strcasecmp of 'Acc' and 'acc' is => int(0)
223: - strcasecmp of 'Acc' and 'Acc' is => int(0)
224: - strcasecmp of 'Acc' and 'aC' is => int(%d)
225: - strcasecmp of 'Acc' and 'acCc' is => int(-%d)
226: - strcasecmp of 'Acc' and 'acd' is => int(-%d)
227: - strcasecmp of 'Acc' and '?acc' is => int(%d)
228: - strcasecmp of 'Acc' and 'Acc!' is => int(-%d)
229: - strcasecmp of 'Acc' and '$!acc' is => int(%d)
230: - strcasecmp of 'Acc' and ';acc' is => int(%d)
231:
232: Iteration 2
233: - strcasecmp of 'aC' and 'acc' is => int(-%d)
234: - strcasecmp of 'aC' and 'Acc' is => int(-%d)
235: - strcasecmp of 'aC' and 'aC' is => int(0)
236: - strcasecmp of 'aC' and 'acCc' is => int(-%d)
237: - strcasecmp of 'aC' and 'acd' is => int(-%d)
238: - strcasecmp of 'aC' and '?acc' is => int(%d)
239: - strcasecmp of 'aC' and 'Acc!' is => int(-%d)
240: - strcasecmp of 'aC' and '$!acc' is => int(%d)
241: - strcasecmp of 'aC' and ';acc' is => int(%d)
242:
243: Iteration 3
244: - strcasecmp of 'acCc' and 'acc' is => int(%d)
245: - strcasecmp of 'acCc' and 'Acc' is => int(%d)
246: - strcasecmp of 'acCc' and 'aC' is => int(%d)
247: - strcasecmp of 'acCc' and 'acCc' is => int(0)
248: - strcasecmp of 'acCc' and 'acd' is => int(-%d)
249: - strcasecmp of 'acCc' and '?acc' is => int(%d)
250: - strcasecmp of 'acCc' and 'Acc!' is => int(%d)
251: - strcasecmp of 'acCc' and '$!acc' is => int(%d)
252: - strcasecmp of 'acCc' and ';acc' is => int(%d)
253:
254: Iteration 4
255: - strcasecmp of 'acd' and 'acc' is => int(%d)
256: - strcasecmp of 'acd' and 'Acc' is => int(%d)
257: - strcasecmp of 'acd' and 'aC' is => int(%d)
258: - strcasecmp of 'acd' and 'acCc' is => int(%d)
259: - strcasecmp of 'acd' and 'acd' is => int(0)
260: - strcasecmp of 'acd' and '?acc' is => int(%d)
261: - strcasecmp of 'acd' and 'Acc!' is => int(%d)
262: - strcasecmp of 'acd' and '$!acc' is => int(%d)
263: - strcasecmp of 'acd' and ';acc' is => int(%d)
264:
265: Iteration 5
266: - strcasecmp of '?acc' and 'acc' is => int(-%d)
267: - strcasecmp of '?acc' and 'Acc' is => int(-%d)
268: - strcasecmp of '?acc' and 'aC' is => int(-%d)
269: - strcasecmp of '?acc' and 'acCc' is => int(-%d)
270: - strcasecmp of '?acc' and 'acd' is => int(-%d)
271: - strcasecmp of '?acc' and '?acc' is => int(0)
272: - strcasecmp of '?acc' and 'Acc!' is => int(-%d)
273: - strcasecmp of '?acc' and '$!acc' is => int(%d)
274: - strcasecmp of '?acc' and ';acc' is => int(%d)
275:
276: Iteration 6
277: - strcasecmp of 'Acc!' and 'acc' is => int(%d)
278: - strcasecmp of 'Acc!' and 'Acc' is => int(%d)
279: - strcasecmp of 'Acc!' and 'aC' is => int(%d)
280: - strcasecmp of 'Acc!' and 'acCc' is => int(-%d)
281: - strcasecmp of 'Acc!' and 'acd' is => int(-%d)
282: - strcasecmp of 'Acc!' and '?acc' is => int(%d)
283: - strcasecmp of 'Acc!' and 'Acc!' is => int(0)
284: - strcasecmp of 'Acc!' and '$!acc' is => int(%d)
285: - strcasecmp of 'Acc!' and ';acc' is => int(%d)
286:
287: Iteration 7
288: - strcasecmp of '$!acc' and 'acc' is => int(-%d)
289: - strcasecmp of '$!acc' and 'Acc' is => int(-%d)
290: - strcasecmp of '$!acc' and 'aC' is => int(-%d)
291: - strcasecmp of '$!acc' and 'acCc' is => int(-%d)
292: - strcasecmp of '$!acc' and 'acd' is => int(-%d)
293: - strcasecmp of '$!acc' and '?acc' is => int(-%d)
294: - strcasecmp of '$!acc' and 'Acc!' is => int(-%d)
295: - strcasecmp of '$!acc' and '$!acc' is => int(0)
296: - strcasecmp of '$!acc' and ';acc' is => int(-%d)
297:
298: Iteration 8
299: - strcasecmp of ';acc' and 'acc' is => int(-%d)
300: - strcasecmp of ';acc' and 'Acc' is => int(-%d)
301: - strcasecmp of ';acc' and 'aC' is => int(-%d)
302: - strcasecmp of ';acc' and 'acCc' is => int(-%d)
303: - strcasecmp of ';acc' and 'acd' is => int(-%d)
304: - strcasecmp of ';acc' and '?acc' is => int(-%d)
305: - strcasecmp of ';acc' and 'Acc!' is => int(-%d)
306: - strcasecmp of ';acc' and '$!acc' is => int(%d)
307: - strcasecmp of ';acc' and ';acc' is => int(0)
308:
309: *** comparing the strings in an
310: Array
311: (
312: [0] => 1
313: [1] => 0
314: [2] => 0
315: [3] => -1
316: [4] => -1
317: [5] =>
318: [6] =>
319: [7] =>
320: [8] => 1
321: [9] => 1
322: [10] =>
323: [11] => string
324: )
325:
326: Iteration 0
327: - strcasecmp of '1' and '1' is => int(0)
328: - strcasecmp of '1' and '0' is => int(%d)
329: - strcasecmp of '1' and '0' is => int(%d)
330: - strcasecmp of '1' and '-1' is => int(%d)
331: - strcasecmp of '1' and '-1' is => int(%d)
332: - strcasecmp of '1' and '' is => int(%d)
333: - strcasecmp of '1' and '' is => int(%d)
334: - strcasecmp of '1' and '' is => int(%d)
335: - strcasecmp of '1' and '1' is => int(0)
336: - strcasecmp of '1' and '1' is => int(0)
337: - strcasecmp of '1' and '' is => int(%d)
338: - strcasecmp of '1' and 'string' is => int(-%d)
339:
340: Iteration 1
341: - strcasecmp of '0' and '1' is => int(-%d)
342: - strcasecmp of '0' and '0' is => int(0)
343: - strcasecmp of '0' and '0' is => int(0)
344: - strcasecmp of '0' and '-1' is => int(%d)
345: - strcasecmp of '0' and '-1' is => int(%d)
346: - strcasecmp of '0' and '' is => int(%d)
347: - strcasecmp of '0' and '' is => int(%d)
348: - strcasecmp of '0' and '' is => int(%d)
349: - strcasecmp of '0' and '1' is => int(-%d)
350: - strcasecmp of '0' and '1' is => int(-%d)
351: - strcasecmp of '0' and '' is => int(%d)
352: - strcasecmp of '0' and 'string' is => int(-%d)
353:
354: Iteration 2
355: - strcasecmp of '0' and '1' is => int(-%d)
356: - strcasecmp of '0' and '0' is => int(0)
357: - strcasecmp of '0' and '0' is => int(0)
358: - strcasecmp of '0' and '-1' is => int(%d)
359: - strcasecmp of '0' and '-1' is => int(%d)
360: - strcasecmp of '0' and '' is => int(%d)
361: - strcasecmp of '0' and '' is => int(%d)
362: - strcasecmp of '0' and '' is => int(%d)
363: - strcasecmp of '0' and '1' is => int(-%d)
364: - strcasecmp of '0' and '1' is => int(-%d)
365: - strcasecmp of '0' and '' is => int(%d)
366: - strcasecmp of '0' and 'string' is => int(-%d)
367:
368: Iteration 3
369: - strcasecmp of '-1' and '1' is => int(-%d)
370: - strcasecmp of '-1' and '0' is => int(-%d)
371: - strcasecmp of '-1' and '0' is => int(-%d)
372: - strcasecmp of '-1' and '-1' is => int(0)
373: - strcasecmp of '-1' and '-1' is => int(0)
374: - strcasecmp of '-1' and '' is => int(%d)
375: - strcasecmp of '-1' and '' is => int(%d)
376: - strcasecmp of '-1' and '' is => int(%d)
377: - strcasecmp of '-1' and '1' is => int(-%d)
378: - strcasecmp of '-1' and '1' is => int(-%d)
379: - strcasecmp of '-1' and '' is => int(%d)
380: - strcasecmp of '-1' and 'string' is => int(-%d)
381:
382: Iteration 4
383: - strcasecmp of '-1' and '1' is => int(-%d)
384: - strcasecmp of '-1' and '0' is => int(-%d)
385: - strcasecmp of '-1' and '0' is => int(-%d)
386: - strcasecmp of '-1' and '-1' is => int(0)
387: - strcasecmp of '-1' and '-1' is => int(0)
388: - strcasecmp of '-1' and '' is => int(%d)
389: - strcasecmp of '-1' and '' is => int(%d)
390: - strcasecmp of '-1' and '' is => int(%d)
391: - strcasecmp of '-1' and '1' is => int(-%d)
392: - strcasecmp of '-1' and '1' is => int(-%d)
393: - strcasecmp of '-1' and '' is => int(%d)
394: - strcasecmp of '-1' and 'string' is => int(-%d)
395:
396: Iteration 5
397: - strcasecmp of '' and '1' is => int(-%d)
398: - strcasecmp of '' and '0' is => int(-%d)
399: - strcasecmp of '' and '0' is => int(-%d)
400: - strcasecmp of '' and '-1' is => int(-%d)
401: - strcasecmp of '' and '-1' is => int(-%d)
402: - strcasecmp of '' and '' is => int(0)
403: - strcasecmp of '' and '' is => int(0)
404: - strcasecmp of '' and '' is => int(0)
405: - strcasecmp of '' and '1' is => int(-%d)
406: - strcasecmp of '' and '1' is => int(-%d)
407: - strcasecmp of '' and '' is => int(0)
408: - strcasecmp of '' and 'string' is => int(-%d)
409:
410: Iteration 6
411: - strcasecmp of '' and '1' is => int(-%d)
412: - strcasecmp of '' and '0' is => int(-%d)
413: - strcasecmp of '' and '0' is => int(-%d)
414: - strcasecmp of '' and '-1' is => int(-%d)
415: - strcasecmp of '' and '-1' is => int(-%d)
416: - strcasecmp of '' and '' is => int(0)
417: - strcasecmp of '' and '' is => int(0)
418: - strcasecmp of '' and '' is => int(0)
419: - strcasecmp of '' and '1' is => int(-%d)
420: - strcasecmp of '' and '1' is => int(-%d)
421: - strcasecmp of '' and '' is => int(0)
422: - strcasecmp of '' and 'string' is => int(-%d)
423:
424: Iteration 7
425: - strcasecmp of '' and '1' is => int(-%d)
426: - strcasecmp of '' and '0' is => int(-%d)
427: - strcasecmp of '' and '0' is => int(-%d)
428: - strcasecmp of '' and '-1' is => int(-%d)
429: - strcasecmp of '' and '-1' is => int(-%d)
430: - strcasecmp of '' and '' is => int(0)
431: - strcasecmp of '' and '' is => int(0)
432: - strcasecmp of '' and '' is => int(0)
433: - strcasecmp of '' and '1' is => int(-%d)
434: - strcasecmp of '' and '1' is => int(-%d)
435: - strcasecmp of '' and '' is => int(0)
436: - strcasecmp of '' and 'string' is => int(-%d)
437:
438: Iteration 8
439: - strcasecmp of '1' and '1' is => int(0)
440: - strcasecmp of '1' and '0' is => int(%d)
441: - strcasecmp of '1' and '0' is => int(%d)
442: - strcasecmp of '1' and '-1' is => int(%d)
443: - strcasecmp of '1' and '-1' is => int(%d)
444: - strcasecmp of '1' and '' is => int(%d)
445: - strcasecmp of '1' and '' is => int(%d)
446: - strcasecmp of '1' and '' is => int(%d)
447: - strcasecmp of '1' and '1' is => int(0)
448: - strcasecmp of '1' and '1' is => int(0)
449: - strcasecmp of '1' and '' is => int(%d)
450: - strcasecmp of '1' and 'string' is => int(-%d)
451:
452: Iteration 9
453: - strcasecmp of '1' and '1' is => int(0)
454: - strcasecmp of '1' and '0' is => int(%d)
455: - strcasecmp of '1' and '0' is => int(%d)
456: - strcasecmp of '1' and '-1' is => int(%d)
457: - strcasecmp of '1' and '-1' is => int(%d)
458: - strcasecmp of '1' and '' is => int(%d)
459: - strcasecmp of '1' and '' is => int(%d)
460: - strcasecmp of '1' and '' is => int(%d)
461: - strcasecmp of '1' and '1' is => int(0)
462: - strcasecmp of '1' and '1' is => int(0)
463: - strcasecmp of '1' and '' is => int(%d)
464: - strcasecmp of '1' and 'string' is => int(-%d)
465:
466: Iteration 10
467: - strcasecmp of '' and '1' is => int(-%d)
468: - strcasecmp of '' and '0' is => int(-%d)
469: - strcasecmp of '' and '0' is => int(-%d)
470: - strcasecmp of '' and '-1' is => int(-%d)
471: - strcasecmp of '' and '-1' is => int(-%d)
472: - strcasecmp of '' and '' is => int(0)
473: - strcasecmp of '' and '' is => int(0)
474: - strcasecmp of '' and '' is => int(0)
475: - strcasecmp of '' and '1' is => int(-%d)
476: - strcasecmp of '' and '1' is => int(-%d)
477: - strcasecmp of '' and '' is => int(0)
478: - strcasecmp of '' and 'string' is => int(-%d)
479:
480: Iteration 11
481: - strcasecmp of 'string' and '1' is => int(%d)
482: - strcasecmp of 'string' and '0' is => int(%d)
483: - strcasecmp of 'string' and '0' is => int(%d)
484: - strcasecmp of 'string' and '-1' is => int(%d)
485: - strcasecmp of 'string' and '-1' is => int(%d)
486: - strcasecmp of 'string' and '' is => int(%d)
487: - strcasecmp of 'string' and '' is => int(%d)
488: - strcasecmp of 'string' and '' is => int(%d)
489: - strcasecmp of 'string' and '1' is => int(%d)
490: - strcasecmp of 'string' and '1' is => int(%d)
491: - strcasecmp of 'string' and '' is => int(%d)
492: - strcasecmp of 'string' and 'string' is => int(0)
493:
494: *** comparing the strings in an
495: Array
496: (
497: [0] => 10.5
498: [1] => 1.5
499: [2] => 9.5
500: [3] => 11.5
501: [4] => 100.5
502: [5] => 105
503: [6] => -10.5
504: [7] => 10
505: [8] => 0.5
506: )
507:
508: Iteration 0
509: - strcasecmp of '10.5' and '10.5' is => int(0)
510: - strcasecmp of '10.5' and '1.5' is => int(%d)
511: - strcasecmp of '10.5' and '9.5' is => int(-%d)
512: - strcasecmp of '10.5' and '11.5' is => int(-%d)
513: - strcasecmp of '10.5' and '100.5' is => int(-%d)
514: - strcasecmp of '10.5' and '105' is => int(-%d)
515: - strcasecmp of '10.5' and '-10.5' is => int(%d)
516: - strcasecmp of '10.5' and '10' is => int(%d)
517: - strcasecmp of '10.5' and '0.5' is => int(%d)
518:
519: Iteration 1
520: - strcasecmp of '1.5' and '10.5' is => int(-%d)
521: - strcasecmp of '1.5' and '1.5' is => int(0)
522: - strcasecmp of '1.5' and '9.5' is => int(-%d)
523: - strcasecmp of '1.5' and '11.5' is => int(-%d)
524: - strcasecmp of '1.5' and '100.5' is => int(-%d)
525: - strcasecmp of '1.5' and '105' is => int(-%d)
526: - strcasecmp of '1.5' and '-10.5' is => int(%d)
527: - strcasecmp of '1.5' and '10' is => int(-%d)
528: - strcasecmp of '1.5' and '0.5' is => int(%d)
529:
530: Iteration 2
531: - strcasecmp of '9.5' and '10.5' is => int(%d)
532: - strcasecmp of '9.5' and '1.5' is => int(%d)
533: - strcasecmp of '9.5' and '9.5' is => int(0)
534: - strcasecmp of '9.5' and '11.5' is => int(%d)
535: - strcasecmp of '9.5' and '100.5' is => int(%d)
536: - strcasecmp of '9.5' and '105' is => int(%d)
537: - strcasecmp of '9.5' and '-10.5' is => int(%d)
538: - strcasecmp of '9.5' and '10' is => int(%d)
539: - strcasecmp of '9.5' and '0.5' is => int(%d)
540:
541: Iteration 3
542: - strcasecmp of '11.5' and '10.5' is => int(%d)
543: - strcasecmp of '11.5' and '1.5' is => int(%d)
544: - strcasecmp of '11.5' and '9.5' is => int(-%d)
545: - strcasecmp of '11.5' and '11.5' is => int(0)
546: - strcasecmp of '11.5' and '100.5' is => int(%d)
547: - strcasecmp of '11.5' and '105' is => int(%d)
548: - strcasecmp of '11.5' and '-10.5' is => int(%d)
549: - strcasecmp of '11.5' and '10' is => int(%d)
550: - strcasecmp of '11.5' and '0.5' is => int(%d)
551:
552: Iteration 4
553: - strcasecmp of '100.5' and '10.5' is => int(%d)
554: - strcasecmp of '100.5' and '1.5' is => int(%d)
555: - strcasecmp of '100.5' and '9.5' is => int(-%d)
556: - strcasecmp of '100.5' and '11.5' is => int(-%d)
557: - strcasecmp of '100.5' and '100.5' is => int(0)
558: - strcasecmp of '100.5' and '105' is => int(-%d)
559: - strcasecmp of '100.5' and '-10.5' is => int(%d)
560: - strcasecmp of '100.5' and '10' is => int(%d)
561: - strcasecmp of '100.5' and '0.5' is => int(%d)
562:
563: Iteration 5
564: - strcasecmp of '105' and '10.5' is => int(%d)
565: - strcasecmp of '105' and '1.5' is => int(%d)
566: - strcasecmp of '105' and '9.5' is => int(-%d)
567: - strcasecmp of '105' and '11.5' is => int(-%d)
568: - strcasecmp of '105' and '100.5' is => int(%d)
569: - strcasecmp of '105' and '105' is => int(0)
570: - strcasecmp of '105' and '-10.5' is => int(%d)
571: - strcasecmp of '105' and '10' is => int(%d)
572: - strcasecmp of '105' and '0.5' is => int(%d)
573:
574: Iteration 6
575: - strcasecmp of '-10.5' and '10.5' is => int(-%d)
576: - strcasecmp of '-10.5' and '1.5' is => int(-%d)
577: - strcasecmp of '-10.5' and '9.5' is => int(-%d)
578: - strcasecmp of '-10.5' and '11.5' is => int(-%d)
579: - strcasecmp of '-10.5' and '100.5' is => int(-%d)
580: - strcasecmp of '-10.5' and '105' is => int(-%d)
581: - strcasecmp of '-10.5' and '-10.5' is => int(0)
582: - strcasecmp of '-10.5' and '10' is => int(-%d)
583: - strcasecmp of '-10.5' and '0.5' is => int(-%d)
584:
585: Iteration 7
586: - strcasecmp of '10' and '10.5' is => int(-%d)
587: - strcasecmp of '10' and '1.5' is => int(%d)
588: - strcasecmp of '10' and '9.5' is => int(-%d)
589: - strcasecmp of '10' and '11.5' is => int(-%d)
590: - strcasecmp of '10' and '100.5' is => int(-%d)
591: - strcasecmp of '10' and '105' is => int(-%d)
592: - strcasecmp of '10' and '-10.5' is => int(%d)
593: - strcasecmp of '10' and '10' is => int(0)
594: - strcasecmp of '10' and '0.5' is => int(%d)
595:
596: Iteration 8
597: - strcasecmp of '0.5' and '10.5' is => int(-%d)
598: - strcasecmp of '0.5' and '1.5' is => int(-%d)
599: - strcasecmp of '0.5' and '9.5' is => int(-%d)
600: - strcasecmp of '0.5' and '11.5' is => int(-%d)
601: - strcasecmp of '0.5' and '100.5' is => int(-%d)
602: - strcasecmp of '0.5' and '105' is => int(-%d)
603: - strcasecmp of '0.5' and '-10.5' is => int(%d)
604: - strcasecmp of '0.5' and '10' is => int(-%d)
605: - strcasecmp of '0.5' and '0.5' is => int(0)
606:
607: #### Testing Miscelleneous inputs ####
608: --- Testing objects ---
609: int(-%d)
610:
611: --- Testing arrays ---
612:
613: Warning: strcasecmp() expects parameter 2 to be string, array given in %s on line %d
614: NULL
615: int(%d)
616: int(%d)
617:
618: --- Testing Resources ---
619: int(0)
620: int(%d)
621:
622: --- Testing a longer and heredoc string ---
623: int(0)
624: int(-%d)
625: int(%d)
626:
627: --- Testing a heredoc null string ---
628: int(-%d)
629: int(0)
630: int(-%d)
631:
632: --- Testing simple and complex syntax strings ---
633: int(-%d)
634: int(-%d)
635:
636: Notice: Undefined variable: strS in %s on line %d
637: int(%d)
638: int(-%d)
639: int(-%d)
640:
641: --- Testing binary safe and binary chars ---
642: int(%d)
643: int(-%d)
644: int(0)
645: int(0)
646: int(%d)
647: int(%d)
648: int(%d)
649:
650: --- Comparing long float values ---
651: int(0)
652: int(-%d)
653: int(0)
654:
655: #### checking error conditions ####
656: Warning: strcasecmp() expects exactly 2 parameters, 0 given in %s on line %d
657:
658: Warning: strcasecmp() expects exactly 2 parameters, 1 given in %s on line %d
659:
660: Warning: strcasecmp() expects exactly 2 parameters, 1 given in %s on line %d
661:
662: Warning: strcasecmp() expects exactly 2 parameters, 3 given in %s on line %d
663: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>