Annotation of embedaddon/php/tests/lang/operators/add_variationStr.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test + operator : various numbers as strings
! 3: --FILE--
! 4: <?php
! 5:
! 6: $strVals = array(
! 7: "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
! 8: "a5.9"
! 9: );
! 10:
! 11: error_reporting(E_ERROR);
! 12:
! 13: foreach ($strVals as $strVal) {
! 14: foreach($strVals as $otherVal) {
! 15: echo "--- testing: '$strVal' + '$otherVal' ---\n";
! 16: var_dump($strVal+$otherVal);
! 17: }
! 18: }
! 19:
! 20:
! 21: ?>
! 22: ===DONE===
! 23: --EXPECT--
! 24: --- testing: '0' + '0' ---
! 25: int(0)
! 26: --- testing: '0' + '65' ---
! 27: int(65)
! 28: --- testing: '0' + '-44' ---
! 29: int(-44)
! 30: --- testing: '0' + '1.2' ---
! 31: float(1.2)
! 32: --- testing: '0' + '-7.7' ---
! 33: float(-7.7)
! 34: --- testing: '0' + 'abc' ---
! 35: int(0)
! 36: --- testing: '0' + '123abc' ---
! 37: int(123)
! 38: --- testing: '0' + '123e5' ---
! 39: float(12300000)
! 40: --- testing: '0' + '123e5xyz' ---
! 41: float(12300000)
! 42: --- testing: '0' + ' 123abc' ---
! 43: int(123)
! 44: --- testing: '0' + '123 abc' ---
! 45: int(123)
! 46: --- testing: '0' + '123abc ' ---
! 47: int(123)
! 48: --- testing: '0' + '3.4a' ---
! 49: float(3.4)
! 50: --- testing: '0' + 'a5.9' ---
! 51: int(0)
! 52: --- testing: '65' + '0' ---
! 53: int(65)
! 54: --- testing: '65' + '65' ---
! 55: int(130)
! 56: --- testing: '65' + '-44' ---
! 57: int(21)
! 58: --- testing: '65' + '1.2' ---
! 59: float(66.2)
! 60: --- testing: '65' + '-7.7' ---
! 61: float(57.3)
! 62: --- testing: '65' + 'abc' ---
! 63: int(65)
! 64: --- testing: '65' + '123abc' ---
! 65: int(188)
! 66: --- testing: '65' + '123e5' ---
! 67: float(12300065)
! 68: --- testing: '65' + '123e5xyz' ---
! 69: float(12300065)
! 70: --- testing: '65' + ' 123abc' ---
! 71: int(188)
! 72: --- testing: '65' + '123 abc' ---
! 73: int(188)
! 74: --- testing: '65' + '123abc ' ---
! 75: int(188)
! 76: --- testing: '65' + '3.4a' ---
! 77: float(68.4)
! 78: --- testing: '65' + 'a5.9' ---
! 79: int(65)
! 80: --- testing: '-44' + '0' ---
! 81: int(-44)
! 82: --- testing: '-44' + '65' ---
! 83: int(21)
! 84: --- testing: '-44' + '-44' ---
! 85: int(-88)
! 86: --- testing: '-44' + '1.2' ---
! 87: float(-42.8)
! 88: --- testing: '-44' + '-7.7' ---
! 89: float(-51.7)
! 90: --- testing: '-44' + 'abc' ---
! 91: int(-44)
! 92: --- testing: '-44' + '123abc' ---
! 93: int(79)
! 94: --- testing: '-44' + '123e5' ---
! 95: float(12299956)
! 96: --- testing: '-44' + '123e5xyz' ---
! 97: float(12299956)
! 98: --- testing: '-44' + ' 123abc' ---
! 99: int(79)
! 100: --- testing: '-44' + '123 abc' ---
! 101: int(79)
! 102: --- testing: '-44' + '123abc ' ---
! 103: int(79)
! 104: --- testing: '-44' + '3.4a' ---
! 105: float(-40.6)
! 106: --- testing: '-44' + 'a5.9' ---
! 107: int(-44)
! 108: --- testing: '1.2' + '0' ---
! 109: float(1.2)
! 110: --- testing: '1.2' + '65' ---
! 111: float(66.2)
! 112: --- testing: '1.2' + '-44' ---
! 113: float(-42.8)
! 114: --- testing: '1.2' + '1.2' ---
! 115: float(2.4)
! 116: --- testing: '1.2' + '-7.7' ---
! 117: float(-6.5)
! 118: --- testing: '1.2' + 'abc' ---
! 119: float(1.2)
! 120: --- testing: '1.2' + '123abc' ---
! 121: float(124.2)
! 122: --- testing: '1.2' + '123e5' ---
! 123: float(12300001.2)
! 124: --- testing: '1.2' + '123e5xyz' ---
! 125: float(12300001.2)
! 126: --- testing: '1.2' + ' 123abc' ---
! 127: float(124.2)
! 128: --- testing: '1.2' + '123 abc' ---
! 129: float(124.2)
! 130: --- testing: '1.2' + '123abc ' ---
! 131: float(124.2)
! 132: --- testing: '1.2' + '3.4a' ---
! 133: float(4.6)
! 134: --- testing: '1.2' + 'a5.9' ---
! 135: float(1.2)
! 136: --- testing: '-7.7' + '0' ---
! 137: float(-7.7)
! 138: --- testing: '-7.7' + '65' ---
! 139: float(57.3)
! 140: --- testing: '-7.7' + '-44' ---
! 141: float(-51.7)
! 142: --- testing: '-7.7' + '1.2' ---
! 143: float(-6.5)
! 144: --- testing: '-7.7' + '-7.7' ---
! 145: float(-15.4)
! 146: --- testing: '-7.7' + 'abc' ---
! 147: float(-7.7)
! 148: --- testing: '-7.7' + '123abc' ---
! 149: float(115.3)
! 150: --- testing: '-7.7' + '123e5' ---
! 151: float(12299992.3)
! 152: --- testing: '-7.7' + '123e5xyz' ---
! 153: float(12299992.3)
! 154: --- testing: '-7.7' + ' 123abc' ---
! 155: float(115.3)
! 156: --- testing: '-7.7' + '123 abc' ---
! 157: float(115.3)
! 158: --- testing: '-7.7' + '123abc ' ---
! 159: float(115.3)
! 160: --- testing: '-7.7' + '3.4a' ---
! 161: float(-4.3)
! 162: --- testing: '-7.7' + 'a5.9' ---
! 163: float(-7.7)
! 164: --- testing: 'abc' + '0' ---
! 165: int(0)
! 166: --- testing: 'abc' + '65' ---
! 167: int(65)
! 168: --- testing: 'abc' + '-44' ---
! 169: int(-44)
! 170: --- testing: 'abc' + '1.2' ---
! 171: float(1.2)
! 172: --- testing: 'abc' + '-7.7' ---
! 173: float(-7.7)
! 174: --- testing: 'abc' + 'abc' ---
! 175: int(0)
! 176: --- testing: 'abc' + '123abc' ---
! 177: int(123)
! 178: --- testing: 'abc' + '123e5' ---
! 179: float(12300000)
! 180: --- testing: 'abc' + '123e5xyz' ---
! 181: float(12300000)
! 182: --- testing: 'abc' + ' 123abc' ---
! 183: int(123)
! 184: --- testing: 'abc' + '123 abc' ---
! 185: int(123)
! 186: --- testing: 'abc' + '123abc ' ---
! 187: int(123)
! 188: --- testing: 'abc' + '3.4a' ---
! 189: float(3.4)
! 190: --- testing: 'abc' + 'a5.9' ---
! 191: int(0)
! 192: --- testing: '123abc' + '0' ---
! 193: int(123)
! 194: --- testing: '123abc' + '65' ---
! 195: int(188)
! 196: --- testing: '123abc' + '-44' ---
! 197: int(79)
! 198: --- testing: '123abc' + '1.2' ---
! 199: float(124.2)
! 200: --- testing: '123abc' + '-7.7' ---
! 201: float(115.3)
! 202: --- testing: '123abc' + 'abc' ---
! 203: int(123)
! 204: --- testing: '123abc' + '123abc' ---
! 205: int(246)
! 206: --- testing: '123abc' + '123e5' ---
! 207: float(12300123)
! 208: --- testing: '123abc' + '123e5xyz' ---
! 209: float(12300123)
! 210: --- testing: '123abc' + ' 123abc' ---
! 211: int(246)
! 212: --- testing: '123abc' + '123 abc' ---
! 213: int(246)
! 214: --- testing: '123abc' + '123abc ' ---
! 215: int(246)
! 216: --- testing: '123abc' + '3.4a' ---
! 217: float(126.4)
! 218: --- testing: '123abc' + 'a5.9' ---
! 219: int(123)
! 220: --- testing: '123e5' + '0' ---
! 221: float(12300000)
! 222: --- testing: '123e5' + '65' ---
! 223: float(12300065)
! 224: --- testing: '123e5' + '-44' ---
! 225: float(12299956)
! 226: --- testing: '123e5' + '1.2' ---
! 227: float(12300001.2)
! 228: --- testing: '123e5' + '-7.7' ---
! 229: float(12299992.3)
! 230: --- testing: '123e5' + 'abc' ---
! 231: float(12300000)
! 232: --- testing: '123e5' + '123abc' ---
! 233: float(12300123)
! 234: --- testing: '123e5' + '123e5' ---
! 235: float(24600000)
! 236: --- testing: '123e5' + '123e5xyz' ---
! 237: float(24600000)
! 238: --- testing: '123e5' + ' 123abc' ---
! 239: float(12300123)
! 240: --- testing: '123e5' + '123 abc' ---
! 241: float(12300123)
! 242: --- testing: '123e5' + '123abc ' ---
! 243: float(12300123)
! 244: --- testing: '123e5' + '3.4a' ---
! 245: float(12300003.4)
! 246: --- testing: '123e5' + 'a5.9' ---
! 247: float(12300000)
! 248: --- testing: '123e5xyz' + '0' ---
! 249: float(12300000)
! 250: --- testing: '123e5xyz' + '65' ---
! 251: float(12300065)
! 252: --- testing: '123e5xyz' + '-44' ---
! 253: float(12299956)
! 254: --- testing: '123e5xyz' + '1.2' ---
! 255: float(12300001.2)
! 256: --- testing: '123e5xyz' + '-7.7' ---
! 257: float(12299992.3)
! 258: --- testing: '123e5xyz' + 'abc' ---
! 259: float(12300000)
! 260: --- testing: '123e5xyz' + '123abc' ---
! 261: float(12300123)
! 262: --- testing: '123e5xyz' + '123e5' ---
! 263: float(24600000)
! 264: --- testing: '123e5xyz' + '123e5xyz' ---
! 265: float(24600000)
! 266: --- testing: '123e5xyz' + ' 123abc' ---
! 267: float(12300123)
! 268: --- testing: '123e5xyz' + '123 abc' ---
! 269: float(12300123)
! 270: --- testing: '123e5xyz' + '123abc ' ---
! 271: float(12300123)
! 272: --- testing: '123e5xyz' + '3.4a' ---
! 273: float(12300003.4)
! 274: --- testing: '123e5xyz' + 'a5.9' ---
! 275: float(12300000)
! 276: --- testing: ' 123abc' + '0' ---
! 277: int(123)
! 278: --- testing: ' 123abc' + '65' ---
! 279: int(188)
! 280: --- testing: ' 123abc' + '-44' ---
! 281: int(79)
! 282: --- testing: ' 123abc' + '1.2' ---
! 283: float(124.2)
! 284: --- testing: ' 123abc' + '-7.7' ---
! 285: float(115.3)
! 286: --- testing: ' 123abc' + 'abc' ---
! 287: int(123)
! 288: --- testing: ' 123abc' + '123abc' ---
! 289: int(246)
! 290: --- testing: ' 123abc' + '123e5' ---
! 291: float(12300123)
! 292: --- testing: ' 123abc' + '123e5xyz' ---
! 293: float(12300123)
! 294: --- testing: ' 123abc' + ' 123abc' ---
! 295: int(246)
! 296: --- testing: ' 123abc' + '123 abc' ---
! 297: int(246)
! 298: --- testing: ' 123abc' + '123abc ' ---
! 299: int(246)
! 300: --- testing: ' 123abc' + '3.4a' ---
! 301: float(126.4)
! 302: --- testing: ' 123abc' + 'a5.9' ---
! 303: int(123)
! 304: --- testing: '123 abc' + '0' ---
! 305: int(123)
! 306: --- testing: '123 abc' + '65' ---
! 307: int(188)
! 308: --- testing: '123 abc' + '-44' ---
! 309: int(79)
! 310: --- testing: '123 abc' + '1.2' ---
! 311: float(124.2)
! 312: --- testing: '123 abc' + '-7.7' ---
! 313: float(115.3)
! 314: --- testing: '123 abc' + 'abc' ---
! 315: int(123)
! 316: --- testing: '123 abc' + '123abc' ---
! 317: int(246)
! 318: --- testing: '123 abc' + '123e5' ---
! 319: float(12300123)
! 320: --- testing: '123 abc' + '123e5xyz' ---
! 321: float(12300123)
! 322: --- testing: '123 abc' + ' 123abc' ---
! 323: int(246)
! 324: --- testing: '123 abc' + '123 abc' ---
! 325: int(246)
! 326: --- testing: '123 abc' + '123abc ' ---
! 327: int(246)
! 328: --- testing: '123 abc' + '3.4a' ---
! 329: float(126.4)
! 330: --- testing: '123 abc' + 'a5.9' ---
! 331: int(123)
! 332: --- testing: '123abc ' + '0' ---
! 333: int(123)
! 334: --- testing: '123abc ' + '65' ---
! 335: int(188)
! 336: --- testing: '123abc ' + '-44' ---
! 337: int(79)
! 338: --- testing: '123abc ' + '1.2' ---
! 339: float(124.2)
! 340: --- testing: '123abc ' + '-7.7' ---
! 341: float(115.3)
! 342: --- testing: '123abc ' + 'abc' ---
! 343: int(123)
! 344: --- testing: '123abc ' + '123abc' ---
! 345: int(246)
! 346: --- testing: '123abc ' + '123e5' ---
! 347: float(12300123)
! 348: --- testing: '123abc ' + '123e5xyz' ---
! 349: float(12300123)
! 350: --- testing: '123abc ' + ' 123abc' ---
! 351: int(246)
! 352: --- testing: '123abc ' + '123 abc' ---
! 353: int(246)
! 354: --- testing: '123abc ' + '123abc ' ---
! 355: int(246)
! 356: --- testing: '123abc ' + '3.4a' ---
! 357: float(126.4)
! 358: --- testing: '123abc ' + 'a5.9' ---
! 359: int(123)
! 360: --- testing: '3.4a' + '0' ---
! 361: float(3.4)
! 362: --- testing: '3.4a' + '65' ---
! 363: float(68.4)
! 364: --- testing: '3.4a' + '-44' ---
! 365: float(-40.6)
! 366: --- testing: '3.4a' + '1.2' ---
! 367: float(4.6)
! 368: --- testing: '3.4a' + '-7.7' ---
! 369: float(-4.3)
! 370: --- testing: '3.4a' + 'abc' ---
! 371: float(3.4)
! 372: --- testing: '3.4a' + '123abc' ---
! 373: float(126.4)
! 374: --- testing: '3.4a' + '123e5' ---
! 375: float(12300003.4)
! 376: --- testing: '3.4a' + '123e5xyz' ---
! 377: float(12300003.4)
! 378: --- testing: '3.4a' + ' 123abc' ---
! 379: float(126.4)
! 380: --- testing: '3.4a' + '123 abc' ---
! 381: float(126.4)
! 382: --- testing: '3.4a' + '123abc ' ---
! 383: float(126.4)
! 384: --- testing: '3.4a' + '3.4a' ---
! 385: float(6.8)
! 386: --- testing: '3.4a' + 'a5.9' ---
! 387: float(3.4)
! 388: --- testing: 'a5.9' + '0' ---
! 389: int(0)
! 390: --- testing: 'a5.9' + '65' ---
! 391: int(65)
! 392: --- testing: 'a5.9' + '-44' ---
! 393: int(-44)
! 394: --- testing: 'a5.9' + '1.2' ---
! 395: float(1.2)
! 396: --- testing: 'a5.9' + '-7.7' ---
! 397: float(-7.7)
! 398: --- testing: 'a5.9' + 'abc' ---
! 399: int(0)
! 400: --- testing: 'a5.9' + '123abc' ---
! 401: int(123)
! 402: --- testing: 'a5.9' + '123e5' ---
! 403: float(12300000)
! 404: --- testing: 'a5.9' + '123e5xyz' ---
! 405: float(12300000)
! 406: --- testing: 'a5.9' + ' 123abc' ---
! 407: int(123)
! 408: --- testing: 'a5.9' + '123 abc' ---
! 409: int(123)
! 410: --- testing: 'a5.9' + '123abc ' ---
! 411: int(123)
! 412: --- testing: 'a5.9' + '3.4a' ---
! 413: float(3.4)
! 414: --- testing: 'a5.9' + 'a5.9' ---
! 415: int(0)
! 416: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>