Annotation of embedaddon/php/ext/standard/tests/strings/sprintf_variation41_64bit.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test sprintf() function : usage variations - unsigned formats with float values
! 3: --SKIPIF--
! 4: <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
! 5: --FILE--
! 6: <?php
! 7: /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
! 8: * Description: Return a formatted string
! 9: * Source code: ext/standard/formatted_print.c
! 10: */
! 11:
! 12: echo "*** Testing sprintf() : unsigned formats with float values ***\n";
! 13:
! 14: // array of float values
! 15: $float_values = array(
! 16: 2147483647,
! 17: 0x800000001, // float value, beyond max positive int
! 18: 020000000001, // float value, beyond max positive int
! 19: 0.0,
! 20: -0.1,
! 21: 1.0,
! 22: +1e5,
! 23: +5e+5,
! 24: +0e-5,
! 25: -1e5,
! 26: -1e+5,
! 27: -1e-2,
! 28: 1e5,
! 29: 1E8,
! 30: -1E9,
! 31: 10.0000000000000000005,
! 32: 10.5e+5
! 33: );
! 34:
! 35: // array of unsigned formats
! 36: $unsigned_formats = array(
! 37: "%u", "%hu", "%lu",
! 38: "%Lu", " %u", "%u ",
! 39: "\t%u", "\n%u", "%4u",
! 40: "%30u", "%[0-9]", "%*u"
! 41: );
! 42:
! 43: $count = 1;
! 44: foreach($float_values as $float_value) {
! 45: echo "\n-- Iteration $count --\n";
! 46:
! 47: foreach($unsigned_formats as $format) {
! 48: var_dump( sprintf($format, $float_value) );
! 49: }
! 50: $count++;
! 51: };
! 52:
! 53: echo "Done";
! 54: ?>
! 55: --EXPECTF--
! 56: *** Testing sprintf() : unsigned formats with float values ***
! 57:
! 58: -- Iteration 1 --
! 59: string(10) "2147483647"
! 60: string(1) "u"
! 61: string(10) "2147483647"
! 62: string(1) "u"
! 63: string(11) " 2147483647"
! 64: string(11) "2147483647 "
! 65: string(11) " 2147483647"
! 66: string(11) "
! 67: 2147483647"
! 68: string(10) "2147483647"
! 69: string(30) " 2147483647"
! 70: string(4) "0-9]"
! 71: string(1) "u"
! 72:
! 73: -- Iteration 2 --
! 74: string(11) "34359738369"
! 75: string(1) "u"
! 76: string(11) "34359738369"
! 77: string(1) "u"
! 78: string(12) " 34359738369"
! 79: string(12) "34359738369 "
! 80: string(12) " 34359738369"
! 81: string(12) "
! 82: 34359738369"
! 83: string(11) "34359738369"
! 84: string(30) " 34359738369"
! 85: string(4) "0-9]"
! 86: string(1) "u"
! 87:
! 88: -- Iteration 3 --
! 89: string(10) "2147483649"
! 90: string(1) "u"
! 91: string(10) "2147483649"
! 92: string(1) "u"
! 93: string(11) " 2147483649"
! 94: string(11) "2147483649 "
! 95: string(11) " 2147483649"
! 96: string(11) "
! 97: 2147483649"
! 98: string(10) "2147483649"
! 99: string(30) " 2147483649"
! 100: string(4) "0-9]"
! 101: string(1) "u"
! 102:
! 103: -- Iteration 4 --
! 104: string(1) "0"
! 105: string(1) "u"
! 106: string(1) "0"
! 107: string(1) "u"
! 108: string(2) " 0"
! 109: string(2) "0 "
! 110: string(2) " 0"
! 111: string(2) "
! 112: 0"
! 113: string(4) " 0"
! 114: string(30) " 0"
! 115: string(4) "0-9]"
! 116: string(1) "u"
! 117:
! 118: -- Iteration 5 --
! 119: string(1) "0"
! 120: string(1) "u"
! 121: string(1) "0"
! 122: string(1) "u"
! 123: string(2) " 0"
! 124: string(2) "0 "
! 125: string(2) " 0"
! 126: string(2) "
! 127: 0"
! 128: string(4) " 0"
! 129: string(30) " 0"
! 130: string(4) "0-9]"
! 131: string(1) "u"
! 132:
! 133: -- Iteration 6 --
! 134: string(1) "1"
! 135: string(1) "u"
! 136: string(1) "1"
! 137: string(1) "u"
! 138: string(2) " 1"
! 139: string(2) "1 "
! 140: string(2) " 1"
! 141: string(2) "
! 142: 1"
! 143: string(4) " 1"
! 144: string(30) " 1"
! 145: string(4) "0-9]"
! 146: string(1) "u"
! 147:
! 148: -- Iteration 7 --
! 149: string(6) "100000"
! 150: string(1) "u"
! 151: string(6) "100000"
! 152: string(1) "u"
! 153: string(7) " 100000"
! 154: string(7) "100000 "
! 155: string(7) " 100000"
! 156: string(7) "
! 157: 100000"
! 158: string(6) "100000"
! 159: string(30) " 100000"
! 160: string(4) "0-9]"
! 161: string(1) "u"
! 162:
! 163: -- Iteration 8 --
! 164: string(6) "500000"
! 165: string(1) "u"
! 166: string(6) "500000"
! 167: string(1) "u"
! 168: string(7) " 500000"
! 169: string(7) "500000 "
! 170: string(7) " 500000"
! 171: string(7) "
! 172: 500000"
! 173: string(6) "500000"
! 174: string(30) " 500000"
! 175: string(4) "0-9]"
! 176: string(1) "u"
! 177:
! 178: -- Iteration 9 --
! 179: string(1) "0"
! 180: string(1) "u"
! 181: string(1) "0"
! 182: string(1) "u"
! 183: string(2) " 0"
! 184: string(2) "0 "
! 185: string(2) " 0"
! 186: string(2) "
! 187: 0"
! 188: string(4) " 0"
! 189: string(30) " 0"
! 190: string(4) "0-9]"
! 191: string(1) "u"
! 192:
! 193: -- Iteration 10 --
! 194: string(20) "18446744073709451616"
! 195: string(1) "u"
! 196: string(20) "18446744073709451616"
! 197: string(1) "u"
! 198: string(21) " 18446744073709451616"
! 199: string(21) "18446744073709451616 "
! 200: string(21) " 18446744073709451616"
! 201: string(21) "
! 202: 18446744073709451616"
! 203: string(20) "18446744073709451616"
! 204: string(30) " 18446744073709451616"
! 205: string(4) "0-9]"
! 206: string(1) "u"
! 207:
! 208: -- Iteration 11 --
! 209: string(20) "18446744073709451616"
! 210: string(1) "u"
! 211: string(20) "18446744073709451616"
! 212: string(1) "u"
! 213: string(21) " 18446744073709451616"
! 214: string(21) "18446744073709451616 "
! 215: string(21) " 18446744073709451616"
! 216: string(21) "
! 217: 18446744073709451616"
! 218: string(20) "18446744073709451616"
! 219: string(30) " 18446744073709451616"
! 220: string(4) "0-9]"
! 221: string(1) "u"
! 222:
! 223: -- Iteration 12 --
! 224: string(1) "0"
! 225: string(1) "u"
! 226: string(1) "0"
! 227: string(1) "u"
! 228: string(2) " 0"
! 229: string(2) "0 "
! 230: string(2) " 0"
! 231: string(2) "
! 232: 0"
! 233: string(4) " 0"
! 234: string(30) " 0"
! 235: string(4) "0-9]"
! 236: string(1) "u"
! 237:
! 238: -- Iteration 13 --
! 239: string(6) "100000"
! 240: string(1) "u"
! 241: string(6) "100000"
! 242: string(1) "u"
! 243: string(7) " 100000"
! 244: string(7) "100000 "
! 245: string(7) " 100000"
! 246: string(7) "
! 247: 100000"
! 248: string(6) "100000"
! 249: string(30) " 100000"
! 250: string(4) "0-9]"
! 251: string(1) "u"
! 252:
! 253: -- Iteration 14 --
! 254: string(9) "100000000"
! 255: string(1) "u"
! 256: string(9) "100000000"
! 257: string(1) "u"
! 258: string(10) " 100000000"
! 259: string(10) "100000000 "
! 260: string(10) " 100000000"
! 261: string(10) "
! 262: 100000000"
! 263: string(9) "100000000"
! 264: string(30) " 100000000"
! 265: string(4) "0-9]"
! 266: string(1) "u"
! 267:
! 268: -- Iteration 15 --
! 269: string(20) "18446744072709551616"
! 270: string(1) "u"
! 271: string(20) "18446744072709551616"
! 272: string(1) "u"
! 273: string(21) " 18446744072709551616"
! 274: string(21) "18446744072709551616 "
! 275: string(21) " 18446744072709551616"
! 276: string(21) "
! 277: 18446744072709551616"
! 278: string(20) "18446744072709551616"
! 279: string(30) " 18446744072709551616"
! 280: string(4) "0-9]"
! 281: string(1) "u"
! 282:
! 283: -- Iteration 16 --
! 284: string(2) "10"
! 285: string(1) "u"
! 286: string(2) "10"
! 287: string(1) "u"
! 288: string(3) " 10"
! 289: string(3) "10 "
! 290: string(3) " 10"
! 291: string(3) "
! 292: 10"
! 293: string(4) " 10"
! 294: string(30) " 10"
! 295: string(4) "0-9]"
! 296: string(1) "u"
! 297:
! 298: -- Iteration 17 --
! 299: string(7) "1050000"
! 300: string(1) "u"
! 301: string(7) "1050000"
! 302: string(1) "u"
! 303: string(8) " 1050000"
! 304: string(8) "1050000 "
! 305: string(8) " 1050000"
! 306: string(8) "
! 307: 1050000"
! 308: string(7) "1050000"
! 309: string(30) " 1050000"
! 310: string(4) "0-9]"
! 311: string(1) "u"
! 312: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>