--TEST-- Test fread() function : usage variations - read beyond file size, read/write mode --SKIPIF-- --FILE-- --EXPECT-- *** Testing fread() : usage variations *** -- Testing fread() with file having content of type numeric -- -- File opened in mode a+ -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "950b7457d1deb6332f2fc5d42f3129d6" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode a+b -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "950b7457d1deb6332f2fc5d42f3129d6" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode a+t -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "950b7457d1deb6332f2fc5d42f3129d6" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode w+ -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "950b7457d1deb6332f2fc5d42f3129d6" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode w+b -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "950b7457d1deb6332f2fc5d42f3129d6" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode w+t -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "950b7457d1deb6332f2fc5d42f3129d6" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode x+ -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "950b7457d1deb6332f2fc5d42f3129d6" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode x+b -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "950b7457d1deb6332f2fc5d42f3129d6" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode x+t -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "950b7457d1deb6332f2fc5d42f3129d6" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- Testing fread() with file having content of type text -- -- File opened in mode a+ -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "e486000c4c8452774f746a27658d87fa" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode a+b -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "e486000c4c8452774f746a27658d87fa" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode a+t -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "e486000c4c8452774f746a27658d87fa" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode w+ -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "e486000c4c8452774f746a27658d87fa" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode w+b -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "e486000c4c8452774f746a27658d87fa" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode w+t -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "e486000c4c8452774f746a27658d87fa" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode x+ -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "e486000c4c8452774f746a27658d87fa" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode x+b -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "e486000c4c8452774f746a27658d87fa" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode x+t -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "e486000c4c8452774f746a27658d87fa" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- Testing fread() with file having content of type text_with_new_line -- -- File opened in mode a+ -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "b09c8026a64a88d36d4c2f17983964bb" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode a+b -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "b09c8026a64a88d36d4c2f17983964bb" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode a+t -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "b09c8026a64a88d36d4c2f17983964bb" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode w+ -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "b09c8026a64a88d36d4c2f17983964bb" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode w+b -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "b09c8026a64a88d36d4c2f17983964bb" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode w+t -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "b09c8026a64a88d36d4c2f17983964bb" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1137) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1137) bool(true) -- File opened in mode x+ -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "b09c8026a64a88d36d4c2f17983964bb" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode x+b -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "b09c8026a64a88d36d4c2f17983964bb" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1024) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1024) bool(true) -- File opened in mode x+t -- -- Reading beyond filesize, expeceted : 1024 bytes -- int(0) bool(false) Reading 1030 bytes from file, expecting 1024 bytes ... OK int(1024) bool(true) string(32) "b09c8026a64a88d36d4c2f17983964bb" -- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- int(1137) bool(false) Reading 10 bytes from file, expecting 0 bytes ... OK int(1137) bool(true) Done