d396ff607efa8075169568411b2b55dfb0bf9724
[yaffs2.git] / direct / timothy_tests / quick_tests / test_yaffs_read.c
1 #include "test_yaffs_write.h"
2
3 int test_yaffs_read(void){
4         int handle=test_open_file();
5         char text[20]="\0";
6         int output=0;
7         if (handle>0){
8                 output=yaffs_read(handle, text, FILE_TEXT_NBYTES);
9                 printf("output: %d\n",output);
10                 if (output>0){ 
11                         if (text==FILE_TEXT){
12                                 return 1;
13                         }
14                         else {
15                                 printf("text does not match the the text that should be in the file\n");
16                                 return -1;
17                         }
18                 }
19                 else{
20                         printf("error reading file\n");
21                         return -1;
22                 }
23         }
24         else {
25                 printf("error opening file\n");
26                 return -1;
27         }
28         
29 }
30
31 int test_yaffs_read_clean(void){
32         /* need to reset the seek position*/
33         
34         return test_yaffs_lseek_to_beginning();
35 }