yaffs Improvements on the quick tests code. note the bug is still here.
[yaffs2.git] / direct / timothy_tests / quick_tests / test_yaffs_ftruncate.c
1 #include "test_yaffs_ftruncate.h"
2
3 static int handle=0;
4 int test_yaffs_ftruncate(void){
5         handle=test_yaffs_open_file();
6         if (handle>0){
7                 return yaffs_ftruncate(handle,FILE_SIZE_TRUNCATED );
8         }
9         else {
10                 printf("error opening file\n");
11                 return -1;
12         }
13 }
14
15 int test_yaffs_ftruncate_clean(void){
16         /* change file size back to orignal size */
17         int output=0;
18         if (handle>0){
19                 output=yaffs_ftruncate(handle,FILE_SIZE );
20                 if (output>=0){
21                         return yaffs_close(handle);
22                 }
23                 else {
24                         printf("failed to truncate file\n");
25                         return -1;
26                 }
27         }
28         else {
29                 printf("error opening file in clean function\n");
30                 return -1;
31         }
32         
33 }