Annotation of embedaddon/php/ext/standard/tests/strings/strcmp.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: strcmp() function
! 3: --INI--
! 4: precision = 12
! 5: --FILE--
! 6: <?php
! 7: /* Compares two strings in case-sensitive manner */
! 8:
! 9: echo "#### Basic and Possible operations ####";
! 10: /* creating an array of strings to be compared */
! 11: $arrays = array(
! 12: array("a", "A", '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, "", 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 "- strcmp of '$str1_arr[$i]' and '$str1_arr[$j]' is => ";
! 27: var_dump(strcmp($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(strcmp("$obj_string1", "$obj_string2"));
! 56:
! 57:
! 58: echo "\n--- Testing arrays ---\n";
! 59: $str_arr = array("hello", "?world", "!$%**()%**[][[[&@#~!");
! 60: var_dump(strcmp("hello?world,!$%**()%**[][[[&@#~!", $str_arr));
! 61: var_dump(strcmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[1]"));
! 62: var_dump(strcmp("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(strcmp($string1, $string2)); // int(0)
! 78:
! 79: /* string1 is of "stream" type & string3 is of "int" type */
! 80: var_dump(strcmp($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(strcmp($string, $string));
! 102: var_dump(strcmp($string, "xyz0123456789"));
! 103: var_dump(strcmp($string, "&&&"));
! 104:
! 105: echo "\n--- Testing a heredoc null string ---\n";
! 106: $str = <<<EOD
! 107: EOD;
! 108: var_dump(strcmp($str, "\0"));
! 109: var_dump(strcmp($str, NULL));
! 110: var_dump(strcmp($str, "0"));
! 111:
! 112:
! 113: echo "\n--- Testing simple and complex syntax strings ---\n";
! 114: $str = 'world';
! 115:
! 116: /* Simple syntax */
! 117: var_dump(strcmp("Hello, world", "$str"));
! 118: var_dump(strcmp("Hello, world'S", "$str'S"));
! 119: var_dump(strcmp("Hello, worldS", "$strS"));
! 120:
! 121: /* String with curly braces, complex syntax */
! 122: var_dump(strcmp("Hello, worldS", "${str}S"));
! 123: var_dump(strcmp("Hello, worldS", "{$str}S"));
! 124:
! 125: echo "\n--- Testing binary safe and binary chars ---\n";
! 126: var_dump(strcmp("Hello\0world", "Hello"));
! 127: var_dump(strcmp("Hello\0world", "Helloworld"));
! 128: var_dump(strcmp("\x0", "\0"));
! 129: var_dump(strcmp("\000", "\0"));
! 130: var_dump(strcmp("\x00", ""));
! 131: var_dump(strcmp("\x00", NULL));
! 132: var_dump(strcmp("\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(strcmp(10.55555555555555555555555555, 10.5555555556)); // int(0)
! 138: var_dump(strcmp(10.55555555555555555555555555, 10.555555556)); // int(-1)
! 139: var_dump(strcmp(10.55555555595555555555555555, 10.555555556)); // int(0)
! 140:
! 141:
! 142: echo "\n#### checking error conditions ####";
! 143: strcmp();
! 144: strcmp("");
! 145: strcmp("HI");
! 146: strcmp("Hi", "Hello", "World");
! 147:
! 148: echo "Done\n";
! 149: ?>
! 150: --EXPECTF--
! 151: #### Basic and Possible operations ####
! 152: *** comparing the strings in an
! 153: Array
! 154: (
! 155: [0] => a
! 156: [1] => A
! 157: [2] => a
! 158: [3] => A
! 159: [4] => €
! 160: [5] => ÿ
! 161: [6] =>
! 162: )
! 163:
! 164: Iteration 0
! 165: - strcmp of 'a' and 'a' is => int(0)
! 166: - strcmp of 'a' and 'A' is => int(%d)
! 167: - strcmp of 'a' and 'a' is => int(0)
! 168: - strcmp of 'a' and 'A' is => int(%d)
! 169: - strcmp of 'a' and '€' is => int(-%d)
! 170: - strcmp of 'a' and 'ÿ' is => int(-%d)
! 171: - strcmp of 'a' and ' ' is => int(%d)
! 172:
! 173: Iteration 1
! 174: - strcmp of 'A' and 'a' is => int(-%d)
! 175: - strcmp of 'A' and 'A' is => int(0)
! 176: - strcmp of 'A' and 'a' is => int(-%d)
! 177: - strcmp of 'A' and 'A' is => int(0)
! 178: - strcmp of 'A' and '€' is => int(-%d)
! 179: - strcmp of 'A' and 'ÿ' is => int(-%d)
! 180: - strcmp of 'A' and ' ' is => int(%d)
! 181:
! 182: Iteration 2
! 183: - strcmp of 'a' and 'a' is => int(0)
! 184: - strcmp of 'a' and 'A' is => int(%d)
! 185: - strcmp of 'a' and 'a' is => int(0)
! 186: - strcmp of 'a' and 'A' is => int(%d)
! 187: - strcmp of 'a' and '€' is => int(-%d)
! 188: - strcmp of 'a' and 'ÿ' is => int(-%d)
! 189: - strcmp of 'a' and ' ' is => int(%d)
! 190:
! 191: Iteration 3
! 192: - strcmp of 'A' and 'a' is => int(-%d)
! 193: - strcmp of 'A' and 'A' is => int(0)
! 194: - strcmp of 'A' and 'a' is => int(-%d)
! 195: - strcmp of 'A' and 'A' is => int(0)
! 196: - strcmp of 'A' and '€' is => int(-%d)
! 197: - strcmp of 'A' and 'ÿ' is => int(-%d)
! 198: - strcmp of 'A' and ' ' is => int(%d)
! 199:
! 200: Iteration 4
! 201: - strcmp of '€' and 'a' is => int(%d)
! 202: - strcmp of '€' and 'A' is => int(%d)
! 203: - strcmp of '€' and 'a' is => int(%d)
! 204: - strcmp of '€' and 'A' is => int(%d)
! 205: - strcmp of '€' and '€' is => int(0)
! 206: - strcmp of '€' and 'ÿ' is => int(-%d)
! 207: - strcmp of '€' and ' ' is => int(%d)
! 208:
! 209: Iteration 5
! 210: - strcmp of 'ÿ' and 'a' is => int(%d)
! 211: - strcmp of 'ÿ' and 'A' is => int(%d)
! 212: - strcmp of 'ÿ' and 'a' is => int(%d)
! 213: - strcmp of 'ÿ' and 'A' is => int(%d)
! 214: - strcmp of 'ÿ' and '€' is => int(%d)
! 215: - strcmp of 'ÿ' and 'ÿ' is => int(0)
! 216: - strcmp of 'ÿ' and ' ' is => int(%d)
! 217:
! 218: Iteration 6
! 219: - strcmp of ' ' and 'a' is => int(-%d)
! 220: - strcmp of ' ' and 'A' is => int(-%d)
! 221: - strcmp of ' ' and 'a' is => int(-%d)
! 222: - strcmp of ' ' and 'A' is => int(-%d)
! 223: - strcmp of ' ' and '€' is => int(-%d)
! 224: - strcmp of ' ' and 'ÿ' is => int(-%d)
! 225: - strcmp of ' ' and ' ' is => int(0)
! 226:
! 227: *** comparing the strings in an
! 228: Array
! 229: (
! 230: [0] => acc
! 231: [1] => Acc
! 232: [2] => ac
! 233: [3] => accc
! 234: [4] => acd
! 235: [5] => ?acc
! 236: [6] => acc!
! 237: [7] => $!acc
! 238: [8] => ;acc
! 239: )
! 240:
! 241: Iteration 0
! 242: - strcmp of 'acc' and 'acc' is => int(0)
! 243: - strcmp of 'acc' and 'Acc' is => int(%d)
! 244: - strcmp of 'acc' and 'ac' is => int(%d)
! 245: - strcmp of 'acc' and 'accc' is => int(-%d)
! 246: - strcmp of 'acc' and 'acd' is => int(-%d)
! 247: - strcmp of 'acc' and '?acc' is => int(%d)
! 248: - strcmp of 'acc' and 'acc!' is => int(-%d)
! 249: - strcmp of 'acc' and '$!acc' is => int(%d)
! 250: - strcmp of 'acc' and ';acc' is => int(%d)
! 251:
! 252: Iteration 1
! 253: - strcmp of 'Acc' and 'acc' is => int(-%d)
! 254: - strcmp of 'Acc' and 'Acc' is => int(0)
! 255: - strcmp of 'Acc' and 'ac' is => int(-%d)
! 256: - strcmp of 'Acc' and 'accc' is => int(-%d)
! 257: - strcmp of 'Acc' and 'acd' is => int(-%d)
! 258: - strcmp of 'Acc' and '?acc' is => int(%d)
! 259: - strcmp of 'Acc' and 'acc!' is => int(-%d)
! 260: - strcmp of 'Acc' and '$!acc' is => int(%d)
! 261: - strcmp of 'Acc' and ';acc' is => int(%d)
! 262:
! 263: Iteration 2
! 264: - strcmp of 'ac' and 'acc' is => int(-%d)
! 265: - strcmp of 'ac' and 'Acc' is => int(%d)
! 266: - strcmp of 'ac' and 'ac' is => int(0)
! 267: - strcmp of 'ac' and 'accc' is => int(-%d)
! 268: - strcmp of 'ac' and 'acd' is => int(-%d)
! 269: - strcmp of 'ac' and '?acc' is => int(%d)
! 270: - strcmp of 'ac' and 'acc!' is => int(-%d)
! 271: - strcmp of 'ac' and '$!acc' is => int(%d)
! 272: - strcmp of 'ac' and ';acc' is => int(%d)
! 273:
! 274: Iteration 3
! 275: - strcmp of 'accc' and 'acc' is => int(%d)
! 276: - strcmp of 'accc' and 'Acc' is => int(%d)
! 277: - strcmp of 'accc' and 'ac' is => int(%d)
! 278: - strcmp of 'accc' and 'accc' is => int(0)
! 279: - strcmp of 'accc' and 'acd' is => int(-%d)
! 280: - strcmp of 'accc' and '?acc' is => int(%d)
! 281: - strcmp of 'accc' and 'acc!' is => int(%d)
! 282: - strcmp of 'accc' and '$!acc' is => int(%d)
! 283: - strcmp of 'accc' and ';acc' is => int(%d)
! 284:
! 285: Iteration 4
! 286: - strcmp of 'acd' and 'acc' is => int(%d)
! 287: - strcmp of 'acd' and 'Acc' is => int(%d)
! 288: - strcmp of 'acd' and 'ac' is => int(%d)
! 289: - strcmp of 'acd' and 'accc' is => int(%d)
! 290: - strcmp of 'acd' and 'acd' is => int(0)
! 291: - strcmp of 'acd' and '?acc' is => int(%d)
! 292: - strcmp of 'acd' and 'acc!' is => int(%d)
! 293: - strcmp of 'acd' and '$!acc' is => int(%d)
! 294: - strcmp of 'acd' and ';acc' is => int(%d)
! 295:
! 296: Iteration 5
! 297: - strcmp of '?acc' and 'acc' is => int(-%d)
! 298: - strcmp of '?acc' and 'Acc' is => int(-%d)
! 299: - strcmp of '?acc' and 'ac' is => int(-%d)
! 300: - strcmp of '?acc' and 'accc' is => int(-%d)
! 301: - strcmp of '?acc' and 'acd' is => int(-%d)
! 302: - strcmp of '?acc' and '?acc' is => int(0)
! 303: - strcmp of '?acc' and 'acc!' is => int(-%d)
! 304: - strcmp of '?acc' and '$!acc' is => int(%d)
! 305: - strcmp of '?acc' and ';acc' is => int(%d)
! 306:
! 307: Iteration 6
! 308: - strcmp of 'acc!' and 'acc' is => int(%d)
! 309: - strcmp of 'acc!' and 'Acc' is => int(%d)
! 310: - strcmp of 'acc!' and 'ac' is => int(%d)
! 311: - strcmp of 'acc!' and 'accc' is => int(-%d)
! 312: - strcmp of 'acc!' and 'acd' is => int(-%d)
! 313: - strcmp of 'acc!' and '?acc' is => int(%d)
! 314: - strcmp of 'acc!' and 'acc!' is => int(0)
! 315: - strcmp of 'acc!' and '$!acc' is => int(%d)
! 316: - strcmp of 'acc!' and ';acc' is => int(%d)
! 317:
! 318: Iteration 7
! 319: - strcmp of '$!acc' and 'acc' is => int(-%d)
! 320: - strcmp of '$!acc' and 'Acc' is => int(-%d)
! 321: - strcmp of '$!acc' and 'ac' is => int(-%d)
! 322: - strcmp of '$!acc' and 'accc' is => int(-%d)
! 323: - strcmp of '$!acc' and 'acd' is => int(-%d)
! 324: - strcmp of '$!acc' and '?acc' is => int(-%d)
! 325: - strcmp of '$!acc' and 'acc!' is => int(-%d)
! 326: - strcmp of '$!acc' and '$!acc' is => int(0)
! 327: - strcmp of '$!acc' and ';acc' is => int(-%d)
! 328:
! 329: Iteration 8
! 330: - strcmp of ';acc' and 'acc' is => int(-%d)
! 331: - strcmp of ';acc' and 'Acc' is => int(-%d)
! 332: - strcmp of ';acc' and 'ac' is => int(-%d)
! 333: - strcmp of ';acc' and 'accc' is => int(-%d)
! 334: - strcmp of ';acc' and 'acd' is => int(-%d)
! 335: - strcmp of ';acc' and '?acc' is => int(-%d)
! 336: - strcmp of ';acc' and 'acc!' is => int(-%d)
! 337: - strcmp of ';acc' and '$!acc' is => int(%d)
! 338: - strcmp of ';acc' and ';acc' is => int(0)
! 339:
! 340: *** comparing the strings in an
! 341: Array
! 342: (
! 343: [0] => 1
! 344: [1] => 0
! 345: [2] => 0
! 346: [3] => -1
! 347: [4] => -1
! 348: [5] =>
! 349: [6] =>
! 350: [7] => 1
! 351: [8] =>
! 352: [9] => string
! 353: )
! 354:
! 355: Iteration 0
! 356: - strcmp of '1' and '1' is => int(0)
! 357: - strcmp of '1' and '0' is => int(%d)
! 358: - strcmp of '1' and '0' is => int(%d)
! 359: - strcmp of '1' and '-1' is => int(%d)
! 360: - strcmp of '1' and '-1' is => int(%d)
! 361: - strcmp of '1' and '' is => int(%d)
! 362: - strcmp of '1' and '' is => int(%d)
! 363: - strcmp of '1' and '1' is => int(0)
! 364: - strcmp of '1' and '' is => int(%d)
! 365: - strcmp of '1' and 'string' is => int(-%d)
! 366:
! 367: Iteration 1
! 368: - strcmp of '0' and '1' is => int(-%d)
! 369: - strcmp of '0' and '0' is => int(0)
! 370: - strcmp of '0' and '0' is => int(0)
! 371: - strcmp of '0' and '-1' is => int(%d)
! 372: - strcmp of '0' and '-1' is => int(%d)
! 373: - strcmp of '0' and '' is => int(%d)
! 374: - strcmp of '0' and '' is => int(%d)
! 375: - strcmp of '0' and '1' is => int(-%d)
! 376: - strcmp of '0' and '' is => int(%d)
! 377: - strcmp of '0' and 'string' is => int(-%d)
! 378:
! 379: Iteration 2
! 380: - strcmp of '0' and '1' is => int(-%d)
! 381: - strcmp of '0' and '0' is => int(0)
! 382: - strcmp of '0' and '0' is => int(0)
! 383: - strcmp of '0' and '-1' is => int(%d)
! 384: - strcmp of '0' and '-1' is => int(%d)
! 385: - strcmp of '0' and '' is => int(%d)
! 386: - strcmp of '0' and '' is => int(%d)
! 387: - strcmp of '0' and '1' is => int(-%d)
! 388: - strcmp of '0' and '' is => int(%d)
! 389: - strcmp of '0' and 'string' is => int(-%d)
! 390:
! 391: Iteration 3
! 392: - strcmp of '-1' and '1' is => int(-%d)
! 393: - strcmp of '-1' and '0' is => int(-%d)
! 394: - strcmp of '-1' and '0' is => int(-%d)
! 395: - strcmp of '-1' and '-1' is => int(0)
! 396: - strcmp of '-1' and '-1' is => int(0)
! 397: - strcmp of '-1' and '' is => int(%d)
! 398: - strcmp of '-1' and '' is => int(%d)
! 399: - strcmp of '-1' and '1' is => int(-%d)
! 400: - strcmp of '-1' and '' is => int(%d)
! 401: - strcmp of '-1' and 'string' is => int(-%d)
! 402:
! 403: Iteration 4
! 404: - strcmp of '-1' and '1' is => int(-%d)
! 405: - strcmp of '-1' and '0' is => int(-%d)
! 406: - strcmp of '-1' and '0' is => int(-%d)
! 407: - strcmp of '-1' and '-1' is => int(0)
! 408: - strcmp of '-1' and '-1' is => int(0)
! 409: - strcmp of '-1' and '' is => int(%d)
! 410: - strcmp of '-1' and '' is => int(%d)
! 411: - strcmp of '-1' and '1' is => int(-%d)
! 412: - strcmp of '-1' and '' is => int(%d)
! 413: - strcmp of '-1' and 'string' is => int(-%d)
! 414:
! 415: Iteration 5
! 416: - strcmp of '' and '1' is => int(-%d)
! 417: - strcmp of '' and '0' is => int(-%d)
! 418: - strcmp of '' and '0' is => int(-%d)
! 419: - strcmp of '' and '-1' is => int(-%d)
! 420: - strcmp of '' and '-1' is => int(-%d)
! 421: - strcmp of '' and '' is => int(0)
! 422: - strcmp of '' and '' is => int(0)
! 423: - strcmp of '' and '1' is => int(-%d)
! 424: - strcmp of '' and '' is => int(0)
! 425: - strcmp of '' and 'string' is => int(-%d)
! 426:
! 427: Iteration 6
! 428: - strcmp of '' and '1' is => int(-%d)
! 429: - strcmp of '' and '0' is => int(-%d)
! 430: - strcmp of '' and '0' is => int(-%d)
! 431: - strcmp of '' and '-1' is => int(-%d)
! 432: - strcmp of '' and '-1' is => int(-%d)
! 433: - strcmp of '' and '' is => int(0)
! 434: - strcmp of '' and '' is => int(0)
! 435: - strcmp of '' and '1' is => int(-%d)
! 436: - strcmp of '' and '' is => int(0)
! 437: - strcmp of '' and 'string' is => int(-%d)
! 438:
! 439: Iteration 7
! 440: - strcmp of '1' and '1' is => int(0)
! 441: - strcmp of '1' and '0' is => int(%d)
! 442: - strcmp of '1' and '0' is => int(%d)
! 443: - strcmp of '1' and '-1' is => int(%d)
! 444: - strcmp of '1' and '-1' is => int(%d)
! 445: - strcmp of '1' and '' is => int(%d)
! 446: - strcmp of '1' and '' is => int(%d)
! 447: - strcmp of '1' and '1' is => int(0)
! 448: - strcmp of '1' and '' is => int(%d)
! 449: - strcmp of '1' and 'string' is => int(-%d)
! 450:
! 451: Iteration 8
! 452: - strcmp of '' and '1' is => int(-%d)
! 453: - strcmp of '' and '0' is => int(-%d)
! 454: - strcmp of '' and '0' is => int(-%d)
! 455: - strcmp of '' and '-1' is => int(-%d)
! 456: - strcmp of '' and '-1' is => int(-%d)
! 457: - strcmp of '' and '' is => int(0)
! 458: - strcmp of '' and '' is => int(0)
! 459: - strcmp of '' and '1' is => int(-%d)
! 460: - strcmp of '' and '' is => int(0)
! 461: - strcmp of '' and 'string' is => int(-%d)
! 462:
! 463: Iteration 9
! 464: - strcmp of 'string' and '1' is => int(%d)
! 465: - strcmp of 'string' and '0' is => int(%d)
! 466: - strcmp of 'string' and '0' is => int(%d)
! 467: - strcmp of 'string' and '-1' is => int(%d)
! 468: - strcmp of 'string' and '-1' is => int(%d)
! 469: - strcmp of 'string' and '' is => int(%d)
! 470: - strcmp of 'string' and '' is => int(%d)
! 471: - strcmp of 'string' and '1' is => int(%d)
! 472: - strcmp of 'string' and '' is => int(%d)
! 473: - strcmp of 'string' and 'string' is => int(0)
! 474:
! 475: *** comparing the strings in an
! 476: Array
! 477: (
! 478: [0] => 10.5
! 479: [1] => 1.5
! 480: [2] => 9.5
! 481: [3] => 11.5
! 482: [4] => 100.5
! 483: [5] => 105
! 484: [6] => -10.5
! 485: [7] => 10
! 486: [8] => 0.5
! 487: )
! 488:
! 489: Iteration 0
! 490: - strcmp of '10.5' and '10.5' is => int(0)
! 491: - strcmp of '10.5' and '1.5' is => int(%d)
! 492: - strcmp of '10.5' and '9.5' is => int(-%d)
! 493: - strcmp of '10.5' and '11.5' is => int(-%d)
! 494: - strcmp of '10.5' and '100.5' is => int(-%d)
! 495: - strcmp of '10.5' and '105' is => int(-%d)
! 496: - strcmp of '10.5' and '-10.5' is => int(%d)
! 497: - strcmp of '10.5' and '10' is => int(%d)
! 498: - strcmp of '10.5' and '0.5' is => int(%d)
! 499:
! 500: Iteration 1
! 501: - strcmp of '1.5' and '10.5' is => int(-%d)
! 502: - strcmp of '1.5' and '1.5' is => int(0)
! 503: - strcmp of '1.5' and '9.5' is => int(-%d)
! 504: - strcmp of '1.5' and '11.5' is => int(-%d)
! 505: - strcmp of '1.5' and '100.5' is => int(-%d)
! 506: - strcmp of '1.5' and '105' is => int(-%d)
! 507: - strcmp of '1.5' and '-10.5' is => int(%d)
! 508: - strcmp of '1.5' and '10' is => int(-%d)
! 509: - strcmp of '1.5' and '0.5' is => int(%d)
! 510:
! 511: Iteration 2
! 512: - strcmp of '9.5' and '10.5' is => int(%d)
! 513: - strcmp of '9.5' and '1.5' is => int(%d)
! 514: - strcmp of '9.5' and '9.5' is => int(0)
! 515: - strcmp of '9.5' and '11.5' is => int(%d)
! 516: - strcmp of '9.5' and '100.5' is => int(%d)
! 517: - strcmp of '9.5' and '105' is => int(%d)
! 518: - strcmp of '9.5' and '-10.5' is => int(%d)
! 519: - strcmp of '9.5' and '10' is => int(%d)
! 520: - strcmp of '9.5' and '0.5' is => int(%d)
! 521:
! 522: Iteration 3
! 523: - strcmp of '11.5' and '10.5' is => int(%d)
! 524: - strcmp of '11.5' and '1.5' is => int(%d)
! 525: - strcmp of '11.5' and '9.5' is => int(-%d)
! 526: - strcmp of '11.5' and '11.5' is => int(0)
! 527: - strcmp of '11.5' and '100.5' is => int(%d)
! 528: - strcmp of '11.5' and '105' is => int(%d)
! 529: - strcmp of '11.5' and '-10.5' is => int(%d)
! 530: - strcmp of '11.5' and '10' is => int(%d)
! 531: - strcmp of '11.5' and '0.5' is => int(%d)
! 532:
! 533: Iteration 4
! 534: - strcmp of '100.5' and '10.5' is => int(%d)
! 535: - strcmp of '100.5' and '1.5' is => int(%d)
! 536: - strcmp of '100.5' and '9.5' is => int(-%d)
! 537: - strcmp of '100.5' and '11.5' is => int(-%d)
! 538: - strcmp of '100.5' and '100.5' is => int(0)
! 539: - strcmp of '100.5' and '105' is => int(-%d)
! 540: - strcmp of '100.5' and '-10.5' is => int(%d)
! 541: - strcmp of '100.5' and '10' is => int(%d)
! 542: - strcmp of '100.5' and '0.5' is => int(%d)
! 543:
! 544: Iteration 5
! 545: - strcmp of '105' and '10.5' is => int(%d)
! 546: - strcmp of '105' and '1.5' is => int(%d)
! 547: - strcmp of '105' and '9.5' is => int(-%d)
! 548: - strcmp of '105' and '11.5' is => int(-%d)
! 549: - strcmp of '105' and '100.5' is => int(%d)
! 550: - strcmp of '105' and '105' is => int(0)
! 551: - strcmp of '105' and '-10.5' is => int(%d)
! 552: - strcmp of '105' and '10' is => int(%d)
! 553: - strcmp of '105' and '0.5' is => int(%d)
! 554:
! 555: Iteration 6
! 556: - strcmp of '-10.5' and '10.5' is => int(-%d)
! 557: - strcmp of '-10.5' and '1.5' is => int(-%d)
! 558: - strcmp of '-10.5' and '9.5' is => int(-%d)
! 559: - strcmp of '-10.5' and '11.5' is => int(-%d)
! 560: - strcmp of '-10.5' and '100.5' is => int(-%d)
! 561: - strcmp of '-10.5' and '105' is => int(-%d)
! 562: - strcmp of '-10.5' and '-10.5' is => int(0)
! 563: - strcmp of '-10.5' and '10' is => int(-%d)
! 564: - strcmp of '-10.5' and '0.5' is => int(-%d)
! 565:
! 566: Iteration 7
! 567: - strcmp of '10' and '10.5' is => int(-%d)
! 568: - strcmp of '10' and '1.5' is => int(%d)
! 569: - strcmp of '10' and '9.5' is => int(-%d)
! 570: - strcmp of '10' and '11.5' is => int(-%d)
! 571: - strcmp of '10' and '100.5' is => int(-%d)
! 572: - strcmp of '10' and '105' is => int(-%d)
! 573: - strcmp of '10' and '-10.5' is => int(%d)
! 574: - strcmp of '10' and '10' is => int(0)
! 575: - strcmp of '10' and '0.5' is => int(%d)
! 576:
! 577: Iteration 8
! 578: - strcmp of '0.5' and '10.5' is => int(-%d)
! 579: - strcmp of '0.5' and '1.5' is => int(-%d)
! 580: - strcmp of '0.5' and '9.5' is => int(-%d)
! 581: - strcmp of '0.5' and '11.5' is => int(-%d)
! 582: - strcmp of '0.5' and '100.5' is => int(-%d)
! 583: - strcmp of '0.5' and '105' is => int(-%d)
! 584: - strcmp of '0.5' and '-10.5' is => int(%d)
! 585: - strcmp of '0.5' and '10' is => int(-%d)
! 586: - strcmp of '0.5' and '0.5' is => int(0)
! 587:
! 588: #### Testing Miscelleneous inputs ####
! 589: --- Testing objects ---
! 590: int(-%d)
! 591:
! 592: --- Testing arrays ---
! 593:
! 594: Warning: strcmp() expects parameter 2 to be string, array given in %s on line %d
! 595: NULL
! 596: int(%d)
! 597: int(%d)
! 598:
! 599: --- Testing Resources ---
! 600: int(0)
! 601: int(%d)
! 602:
! 603: --- Testing a longer and heredoc string ---
! 604: int(0)
! 605: int(-%d)
! 606: int(%d)
! 607:
! 608: --- Testing a heredoc null string ---
! 609: int(-%d)
! 610: int(0)
! 611: int(-%d)
! 612:
! 613: --- Testing simple and complex syntax strings ---
! 614: int(-%d)
! 615: int(-%d)
! 616:
! 617: Notice: Undefined variable: strS in %s on line %d
! 618: int(%d)
! 619: int(-%d)
! 620: int(-%d)
! 621:
! 622: --- Testing binary safe and binary chars ---
! 623: int(%d)
! 624: int(-%d)
! 625: int(0)
! 626: int(0)
! 627: int(%d)
! 628: int(%d)
! 629: int(%d)
! 630:
! 631: --- Comparing long float values ---
! 632: int(0)
! 633: int(-%d)
! 634: int(0)
! 635:
! 636: #### checking error conditions ####
! 637: Warning: strcmp() expects exactly 2 parameters, 0 given in %s on line %d
! 638:
! 639: Warning: strcmp() expects exactly 2 parameters, 1 given in %s on line %d
! 640:
! 641: Warning: strcmp() expects exactly 2 parameters, 1 given in %s on line %d
! 642:
! 643: Warning: strcmp() expects exactly 2 parameters, 3 given in %s on line %d
! 644: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>