Annotation of embedaddon/php/ext/standard/tests/strings/fprintf_variation_005.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test fprintf() function (variation - 5)
                      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: ?>
                     10: --FILE--
                     11: <?php
                     12: 
                     13: $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
                     14: 
                     15: /* creating dumping file */
                     16: $data_file = dirname(__FILE__) . '/dump.txt';
                     17: if (!($fp = fopen($data_file, 'wt')))
                     18:    return;
                     19: 
                     20: /* %e type variations */
                     21: fprintf($fp, "\n*** Testing fprintf() for scientific type ***\n");
                     22: foreach( $int_numbers as $num ) {
                     23:   fprintf( $fp, "\n");
                     24:   fprintf( $fp, "%e", $num );
                     25: }
                     26: 
                     27: fclose($fp);
                     28: 
                     29: print_r(file_get_contents($data_file));
                     30: echo "\nDone";
                     31: 
                     32: unlink($data_file);
                     33: 
                     34: ?>
                     35: --EXPECTF--
                     36: *** Testing fprintf() for scientific type ***
                     37: 
                     38: 0.000000e+0
                     39: 1.000000e+0
                     40: -1.000000e+0
                     41: 2.700000e+0
                     42: -2.700000e+0
                     43: 2.333333e+7
                     44: -2.333333e+7
                     45: 1.234000e+3
                     46: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>