yaffs Have revised and checked each test in quick tests.
[yaffs2.git] / direct / timothy_tests / quick_tests / test_yaffs_truncate_EISDIR.c
index 5fa4601a4fc88594bdbaa0db5e3449874ea2a70e..cfd1d82422388eccc912b55fa9dea93b50b5aa7b 100644 (file)
  */
 
 #include "test_yaffs_truncate.h"
-static int handle=0;
+static int handle= -1;
 
-int test_yaffs_truncate_EISDIR(void){
-       int error=0;
-       int output=0;
-       handle=test_yaffs_open();
+int test_yaffs_truncate_EISDIR(void)
+{
+       int error = 0;
+       int output = 0;
+       handle = test_yaffs_open();
        if (handle>=0){
-               output= yaffs_truncate("/yaffs2/",10);
-               if (output<0){
-                       error=yaffs_get_error();
-                       if (abs(error)==EISDIR){
+               output = yaffs_truncate("/yaffs2/",10);
+               if (output < 0){
+                       error = yaffs_get_error();
+                       if (abs(error) == EISDIR){
                                return 1;
-                       }
-                       else {
-                               printf("received a different error than expected\n");
+                       } else {
+                               print_message("received a different error than expected\n",2);
                                return -1;
                        }
-               }
-               else{
-                       printf("truncated a directory\n");
+               } else{
+                       print_message("truncated a directory\n",2);
                        return -1;
                }
                        
-       }
-       else {
-               printf("error opening file");
+       } else {
+               print_message("error opening file\n",2);
                return 1;
        }
 }
 
-int test_yaffs_truncate_EISDIR_clean(void){
+int test_yaffs_truncate_EISDIR_clean(void)
+{
        return 1;
 }