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