vfprintf_basic7.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Test vfprintf() function : basic functionality - unsigned format
  3. --SKIPIF--
  4. <?php
  5. if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
  6. ?>
  7. --FILE--
  8. <?php
  9. /* Prototype : int vfprintf ( resource $handle , string $format , array $args )
  10. * Description: Write a formatted string to a stream
  11. * Source code: ext/standard/formatted_print.c
  12. */
  13. echo "*** Testing vfprintf() : basic functionality - using unsigned format ***\n";
  14. // Initialise all required variables
  15. $format = "format";
  16. $format1 = "%u";
  17. $format2 = "%u %u";
  18. $format3 = "%u %u %u";
  19. $arg1 = array(-1111);
  20. $arg2 = array(-1111,-1234567);
  21. $arg3 = array(-1111,-1234567,-2345432);
  22. /* creating dumping file */
  23. $data_file = dirname(__FILE__) . '/vfprintf_basic7.txt';
  24. if (!($fp = fopen($data_file, 'wt')))
  25. return;
  26. vfprintf($fp, $format1,$arg1);
  27. fprintf($fp, "\n");
  28. vfprintf($fp, $format2,$arg2);
  29. fprintf($fp, "\n");
  30. vfprintf($fp, $format3,$arg3);
  31. fprintf($fp, "\n");
  32. fclose($fp);
  33. print_r(file_get_contents($data_file));
  34. unlink($data_file);
  35. ?>
  36. ===DONE===
  37. --EXPECT--
  38. *** Testing vfprintf() : basic functionality - using unsigned format ***
  39. 4294966185
  40. 4294966185 4293732729
  41. 4294966185 4293732729 4292621864
  42. ===DONE===