fread_variation1.phpt 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. --TEST--
  2. Test fread() function : usage variations - read some/all chars, read/write modes
  3. --FILE--
  4. <?php
  5. /* Read content less than file size &
  6. Read entire file
  7. */
  8. // include the file.inc for common functions for test
  9. include ("file.inc");
  10. /* Function : function check_read(resource $file_handle, int $read_size, int $expect_size)
  11. Description : Read data from file of size $read_size and verifies that $expected_size no. of
  12. bytes are read.
  13. $file_handle : File Handle
  14. $read_size : No. of bytes to be read.
  15. $expect_size : Expected data length
  16. Returns: returns the data read
  17. */
  18. function check_read($file_handle, $read_size, $expect_size) {
  19. // print file pointer position before read
  20. var_dump( ftell($file_handle) );
  21. var_dump( feof($file_handle) );
  22. // read the data of size $read_size
  23. echo "Reading $read_size bytes from file, expecting $expect_size bytes ... ";
  24. $data_from_file = fread($file_handle, $read_size);
  25. // check if data read is of expected size
  26. if ( strlen($data_from_file) == $expect_size)
  27. echo "OK\n";
  28. else
  29. echo "Error reading file, total number of bytes read = ".strlen($data_from_file)."\n";
  30. // file pointer position after read
  31. var_dump( ftell($file_handle) );
  32. // check if file pointer at eof()
  33. var_dump( feof($file_handle) );
  34. return $data_from_file;
  35. }
  36. echo "*** Testing fread() : usage variations ***\n";
  37. $file_modes = array("a+","a+b","a+t",
  38. "w+","w+b","w+t",
  39. "x+","x+b","x+t");
  40. $file_content_types = array("numeric","text","text_with_new_line", "alphanumeric");
  41. foreach($file_content_types as $file_content_type) {
  42. echo "\n-- Testing fread() with file having content of type ". $file_content_type ." --\n";
  43. /* open the file using $files_modes and perform fread() on it */
  44. foreach($file_modes as $file_mode) {
  45. if(!strstr($file_mode,"x")){
  46. /* create files with $file_content_type */
  47. create_files ( __DIR__, 1, $file_content_type, 0755, 1, "w", "fread_variation");
  48. }
  49. $filename = __DIR__."/fread_variation1.tmp"; // this is name of the file created by create_files()
  50. echo "-- File opened in mode ".$file_mode." --\n";
  51. $file_handle = fopen($filename, $file_mode);
  52. if (!$file_handle) {
  53. echo "Error: failed to fopen() file: $filename!";
  54. exit();
  55. }
  56. if(strstr($file_mode,"w") || strstr($file_mode,"x") ) {
  57. fill_file($file_handle, $file_content_type, 1024);
  58. }
  59. rewind($file_handle);
  60. echo "-- Reading entire file content, expected : 1024 bytes --\n";
  61. // read from file, by giving the file actual size,
  62. $data_from_file = check_read($file_handle, 1024, (strstr($file_mode, "+") ? 1024 : 1024 ) );
  63. // calculate the hash and dump it, if data read, expecting here no data was read
  64. if ( $data_from_file != false)
  65. var_dump( md5($data_from_file) );
  66. // reading file by giving less than its size
  67. echo "-- Reading file content less than max. file size, expected : 1000 bytes --\n";
  68. rewind($file_handle);
  69. $data_from_file = check_read($file_handle, 1000, (strstr($file_mode, "+") ? 1000 : 1000 ) );
  70. // calculate the hash and dump it, if data read, expecting here no data was read
  71. if ( $data_from_file != false)
  72. var_dump( md5($data_from_file) );
  73. // now close the file
  74. fclose($file_handle);
  75. // delete the file created
  76. delete_file($filename); // delete file
  77. } // end of inner foreach loop
  78. }// end of outer foreach loop
  79. echo"Done\n";
  80. ?>
  81. --EXPECT--
  82. *** Testing fread() : usage variations ***
  83. -- Testing fread() with file having content of type numeric --
  84. -- File opened in mode a+ --
  85. -- Reading entire file content, expected : 1024 bytes --
  86. int(0)
  87. bool(false)
  88. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  89. int(1024)
  90. bool(false)
  91. string(32) "950b7457d1deb6332f2fc5d42f3129d6"
  92. -- Reading file content less than max. file size, expected : 1000 bytes --
  93. int(0)
  94. bool(false)
  95. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  96. int(1000)
  97. bool(false)
  98. string(32) "4501f99f2b79d0345f26f1394aca58a3"
  99. -- File opened in mode a+b --
  100. -- Reading entire file content, expected : 1024 bytes --
  101. int(0)
  102. bool(false)
  103. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  104. int(1024)
  105. bool(false)
  106. string(32) "950b7457d1deb6332f2fc5d42f3129d6"
  107. -- Reading file content less than max. file size, expected : 1000 bytes --
  108. int(0)
  109. bool(false)
  110. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  111. int(1000)
  112. bool(false)
  113. string(32) "4501f99f2b79d0345f26f1394aca58a3"
  114. -- File opened in mode a+t --
  115. -- Reading entire file content, expected : 1024 bytes --
  116. int(0)
  117. bool(false)
  118. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  119. int(1024)
  120. bool(false)
  121. string(32) "950b7457d1deb6332f2fc5d42f3129d6"
  122. -- Reading file content less than max. file size, expected : 1000 bytes --
  123. int(0)
  124. bool(false)
  125. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  126. int(1000)
  127. bool(false)
  128. string(32) "4501f99f2b79d0345f26f1394aca58a3"
  129. -- File opened in mode w+ --
  130. -- Reading entire file content, expected : 1024 bytes --
  131. int(0)
  132. bool(false)
  133. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  134. int(1024)
  135. bool(false)
  136. string(32) "950b7457d1deb6332f2fc5d42f3129d6"
  137. -- Reading file content less than max. file size, expected : 1000 bytes --
  138. int(0)
  139. bool(false)
  140. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  141. int(1000)
  142. bool(false)
  143. string(32) "4501f99f2b79d0345f26f1394aca58a3"
  144. -- File opened in mode w+b --
  145. -- Reading entire file content, expected : 1024 bytes --
  146. int(0)
  147. bool(false)
  148. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  149. int(1024)
  150. bool(false)
  151. string(32) "950b7457d1deb6332f2fc5d42f3129d6"
  152. -- Reading file content less than max. file size, expected : 1000 bytes --
  153. int(0)
  154. bool(false)
  155. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  156. int(1000)
  157. bool(false)
  158. string(32) "4501f99f2b79d0345f26f1394aca58a3"
  159. -- File opened in mode w+t --
  160. -- Reading entire file content, expected : 1024 bytes --
  161. int(0)
  162. bool(false)
  163. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  164. int(1024)
  165. bool(false)
  166. string(32) "950b7457d1deb6332f2fc5d42f3129d6"
  167. -- Reading file content less than max. file size, expected : 1000 bytes --
  168. int(0)
  169. bool(false)
  170. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  171. int(1000)
  172. bool(false)
  173. string(32) "4501f99f2b79d0345f26f1394aca58a3"
  174. -- File opened in mode x+ --
  175. -- Reading entire file content, expected : 1024 bytes --
  176. int(0)
  177. bool(false)
  178. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  179. int(1024)
  180. bool(false)
  181. string(32) "950b7457d1deb6332f2fc5d42f3129d6"
  182. -- Reading file content less than max. file size, expected : 1000 bytes --
  183. int(0)
  184. bool(false)
  185. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  186. int(1000)
  187. bool(false)
  188. string(32) "4501f99f2b79d0345f26f1394aca58a3"
  189. -- File opened in mode x+b --
  190. -- Reading entire file content, expected : 1024 bytes --
  191. int(0)
  192. bool(false)
  193. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  194. int(1024)
  195. bool(false)
  196. string(32) "950b7457d1deb6332f2fc5d42f3129d6"
  197. -- Reading file content less than max. file size, expected : 1000 bytes --
  198. int(0)
  199. bool(false)
  200. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  201. int(1000)
  202. bool(false)
  203. string(32) "4501f99f2b79d0345f26f1394aca58a3"
  204. -- File opened in mode x+t --
  205. -- Reading entire file content, expected : 1024 bytes --
  206. int(0)
  207. bool(false)
  208. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  209. int(1024)
  210. bool(false)
  211. string(32) "950b7457d1deb6332f2fc5d42f3129d6"
  212. -- Reading file content less than max. file size, expected : 1000 bytes --
  213. int(0)
  214. bool(false)
  215. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  216. int(1000)
  217. bool(false)
  218. string(32) "4501f99f2b79d0345f26f1394aca58a3"
  219. -- Testing fread() with file having content of type text --
  220. -- File opened in mode a+ --
  221. -- Reading entire file content, expected : 1024 bytes --
  222. int(0)
  223. bool(false)
  224. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  225. int(1024)
  226. bool(false)
  227. string(32) "e486000c4c8452774f746a27658d87fa"
  228. -- Reading file content less than max. file size, expected : 1000 bytes --
  229. int(0)
  230. bool(false)
  231. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  232. int(1000)
  233. bool(false)
  234. string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
  235. -- File opened in mode a+b --
  236. -- Reading entire file content, expected : 1024 bytes --
  237. int(0)
  238. bool(false)
  239. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  240. int(1024)
  241. bool(false)
  242. string(32) "e486000c4c8452774f746a27658d87fa"
  243. -- Reading file content less than max. file size, expected : 1000 bytes --
  244. int(0)
  245. bool(false)
  246. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  247. int(1000)
  248. bool(false)
  249. string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
  250. -- File opened in mode a+t --
  251. -- Reading entire file content, expected : 1024 bytes --
  252. int(0)
  253. bool(false)
  254. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  255. int(1024)
  256. bool(false)
  257. string(32) "e486000c4c8452774f746a27658d87fa"
  258. -- Reading file content less than max. file size, expected : 1000 bytes --
  259. int(0)
  260. bool(false)
  261. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  262. int(1000)
  263. bool(false)
  264. string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
  265. -- File opened in mode w+ --
  266. -- Reading entire file content, expected : 1024 bytes --
  267. int(0)
  268. bool(false)
  269. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  270. int(1024)
  271. bool(false)
  272. string(32) "e486000c4c8452774f746a27658d87fa"
  273. -- Reading file content less than max. file size, expected : 1000 bytes --
  274. int(0)
  275. bool(false)
  276. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  277. int(1000)
  278. bool(false)
  279. string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
  280. -- File opened in mode w+b --
  281. -- Reading entire file content, expected : 1024 bytes --
  282. int(0)
  283. bool(false)
  284. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  285. int(1024)
  286. bool(false)
  287. string(32) "e486000c4c8452774f746a27658d87fa"
  288. -- Reading file content less than max. file size, expected : 1000 bytes --
  289. int(0)
  290. bool(false)
  291. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  292. int(1000)
  293. bool(false)
  294. string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
  295. -- File opened in mode w+t --
  296. -- Reading entire file content, expected : 1024 bytes --
  297. int(0)
  298. bool(false)
  299. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  300. int(1024)
  301. bool(false)
  302. string(32) "e486000c4c8452774f746a27658d87fa"
  303. -- Reading file content less than max. file size, expected : 1000 bytes --
  304. int(0)
  305. bool(false)
  306. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  307. int(1000)
  308. bool(false)
  309. string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
  310. -- File opened in mode x+ --
  311. -- Reading entire file content, expected : 1024 bytes --
  312. int(0)
  313. bool(false)
  314. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  315. int(1024)
  316. bool(false)
  317. string(32) "e486000c4c8452774f746a27658d87fa"
  318. -- Reading file content less than max. file size, expected : 1000 bytes --
  319. int(0)
  320. bool(false)
  321. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  322. int(1000)
  323. bool(false)
  324. string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
  325. -- File opened in mode x+b --
  326. -- Reading entire file content, expected : 1024 bytes --
  327. int(0)
  328. bool(false)
  329. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  330. int(1024)
  331. bool(false)
  332. string(32) "e486000c4c8452774f746a27658d87fa"
  333. -- Reading file content less than max. file size, expected : 1000 bytes --
  334. int(0)
  335. bool(false)
  336. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  337. int(1000)
  338. bool(false)
  339. string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
  340. -- File opened in mode x+t --
  341. -- Reading entire file content, expected : 1024 bytes --
  342. int(0)
  343. bool(false)
  344. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  345. int(1024)
  346. bool(false)
  347. string(32) "e486000c4c8452774f746a27658d87fa"
  348. -- Reading file content less than max. file size, expected : 1000 bytes --
  349. int(0)
  350. bool(false)
  351. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  352. int(1000)
  353. bool(false)
  354. string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
  355. -- Testing fread() with file having content of type text_with_new_line --
  356. -- File opened in mode a+ --
  357. -- Reading entire file content, expected : 1024 bytes --
  358. int(0)
  359. bool(false)
  360. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  361. int(1024)
  362. bool(false)
  363. string(32) "b09c8026a64a88d36d4c2f17983964bb"
  364. -- Reading file content less than max. file size, expected : 1000 bytes --
  365. int(0)
  366. bool(false)
  367. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  368. int(1000)
  369. bool(false)
  370. string(32) "a148fa8110bbac875d84fc9d7056c0a1"
  371. -- File opened in mode a+b --
  372. -- Reading entire file content, expected : 1024 bytes --
  373. int(0)
  374. bool(false)
  375. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  376. int(1024)
  377. bool(false)
  378. string(32) "b09c8026a64a88d36d4c2f17983964bb"
  379. -- Reading file content less than max. file size, expected : 1000 bytes --
  380. int(0)
  381. bool(false)
  382. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  383. int(1000)
  384. bool(false)
  385. string(32) "a148fa8110bbac875d84fc9d7056c0a1"
  386. -- File opened in mode a+t --
  387. -- Reading entire file content, expected : 1024 bytes --
  388. int(0)
  389. bool(false)
  390. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  391. int(1024)
  392. bool(false)
  393. string(32) "b09c8026a64a88d36d4c2f17983964bb"
  394. -- Reading file content less than max. file size, expected : 1000 bytes --
  395. int(0)
  396. bool(false)
  397. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  398. int(1000)
  399. bool(false)
  400. string(32) "a148fa8110bbac875d84fc9d7056c0a1"
  401. -- File opened in mode w+ --
  402. -- Reading entire file content, expected : 1024 bytes --
  403. int(0)
  404. bool(false)
  405. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  406. int(1024)
  407. bool(false)
  408. string(32) "b09c8026a64a88d36d4c2f17983964bb"
  409. -- Reading file content less than max. file size, expected : 1000 bytes --
  410. int(0)
  411. bool(false)
  412. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  413. int(1000)
  414. bool(false)
  415. string(32) "a148fa8110bbac875d84fc9d7056c0a1"
  416. -- File opened in mode w+b --
  417. -- Reading entire file content, expected : 1024 bytes --
  418. int(0)
  419. bool(false)
  420. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  421. int(1024)
  422. bool(false)
  423. string(32) "b09c8026a64a88d36d4c2f17983964bb"
  424. -- Reading file content less than max. file size, expected : 1000 bytes --
  425. int(0)
  426. bool(false)
  427. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  428. int(1000)
  429. bool(false)
  430. string(32) "a148fa8110bbac875d84fc9d7056c0a1"
  431. -- File opened in mode w+t --
  432. -- Reading entire file content, expected : 1024 bytes --
  433. int(0)
  434. bool(false)
  435. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  436. int(1024)
  437. bool(false)
  438. string(32) "b09c8026a64a88d36d4c2f17983964bb"
  439. -- Reading file content less than max. file size, expected : 1000 bytes --
  440. int(0)
  441. bool(false)
  442. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  443. int(1000)
  444. bool(false)
  445. string(32) "a148fa8110bbac875d84fc9d7056c0a1"
  446. -- File opened in mode x+ --
  447. -- Reading entire file content, expected : 1024 bytes --
  448. int(0)
  449. bool(false)
  450. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  451. int(1024)
  452. bool(false)
  453. string(32) "b09c8026a64a88d36d4c2f17983964bb"
  454. -- Reading file content less than max. file size, expected : 1000 bytes --
  455. int(0)
  456. bool(false)
  457. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  458. int(1000)
  459. bool(false)
  460. string(32) "a148fa8110bbac875d84fc9d7056c0a1"
  461. -- File opened in mode x+b --
  462. -- Reading entire file content, expected : 1024 bytes --
  463. int(0)
  464. bool(false)
  465. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  466. int(1024)
  467. bool(false)
  468. string(32) "b09c8026a64a88d36d4c2f17983964bb"
  469. -- Reading file content less than max. file size, expected : 1000 bytes --
  470. int(0)
  471. bool(false)
  472. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  473. int(1000)
  474. bool(false)
  475. string(32) "a148fa8110bbac875d84fc9d7056c0a1"
  476. -- File opened in mode x+t --
  477. -- Reading entire file content, expected : 1024 bytes --
  478. int(0)
  479. bool(false)
  480. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  481. int(1024)
  482. bool(false)
  483. string(32) "b09c8026a64a88d36d4c2f17983964bb"
  484. -- Reading file content less than max. file size, expected : 1000 bytes --
  485. int(0)
  486. bool(false)
  487. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  488. int(1000)
  489. bool(false)
  490. string(32) "a148fa8110bbac875d84fc9d7056c0a1"
  491. -- Testing fread() with file having content of type alphanumeric --
  492. -- File opened in mode a+ --
  493. -- Reading entire file content, expected : 1024 bytes --
  494. int(0)
  495. bool(false)
  496. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  497. int(1024)
  498. bool(false)
  499. string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
  500. -- Reading file content less than max. file size, expected : 1000 bytes --
  501. int(0)
  502. bool(false)
  503. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  504. int(1000)
  505. bool(false)
  506. string(32) "a49d752f980184c7f44568e930f89c72"
  507. -- File opened in mode a+b --
  508. -- Reading entire file content, expected : 1024 bytes --
  509. int(0)
  510. bool(false)
  511. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  512. int(1024)
  513. bool(false)
  514. string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
  515. -- Reading file content less than max. file size, expected : 1000 bytes --
  516. int(0)
  517. bool(false)
  518. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  519. int(1000)
  520. bool(false)
  521. string(32) "a49d752f980184c7f44568e930f89c72"
  522. -- File opened in mode a+t --
  523. -- Reading entire file content, expected : 1024 bytes --
  524. int(0)
  525. bool(false)
  526. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  527. int(1024)
  528. bool(false)
  529. string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
  530. -- Reading file content less than max. file size, expected : 1000 bytes --
  531. int(0)
  532. bool(false)
  533. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  534. int(1000)
  535. bool(false)
  536. string(32) "a49d752f980184c7f44568e930f89c72"
  537. -- File opened in mode w+ --
  538. -- Reading entire file content, expected : 1024 bytes --
  539. int(0)
  540. bool(false)
  541. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  542. int(1024)
  543. bool(false)
  544. string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
  545. -- Reading file content less than max. file size, expected : 1000 bytes --
  546. int(0)
  547. bool(false)
  548. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  549. int(1000)
  550. bool(false)
  551. string(32) "a49d752f980184c7f44568e930f89c72"
  552. -- File opened in mode w+b --
  553. -- Reading entire file content, expected : 1024 bytes --
  554. int(0)
  555. bool(false)
  556. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  557. int(1024)
  558. bool(false)
  559. string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
  560. -- Reading file content less than max. file size, expected : 1000 bytes --
  561. int(0)
  562. bool(false)
  563. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  564. int(1000)
  565. bool(false)
  566. string(32) "a49d752f980184c7f44568e930f89c72"
  567. -- File opened in mode w+t --
  568. -- Reading entire file content, expected : 1024 bytes --
  569. int(0)
  570. bool(false)
  571. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  572. int(1024)
  573. bool(false)
  574. string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
  575. -- Reading file content less than max. file size, expected : 1000 bytes --
  576. int(0)
  577. bool(false)
  578. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  579. int(1000)
  580. bool(false)
  581. string(32) "a49d752f980184c7f44568e930f89c72"
  582. -- File opened in mode x+ --
  583. -- Reading entire file content, expected : 1024 bytes --
  584. int(0)
  585. bool(false)
  586. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  587. int(1024)
  588. bool(false)
  589. string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
  590. -- Reading file content less than max. file size, expected : 1000 bytes --
  591. int(0)
  592. bool(false)
  593. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  594. int(1000)
  595. bool(false)
  596. string(32) "a49d752f980184c7f44568e930f89c72"
  597. -- File opened in mode x+b --
  598. -- Reading entire file content, expected : 1024 bytes --
  599. int(0)
  600. bool(false)
  601. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  602. int(1024)
  603. bool(false)
  604. string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
  605. -- Reading file content less than max. file size, expected : 1000 bytes --
  606. int(0)
  607. bool(false)
  608. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  609. int(1000)
  610. bool(false)
  611. string(32) "a49d752f980184c7f44568e930f89c72"
  612. -- File opened in mode x+t --
  613. -- Reading entire file content, expected : 1024 bytes --
  614. int(0)
  615. bool(false)
  616. Reading 1024 bytes from file, expecting 1024 bytes ... OK
  617. int(1024)
  618. bool(false)
  619. string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
  620. -- Reading file content less than max. file size, expected : 1000 bytes --
  621. int(0)
  622. bool(false)
  623. Reading 1000 bytes from file, expecting 1000 bytes ... OK
  624. int(1000)
  625. bool(false)
  626. string(32) "a49d752f980184c7f44568e930f89c72"
  627. Done