Annotation of embedaddon/php/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test fprintf() function (variation - 8)
3: --SKIPIF--
4: <?php
5: $data_file = dirname(__FILE__) . '/dump.txt';
6: if (!($fp = fopen($data_file, 'w'))) {
7: die('skip File dump.txt could not be created');
8: }
9: if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
10: ?>
11: --FILE--
12: <?php
13:
14: $int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
15: $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
16:
17: /* creating dumping file */
18: $data_file = dirname(__FILE__) . '/dump.txt';
19: if (!($fp = fopen($data_file, 'wt')))
20: return;
21:
22: /* hexadecimal type variations */
23: fprintf($fp, "\n*** Testing fprintf() for hexadecimals ***\n");
24: foreach( $int_numbers as $hexa_num ) {
25: fprintf( $fp, "\n");
26: fprintf( $fp, "%x", $hexa_num );
27: }
28:
29: fclose($fp);
30:
31: print_r(file_get_contents($data_file));
32: echo "\nDone";
33:
34: unlink($data_file);
35:
36: ?>
37: --EXPECTF--
38: *** Testing fprintf() for hexadecimals ***
39:
40: 0
41: 1
42: ffffffffffffffff
43: 2
44: fffffffffffffffe
45: 16409d5
46: fffffffffe9bf62b
47: 4d2
48: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>