move the debug folder to the top level
[AROS.git] / test / dos / fread.c
blob90e1e3906ac8fba3a5ac6a5d5cffeef802356332
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/dos.h>
7 #include <stdio.h>
8 #include "test.h"
11 BPTR fh = BNULL;
13 static void closehandles()
15 if (fh != BNULL) Close(fh);
16 fh = BNULL;
18 int main()
20 LONG result = 0;
21 LONG ioerr = 0;
22 TEXT buffer[16];
24 fh = Open("T:a", MODE_NEWFILE);
26 /* Invalid parameters */
27 SetIoErr(0);
28 result = FRead(fh, buffer, 0, 0);
29 ioerr = IoErr();
30 TEST((result == 0));
31 TEST((ioerr == 0));
33 /* EOF */
34 SetIoErr(0);
35 result = FRead(fh, buffer, 1, 1);
36 ioerr = IoErr();
37 TEST((result == 0));
38 TEST((ioerr == 0));
40 /* BNULL file handle */
41 SetIoErr(0);
42 result = FRead(BNULL, buffer, 1, 1);
43 ioerr = IoErr();
44 TEST((result == 0));
45 TEST((ioerr == 0));
47 cleanup();
49 return OK;
52 void cleanup()
54 closehandles();