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