]> granicus.if.org Git - php/commitdiff
MFH
authorAntony Dovgal <tony2001@php.net>
Thu, 19 Jul 2007 15:15:26 +0000 (15:15 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 19 Jul 2007 15:15:26 +0000 (15:15 +0000)
13 files changed:
ext/standard/tests/strings/fprintf_variation_001.phpt
ext/standard/tests/strings/fprintf_variation_002.phpt
ext/standard/tests/strings/fprintf_variation_003.phpt
ext/standard/tests/strings/fprintf_variation_003_64bit.phpt [new file with mode: 0644]
ext/standard/tests/strings/fprintf_variation_004.phpt
ext/standard/tests/strings/fprintf_variation_005.phpt
ext/standard/tests/strings/fprintf_variation_006.phpt
ext/standard/tests/strings/fprintf_variation_006_64bit.phpt [new file with mode: 0644]
ext/standard/tests/strings/fprintf_variation_007.phpt
ext/standard/tests/strings/fprintf_variation_007_64bit.phpt [new file with mode: 0644]
ext/standard/tests/strings/fprintf_variation_008.phpt
ext/standard/tests/strings/fprintf_variation_008_64bit.phpt [new file with mode: 0644]
ext/standard/tests/strings/fprintf_variation_009.phpt

index d4f12aa55d214e1395fd4d90366ab011fd1ccb32..f08d5cbee7945788255352d7b4b1500dc6f389ae 100644 (file)
@@ -3,7 +3,7 @@ Test fprintf() function (variation - 1)
 --SKIPIF--
 <?php
 $data_file = dirname(__FILE__) . '/dump.txt';
-if !($fp = fopen($data_file, 'w')) {
+if (!($fp = fopen($data_file, 'w'))) {
   die('skip File dump.txt could not be created');
 }
 ?>
index f5f0c49cc5f2e6072d1a3d9a0bc5e23b871956ef..fb3ab6c14a83740066473a609e5e60f1e953063d 100644 (file)
@@ -3,7 +3,7 @@ Test fprintf() function (variation - 2)
 --SKIPIF--
 <?php
 $data_file = dirname(__FILE__) . '/dump.txt';
-if !($fp = fopen($data_file, 'w')) {
+if (!($fp = fopen($data_file, 'w'))) {
   die('skip File dump.txt could not be created');
 }
 ?>
index b6aa565ac1dacde6e020fb524a4525e929ebe46b..c312c49d6724e499a7fc26fef08c1df54becf79f 100644 (file)
@@ -3,9 +3,10 @@ Test fprintf() function (variation - 3)
 --SKIPIF--
 <?php
 $data_file = dirname(__FILE__) . '/dump.txt';
-if !($fp = fopen($data_file, 'w')) {
+if (!($fp = fopen($data_file, 'w'))) {
   die('skip File dump.txt could not be created');
 }
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
 ?>
 --FILE--
 <?php
diff --git a/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt
new file mode 100644 (file)
index 0000000..448f528
--- /dev/null
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 3)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+  die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+   return;
+
+/* binary type variations */
+fprintf($fp, "\n*** Testing fprintf() with binary ***\n");
+foreach( $int_numbers as $bin_num ) {
+  fprintf( $fp, "\n");
+  fprintf( $fp, "%b", $bin_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() with binary ***
+
+0
+1
+1111111111111111111111111111111111111111111111111111111111111111
+10
+1111111111111111111111111111111111111111111111111111111111111110
+1011001000000100111010101
+1111111111111111111111111111111111111110100110111111011000101011
+10011010010
+Done
index 76e650dd3a9af43b84e08b03b35f243d5b92e520..5502b6d7c09d418004d89ec40bc7782abca3636e 100644 (file)
Binary files a/ext/standard/tests/strings/fprintf_variation_004.phpt and b/ext/standard/tests/strings/fprintf_variation_004.phpt differ
index d6650baca479259a25173ec6845db29f62bea675..75636ac98e2f653ebc4e0b9a0cd5665c714fd210 100644 (file)
@@ -3,7 +3,7 @@ Test fprintf() function (variation - 5)
 --SKIPIF--
 <?php
 $data_file = dirname(__FILE__) . '/dump.txt';
-if !($fp = fopen($data_file, 'w')) {
+if (!($fp = fopen($data_file, 'w'))) {
   die('skip File dump.txt could not be created');
 }
 ?>
index be4e7cbd21541781365f7a6f119affc862c1ebfc..d7a327857725885ebf05f72e1715309c5e6753d9 100644 (file)
@@ -3,9 +3,10 @@ Test fprintf() function (variation - 6)
 --SKIPIF--
 <?php
 $data_file = dirname(__FILE__) . '/dump.txt';
-if !($fp = fopen($data_file, 'w')) {
+if (!($fp = fopen($data_file, 'w'))) {
   die('skip File dump.txt could not be created');
 }
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
 ?>
 --FILE--
 <?php
diff --git a/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt
new file mode 100644 (file)
index 0000000..d68683e
--- /dev/null
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 6)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+  die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+   return;
+
+/* unsigned int type variation */
+fprintf($fp, "\n*** Testing fprintf() for unsigned integers ***\n");
+foreach( $int_numbers as $unsig_num ) {
+  fprintf( $fp, "\n");
+  fprintf( $fp, "%u", $unsig_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for unsigned integers ***
+
+0
+1
+18446744073709551615
+2
+18446744073709551614
+23333333
+18446744073686218283
+1234
+Done
index 21edd5734bb35c9e25214f82ba747f31b6b56b83..cb09084b73eda63274a8b537f28aa012fe8aefb0 100644 (file)
@@ -1,11 +1,12 @@
 --TEST--
-Test fprintf() function (variation - 7 )
+Test fprintf() function (variation - 7)
 --SKIPIF--
 <?php
 $data_file = dirname(__FILE__) . '/dump.txt';
-if !($fp = fopen($data_file, 'w')) {
+if (!($fp = fopen($data_file, 'w'))) {
   die('skip File dump.txt could not be created');
 }
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
 ?>
 --FILE--
 <?php
diff --git a/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt
new file mode 100644 (file)
index 0000000..c8481e9
--- /dev/null
@@ -0,0 +1,47 @@
+--TEST--
+Test fprintf() function (variation - 7)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+  die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+   return;
+
+/* octal type variations */
+fprintf($fp, "\n*** Testing fprintf() for octals ***\n");
+foreach( $int_numbers as $octal_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%o", $octal_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for octals ***
+
+0
+1
+1777777777777777777777
+2
+1777777777777777777776
+131004725
+1777777777777646773053
+2322
+Done
index de52e83d420128378daf79408ba6fcff44064544..f91e7a1a99b19833dbfac9ba990bd305f27f0808 100644 (file)
@@ -3,9 +3,10 @@ Test fprintf() function (variation - 8)
 --SKIPIF--
 <?php
 $data_file = dirname(__FILE__) . '/dump.txt';
-if !($fp = fopen($data_file, 'w')) {
+if (!($fp = fopen($data_file, 'w'))) {
   die('skip File dump.txt could not be created');
 }
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
 ?>
 --FILE--
 <?php
diff --git a/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt
new file mode 100644 (file)
index 0000000..f619510
--- /dev/null
@@ -0,0 +1,48 @@
+--TEST--
+Test fprintf() function (variation - 8)
+--SKIPIF--
+<?php
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'w'))) {
+  die('skip File dump.txt could not be created');
+}
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
+$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
+
+/* creating dumping file */
+$data_file = dirname(__FILE__) . '/dump.txt';
+if (!($fp = fopen($data_file, 'wt')))
+   return;
+
+/* hexadecimal type variations */
+fprintf($fp, "\n*** Testing fprintf() for hexadecimals ***\n");
+foreach( $int_numbers as $hexa_num ) {
+ fprintf( $fp, "\n");
+ fprintf( $fp, "%x", $hexa_num );
+}
+
+fclose($fp);
+
+print_r(file_get_contents($data_file));
+echo "\nDone";
+
+unlink($data_file);
+
+?>
+--EXPECTF--
+*** Testing fprintf() for hexadecimals ***
+
+0
+1
+ffffffffffffffff
+2
+fffffffffffffffe
+16409d5
+fffffffffe9bf62b
+4d2
+Done
index 5a108ad2d36f5ffc923ca61459b392af25f90212..40f36bb5f0fc86065fcdbe1eab32b55b2176cee3 100644 (file)
@@ -3,7 +3,7 @@ Test fprintf() function (variation - 9)
 --SKIPIF--
 <?php
 $data_file = dirname(__FILE__) . '/dump.txt';
-if !($fp = fopen($data_file, 'w')) {
+if (!($fp = fopen($data_file, 'w'))) {
   die('skip File dump.txt could not be created');
 }
 ?>