1
0
mirror of https://github.com/php/php-src.git synced 2026-04-14 19:41:05 +02:00

New tests for file system handling functions

This commit is contained in:
Raghubansh Kumar
2007-06-13 22:46:37 +00:00
parent 71bc2b7f8f
commit d827201d8c
11 changed files with 5947 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
--TEST--
Test copy() function: basic functionality
--FILE--
<?php
/* Prototype: bool copy ( string $source, string $dest );
* Description: Makes a copy of the file source to dest.
* Returns TRUE on success or FALSE on failure.
*/
echo "*** Testing copy() function: to copy file from source to destination --\n";
var_dump( file_exists(__FILE__) );
/* copying the file */
$file_path = dirname(__FILE__);
$file_name1 = $file_path."/copy_basic1.tmp";
$file_name2 = $file_path."/copy_basic2.tmp";
var_dump( copy(__FILE__, $file_name1) );
var_dump( copy($file_name1, $file_name2) );
echo "-- Checking whether the copy of file exists --\n";
var_dump( file_exists($file_name1) );
var_dump( file_exists($file_name2) );
echo "-- Checking filepermissions of file and its copies --\n";
printf( "%o", fileperms(__FILE__) );
echo "\n";
printf( "%o", fileperms($file_name1) );
echo "\n";
printf( "%o", fileperms($file_name2) );
echo "\n";
echo "*** Done ***\n";
?>
--CLEAN--
<?php
$file_path = dirname(__FILE__);
$file_name1 = $file_path."/copy_basic1.tmp";
$file_name2 = $file_path."/copy_basic2.tmp";
unlink($file_name1);
unlink($file_name2);
?>
--EXPECTF--
*** Testing copy() function: to copy file from source to destination --
bool(true)
bool(true)
bool(true)
-- Checking whether the copy of file exists --
bool(true)
bool(true)
-- Checking filepermissions of file and its copies --
%d
%d
%d
*** Done ***
--UEXPECTF--
*** Testing copy() function: to copy file from source to destination --
bool(true)
bool(true)
bool(true)
-- Checking whether the copy of file exists --
bool(true)
bool(true)
-- Checking filepermissions of file and its copies --
%d
%d
%d
*** Done ***

View File

@@ -0,0 +1,54 @@
--TEST--
Test copy() function: error conditions
--FILE--
<?php
/* Prototype: bool copy ( string $source, string $dest );
* Description: Makes a copy of the file source to dest.
* Returns TRUE on success or FALSE on failure.
*/
echo "*** Testing copy() function: error conditions --\n";
/* Invalid args */
var_dump( copy("/no/file", "file") );
/* No.of args less than expected */
var_dump( copy() );
var_dump( copy(__FILE__) );
/* No.of args less than expected */
var_dump( copy(__FILE__, "file1", "file1") );
echo "*** Done ***\n";
?>
--EXPECTF--
*** Testing copy() function: error conditions --
Warning: copy(/no/file): failed to open stream: No such file or directory in %s on line %d
bool(false)
Warning: copy() expects at least 2 parameters, 0 given in %s on line %d
NULL
Warning: copy() expects at least 2 parameters, 1 given in %s on line %d
NULL
Warning: copy() expects parameter 3 to be resource, string given in %s on line %d
NULL
*** Done ***
--UEXPECTF--
*** Testing copy() function: error conditions --
Warning: copy(/no/file): failed to open stream: No such file or directory in %s on line %d
bool(false)
Warning: copy() expects at least 2 parameters, 0 given in %s on line %d
NULL
Warning: copy() expects at least 2 parameters, 1 given in %s on line %d
NULL
Warning: copy() expects parameter 3 to be resource, Unicode string given in %s on line %d
NULL
*** Done ***

View File

@@ -0,0 +1,239 @@
--TEST--
Test file_get_contents() and file_put_contents() functions : usage variations
--FILE--
<?php
/* Prototype: string file_get_contents( string $filename[, bool $use_include_path[,
* resource $context[, int $offset[, int $maxlen]]]] )
* Description: Reads entire file into a string
*/
/* Prototype: int file_put_contents( string $filename, mixed $data[, int $flags[, resource $context]] )
* Description: Write a string to a file
*/
$file_path = dirname(__FILE__);
include($file_path."/file.inc");
echo "*** Testing with variations in the arguments values ***\n";
$buffer_types = array("text", "numeric", "text_with_new_line", "alphanumeric");
foreach( $buffer_types as $type) {
fill_buffer($buffer, $type, 100);
file_put_contents( $file_path."/file_get_contents.tmp", $buffer, FILE_BINARY );
var_dump( file_get_contents($file_path."/file_get_contents.tmp", 0) );
var_dump( file_get_contents($file_path."/file_get_contents.tmp", 1) );
var_dump( file_get_contents($file_path."/file_get_contents.tmp", 0, NULL, 5) );
var_dump( file_get_contents($file_path."/file_get_contents.tmp", 1, NULL, 5) );
var_dump( file_get_contents($file_path."/file_get_contents.tmp", 0, NULL, 5, 20) );
var_dump( file_get_contents($file_path."/file_get_contents.tmp", 1, NULL, 5, 20) );
}
echo "*** Testing with variation in use_include_path argument ***\n";
$dir = "file_get_contents";
mkdir($file_path."/".$dir);
$filename = $file_path."/".$dir."/"."file_get_contents1.tmp";
ini_set( 'include_path',$file_path."/".$dir );
$data_array = array( 1, " Data1 in an array", 2, " Data2 in an array" );
fill_buffer( $buffer, "text", 100);
file_put_contents( $filename, $buffer );
fill_buffer( $buffer, "numeric", 100);
file_put_contents( $filename, $buffer, FILE_APPEND, NULL );
file_put_contents( $filename, $data_array, FILE_APPEND, NULL );
var_dump( file_get_contents($filename, 0) );
var_dump( file_get_contents($filename, 1) );
var_dump( file_get_contents($filename, 0, NULL, 5) );
var_dump( file_get_contents($filename, 1, NULL, 5) );
var_dump( file_get_contents($filename, 0, NULL, 5, 20) );
var_dump( file_get_contents($filename, 1, NULL, 5, 20) );
echo "--- Done ---";
?>
--CLEAN--
<?php
//Deleting the temporary files and directory used in the testcase
$file_path = dirname(__FILE__);
unlink($file_path."/file_get_contents.tmp");
unlink($file_path."/file_get_contents/file_get_contents1.tmp");
rmdir($file_path."/file_get_contents");
?>
--EXPECTF--
*** Testing with variations in the arguments values ***
string(100) "text text text text text text text text text text text text text text text text text text text text "
string(100) "text text text text text text text text text text text text text text text text text text text text "
string(95) "text text text text text text text text text text text text text text text text text text text "
string(95) "text text text text text text text text text text text text text text text text text text text "
string(20) "text text text text "
string(20) "text text text text "
string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
string(20) "22222222222222222222"
string(20) "22222222222222222222"
string(100) "line
line of text
line
line of text
line
line of text
line
line of text
line
line of text
line
line "
string(100) "line
line of text
line
line of text
line
line of text
line
line of text
line
line of text
line
line "
string(95) "line of text
line
line of text
line
line of text
line
line of text
line
line of text
line
line "
string(95) "line of text
line
line of text
line
line of text
line
line of text
line
line of text
line
line "
string(20) "line of text
line
li"
string(20) "line of text
line
li"
string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
string(20) "ab12 ab12 ab12 ab12 "
string(20) "ab12 ab12 ab12 ab12 "
*** Testing with variation in use_include_path argument ***
string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
string(20) "text text text text "
string(20) "text text text text "
--- Done ---
--UEXPECTF--
*** Testing with variations in the arguments values ***
Notice: file_put_contents(): 100 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
string(100) "text text text text text text text text text text text text text text text text text text text text "
string(100) "text text text text text text text text text text text text text text text text text text text text "
string(95) "text text text text text text text text text text text text text text text text text text text "
string(95) "text text text text text text text text text text text text text text text text text text text "
string(20) "text text text text "
string(20) "text text text text "
Notice: file_put_contents(): 100 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
string(20) "22222222222222222222"
string(20) "22222222222222222222"
Notice: file_put_contents(): 100 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
string(100) "line
line of text
line
line of text
line
line of text
line
line of text
line
line of text
line
line "
string(100) "line
line of text
line
line of text
line
line of text
line
line of text
line
line of text
line
line "
string(95) "line of text
line
line of text
line
line of text
line
line of text
line
line of text
line
line "
string(95) "line of text
line
line of text
line
line of text
line
line of text
line
line of text
line
line "
string(20) "line of text
line
li"
string(20) "line of text
line
li"
Notice: file_put_contents(): 100 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
string(20) "ab12 ab12 ab12 ab12 "
string(20) "ab12 ab12 ab12 ab12 "
*** Testing with variation in use_include_path argument ***
Notice: file_put_contents(): 100 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
Notice: file_put_contents(): 19 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
Notice: file_put_contents(): 19 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
string(20) "text text text text "
string(20) "text text text text "
--- Done ---

View File

@@ -0,0 +1,106 @@
--TEST--
Test filegroup() function: basic functionality
--SKIPIF--
<?php
if (!function_exists("posix_getgrgid")) {
die("skip no posix_getgrgid");
}
?>
--FILE--
<?php
/* Prototype: int filegroup ( string $filename )
* Description: Returns the group ID of the file, or FALSE in case of an error.
*/
echo "*** Testing filegroup(): basic functionality ***\n";
echo "-- Testing with the file or directory created by owner --\n";
$file_path = dirname(__FILE__);
var_dump( posix_getgrgid( filegroup(__FILE__) ) );
var_dump( filegroup(".") );
var_dump( filegroup("./..") );
/* Newly created files and dirs */
$file_name = $file_path."/filegroup_basic.tmp";
$file_handle = fopen($file_name, "w");
$string = "Hello, world\n1234\n123Hello";
fwrite($file_handle, $string);
var_dump( filegroup($file_name) );
fclose($file_handle);
$dir_name = $file_path."/filegroup_basic";
mkdir($dir_name);
var_dump( filegroup($dir_name) );
echo "\n-- Testing with the standard file or directory --\n";
var_dump( filegroup("/etc/passwd") );
var_dump( filegroup("/etc") );
var_dump( filegroup("/") );
echo "\n*** Done ***\n";
?>
--CLEAN--
<?php
$file_path = dirname(__FILE__);
$file_name = $file_path."/filegroup_basic.tmp";
$dir_name = $file_path."/filegroup_basic";
unlink($file_name);
rmdir($dir_name);
?>
--EXPECTF--
*** Testing filegroup(): basic functionality ***
-- Testing with the file or directory created by owner --
array(4) {
["name"]=>
string(%d) "%s"
["passwd"]=>
string(1) "x"
["members"]=>
array(0) {
}
["gid"]=>
int(%d)
}
int(%d)
int(%d)
int(%d)
int(%d)
-- Testing with the standard file or directory --
int(0)
int(0)
int(0)
*** Done ***
--UEXPECTF--
*** Testing filegroup(): basic functionality ***
-- Testing with the file or directory created by owner --
array(4) {
["name"]=>
string(%d) "%s"
["passwd"]=>
string(1) "x"
["members"]=>
array(0) {
}
["gid"]=>
int(%d)
}
int(%d)
int(%d)
Notice: fwrite(): 26 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
int(%d)
int(%d)
-- Testing with the standard file or directory --
int(0)
int(0)
int(0)
*** Done ***

View File

@@ -0,0 +1,63 @@
--TEST--
Test filegroup() function: error conditions
--FILE--
<?php
/* Prototype: int filegroup ( string $filename )
* Description: Returns the group ID of the file, or FALSE in case of an error.
*/
echo "*** Testing filegroup(): error conditions ***\n";
/* Non-existing file or dir */
var_dump( filegroup("/no/such/file/dir") );
/* Invalid arguments */
var_dump( filegroup("string") );
var_dump( filegroup(100) );
/* Invalid no.of arguments */
var_dump( filegroup() ); // args < expected
var_dump( filegroup("/no/such/file", "root") ); // args > expected
echo "\n*** Done ***\n";
?>
--EXPECTF--
*** Testing filegroup(): error conditions ***
Warning: filegroup(): stat failed for /no/such/file/dir in %s on line %d
bool(false)
Warning: filegroup(): stat failed for string in %s on line %d
bool(false)
Warning: filegroup(): stat failed for 100 in %s on line %d
bool(false)
Warning: filegroup() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: filegroup() expects exactly 1 parameter, 2 given in %s on line %d
NULL
*** Done ***
--UEXPECTF--
*** Testing filegroup(): error conditions ***
Warning: filegroup(): stat failed for /no/such/file/dir in %s on line %d
bool(false)
Warning: filegroup(): stat failed for string in %s on line %d
bool(false)
Warning: filegroup(): stat failed for 100 in %s on line %d
bool(false)
Warning: filegroup() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: filegroup() expects exactly 1 parameter, 2 given in %s on line %d
NULL
*** Done ***

View File

@@ -0,0 +1,114 @@
--TEST--
Test fileowner() function: basic functionality
--SKIPIF--
<?php
if (!function_exists("posix_getpwuid")) {
die("skip no posix_getpwuid");
}
--FILE--
<?php
/* Prototype: int fileowner ( string $filename )
* Description: Returns the user ID of the owner of the file, or
* FALSE in case of an error.
*/
echo "*** Testing fileowner(): basic functionality ***\n";
echo "-- Testing with the file or directory created by owner --\n";
var_dump( posix_getpwuid ( fileowner(__FILE__) ) );
var_dump( fileowner(".") );
var_dump( fileowner("./..") );
/* Newly created files and dirs */
$file_path = dirname(__FILE__);
$file_name = $file_path."/fileowner_basic.tmp";
$file_handle = fopen($file_name, "w");
$string = "Hello, world\n1234\n123Hello";
fwrite($file_handle, $string);
var_dump( fileowner($file_name) );
fclose($file_handle);
$dir_name = $file_path."/fileowner_basic";
mkdir($dir_name);
var_dump( fileowner($dir_name) );
echo "\n-- Testing with the standard file or directory --\n";
var_dump( fileowner("/etc/passwd") );
var_dump( fileowner("/etc") );
var_dump( fileowner("/") );
echo "\n*** Done ***\n";
?>
--CLEAN--
<?php
$file_path = dirname(__FILE__);
$file_name = $file_path."/fileowner_basic.tmp";
$dir_name = $file_path."/fileowner_basic";
unlink($file_name);
rmdir($dir_name);
?>
--EXPECTF--
*** Testing fileowner(): basic functionality ***
-- Testing with the file or directory created by owner --
array(7) {
["name"]=>
string(%d) %s
["passwd"]=>
string(1) "x"
["uid"]=>
int(%d)
["gid"]=>
int(%d)
["gecos"]=>
string(%d) %s
["dir"]=>
string(%d) %s
["shell"]=>
string(%d) %s
}
int(%d)
int(%d)
int(%d)
int(%d)
-- Testing with the standard file or directory --
int(0)
int(0)
int(0)
*** Done ***
--UEXPECTF--
*** Testing fileowner(): basic functionality ***
-- Testing with the file or directory created by owner --
array(7) {
["name"]=>
string(%d) %s
["passwd"]=>
string(1) "x"
["uid"]=>
int(%d)
["gid"]=>
int(%d)
["gecos"]=>
string(%d) %s
["dir"]=>
string(%d) %s
["shell"]=>
string(%d) %s
}
int(%d)
int(%d)
Notice: fwrite(): 26 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
int(%d)
int(%d)
-- Testing with the standard file or directory --
int(0)
int(0)
int(0)
*** Done ***

View File

@@ -0,0 +1,63 @@
--TEST--
Test of fileowner() function: error conditions
--FILE--
<?php
/* Prototype: int fileowner ( string $filename )
* Description: Returns the user ID of the owner of the file, or
* FALSE in case of an error.
*/
echo "*** Testing fileowner(): error conditions ***\n";
/* Non-existing file or dir */
var_dump( fileowner("/no/such/file/dir") );
/* Invalid arguments */
var_dump( fileowner("string") );
var_dump( fileowner(100) );
/* Invalid no.of arguments */
var_dump( fileowner() ); // args < expected
var_dump( fileowner("/no/such/file", "root") ); // args > expected
echo "\n*** Done ***\n";
?>
--EXPECTF--
*** Testing fileowner(): error conditions ***
Warning: fileowner(): stat failed for /no/such/file/dir in %s on line %d
bool(false)
Warning: fileowner(): stat failed for string in %s on line %d
bool(false)
Warning: fileowner(): stat failed for 100 in %s on line %d
bool(false)
Warning: fileowner() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: fileowner() expects exactly 1 parameter, 2 given in %s on line %d
NULL
*** Done ***
--UEXPECTF--
*** Testing fileowner(): error conditions ***
Warning: fileowner(): stat failed for /no/such/file/dir in %s on line %d
bool(false)
Warning: fileowner(): stat failed for string in %s on line %d
bool(false)
Warning: fileowner(): stat failed for 100 in %s on line %d
bool(false)
Warning: fileowner() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: fileowner() expects exactly 1 parameter, 2 given in %s on line %d
NULL
*** Done ***

View File

@@ -0,0 +1,771 @@
--TEST--
Test fwrite() function : basic functionality
--SKIPIF--
<?php
if( substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip...Valid for Windows only');
}
?>
--FILE--
<?php
/*
Prototype: int fwrite ( resource $handle,string string, [, int $length] );
Description: fwrite() writes the contents of string to the file stream pointed to by handle.
If the length arquement is given,writing will stop after length bytes have been
written or the end of string reached, whichever comes first.
fwrite() returns the number of bytes written or FALSE on error
*/
// include the file.inc for Function: function delete_file($filename)
include ("file.inc");
echo "*** Testing fwrite() basic operations ***\n";
/*
test fwrite with file opened in mode : w,wb,wt,w+,w+b,w+t
File containing data of type, numeric, text, text_with_new_line, alphanumeric
*/
$file_modes = array( "w", "wb", "wt", "w+", "w+b", "w+t");
$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
foreach($file_content_types as $file_content_type) {
echo "\n-- Testing fwrite() with file having data of type ". $file_content_type ." --\n";
$filename = dirname(__FILE__)."/fwrite_basic-win32.tmp"; // this is name of the file
for($inner_loop_counter = 0;
$inner_loop_counter < count($file_modes);
$inner_loop_counter++) {
echo "-- File opened in mode : " . $file_modes[$inner_loop_counter]. " --\n";
/* open the file using $files_modes and perform fwrite() on it */
$file_handle = fopen($filename, $file_modes[$inner_loop_counter]);
if (!$file_handle) {
echo "Error: failed to fopen() file: $filename!";
exit();
}
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 1024); //get the data of size 1024
/* Write the data in to the file, verify the write by checking file pointer position,
eof position, and data. */
// writing 100 bytes
var_dump( ftell($file_handle) ); // Expecting 0
var_dump( fwrite($file_handle, (binary)$data_to_be_written, 100)); //int(100)
var_dump( feof($file_handle) ); // expected : false
var_dump( ftell($file_handle) ); //expected: 100
// trying to write more than the available data, available 1024 bytes but trying 2048
var_dump( fwrite($file_handle, (binary)$data_to_be_written, 2048)); //int(1024)
var_dump( feof($file_handle) ); // expected : false
var_dump( ftell($file_handle) ); // expected: 1124
// fwrite() without length parameter
var_dump( fwrite($file_handle, (binary)$data_to_be_written)); //int(1024)
var_dump( ftell($file_handle) ); // expected: 2148
var_dump( feof($file_handle) ); // expected: false
// close the file, get the size and content of the file.
var_dump( fclose($file_handle) ); //expected : true
clearstatcache();//clears file status cache
var_dump( filesize($filename) ); // expected: 2148
var_dump(md5(file_get_contents($filename))); // hash the output
} // end of inner for loop
// delete the file created
delete_file($filename);
} // end of outer foreach loop
echo "Done\n";
?>
--EXPECTF--
*** Testing fwrite() basic operations ***
-- Testing fwrite() with file having data of type numeric --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- Testing fwrite() with file having data of type text --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- Testing fwrite() with file having data of type text_with_new_line --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2385)
string(32) "62b09dac6d598bf54de7b02e0e68e5c7"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2385)
string(32) "62b09dac6d598bf54de7b02e0e68e5c7"
-- Testing fwrite() with file having data of type alphanumeric --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
Done
--UEXPECTF--
*** Testing fwrite() basic operations ***
-- Testing fwrite() with file having data of type numeric --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- Testing fwrite() with file having data of type text --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- Testing fwrite() with file having data of type text_with_new_line --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2385)
unicode(32) "62b09dac6d598bf54de7b02e0e68e5c7"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2385)
unicode(32) "62b09dac6d598bf54de7b02e0e68e5c7"
-- Testing fwrite() with file having data of type alphanumeric --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
Done

View File

@@ -0,0 +1,771 @@
--TEST--
Test fwrite() function : basic functionality
--SKIPIF--
<?php
if( substr(PHP_OS, 0, 3) == 'WIN' ) {
die('skip...Not valid for Windows');
}
?>
--FILE--
<?php
/*
Prototype: int fwrite ( resource $handle,string string, [, int $length] );
Description: fwrite() writes the contents of string to the file stream pointed to by handle.
If the length arquement is given,writing will stop after length bytes have been
written or the end of string reached, whichever comes first.
fwrite() returns the number of bytes written or FALSE on error
*/
// include the file.inc for Function: function delete_file($filename)
include ("file.inc");
echo "*** Testing fwrite() basic operations ***\n";
/*
test fwrite with file opened in mode : w,wb,wt,w+,w+b,w+t
File containing data of type, numeric, text, text_with_new_line, alphanumeric
*/
$file_modes = array( "w", "wb", "wt", "w+", "w+b", "w+t");
$file_content_types = array("numeric","text","text_with_new_line","alphanumeric");
foreach($file_content_types as $file_content_type) {
echo "\n-- Testing fwrite() with file having data of type ". $file_content_type ." --\n";
$filename = dirname(__FILE__)."/fwrite_basic.tmp"; // this is name of the file
for($inner_loop_counter = 0;
$inner_loop_counter < count($file_modes);
$inner_loop_counter++) {
echo "-- File opened in mode : " . $file_modes[$inner_loop_counter]. " --\n";
/* open the file using $files_modes and perform fwrite() on it */
$file_handle = fopen($filename, $file_modes[$inner_loop_counter]);
if (!$file_handle) {
echo "Error: failed to fopen() file: $filename!";
exit();
}
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 1024); //get the data of size 1024
/* Write the data in to the file, verify the write by checking file pointer position,
eof position, and data. */
// writing 100 bytes
var_dump( ftell($file_handle) ); // Expecting 0
var_dump( fwrite($file_handle, (binary)$data_to_be_written, 100)); //int(100)
var_dump( feof($file_handle) ); // expected : false
var_dump( ftell($file_handle) ); //expected: 100
// trying to write more than the available data, available 1024 bytes but trying 2048
var_dump( fwrite($file_handle,(binary)$data_to_be_written, 2048)); //int(1024)
var_dump( feof($file_handle) ); // expected : false
var_dump( ftell($file_handle) ); // expected: 1124
// fwrite() without length parameter
var_dump( fwrite($file_handle,(binary)$data_to_be_written)); //int(1024)
var_dump( ftell($file_handle) ); // expected: 2148
var_dump( feof($file_handle) ); // expected: false
// close the file, get the size and content of the file.
var_dump( fclose($file_handle) ); //expected : true
clearstatcache();//clears file status cache
var_dump( filesize($filename) ); // expected: 2148
var_dump(md5(file_get_contents($filename))); // hash the output
} // end of inner for loop
// delete the file created
delete_file($filename);
} // end of outer foreach loop
echo "Done\n";
?>
--EXPECTF--
*** Testing fwrite() basic operations ***
-- Testing fwrite() with file having data of type numeric --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "04db34906fe2c56dcfbd649b7d916974"
-- Testing fwrite() with file having data of type text --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "9c08ac77b7a93a84dd0b055900165e84"
-- Testing fwrite() with file having data of type text_with_new_line --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "56a1963cc292d7f8245219116d9eca40"
-- Testing fwrite() with file having data of type alphanumeric --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
string(32) "719e3329c19218c12d232f2ee81e100f"
Done
--UEXPECT--
*** Testing fwrite() basic operations ***
-- Testing fwrite() with file having data of type numeric --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "04db34906fe2c56dcfbd649b7d916974"
-- Testing fwrite() with file having data of type text --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "9c08ac77b7a93a84dd0b055900165e84"
-- Testing fwrite() with file having data of type text_with_new_line --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "56a1963cc292d7f8245219116d9eca40"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "56a1963cc292d7f8245219116d9eca40"
-- Testing fwrite() with file having data of type alphanumeric --
-- File opened in mode : w --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : wb --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : wt --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+ --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+b --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
-- File opened in mode : w+t --
int(0)
int(100)
bool(false)
int(100)
int(1024)
bool(false)
int(1124)
int(1024)
int(2148)
bool(false)
bool(true)
int(2148)
unicode(32) "719e3329c19218c12d232f2ee81e100f"
Done

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff