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