yaffs Fixed some bigs in quick tests.
[yaffs2.git] / direct / timothy_tests / quick_tests / lib.c
index 39b0713384d02acf6386a61c7b8304abf50cc9bd..1c3ca689381db7bf0fbb71379b1efb15f293e31d 100644 (file)
 
 #include "lib.h"
 
+static int EXIT_ON_ERROR = 1;
+static int  PRINT_LEVEL = 2;   //This sets the level of detail which is printed. There are 3 levels 0,1,2 and 3  
+                       //0 just prints the number of tests passed and failed.
+                       //1 is the basic print level. it will print the details of a failed test.
+                       //2 will print if a test passes and cleans. 
+void set_print_level(int new_level)
+{
+       PRINT_LEVEL=new_level;
+}
+
+void set_exit_on_error(int num)
+{
+       EXIT_ON_ERROR=num;
+}
 
-void join_paths(char *path1,char *path2,char *new_path ){
+int get_exit_on_error(void)
+{
+       return EXIT_ON_ERROR;
+}
+
+void join_paths(char *path1,char *path2,char *new_path )
+{
 
        //strcat(new_path,path1);       /*since all functions have this then pull it out*/
        if ( (path1[(sizeof(path1)/sizeof(char))-2]=='/') && path2[0]!='/') {
@@ -24,31 +44,35 @@ void join_paths(char *path1,char *path2,char *new_path ){
                //char new_path[(sizeof(path1)/sizeof(char))+(sizeof(path2)/sizeof(char))];
                //strcpy(new_path,strcat(path1,path2)); 
                //return new_path;
-       }       
-       else if ((path1[(sizeof(path1)/sizeof(char))-2]!='/') && path2[0]=='/') {
+       } else if ((path1[(sizeof(path1)/sizeof(char))-2]!='/') && path2[0]=='/') {
                /*paths are compatiable. concatanate them*/  
                strcat(new_path,path1);
                strcat(new_path,path2);         
 
-       }
-       else if ((path1[(sizeof(path1)/sizeof(char))-2]!='/') && path2[0]!='/') {
+       } else if ((path1[(sizeof(path1)/sizeof(char))-2]!='/') && path2[0]!='/') {
                        /*need to add a "/". */  
                strcat(new_path,path1);
                strcat(new_path,"/");
                strcat(new_path,path2);
 
-
-       }
-       else if ((path1[(sizeof(path1)/sizeof(char))-2]=='/') && path2[0]=='/') {
+       } else if ((path1[(sizeof(path1)/sizeof(char))-2]=='/') && path2[0]=='/') {
                /*need to remove a "/". */
                /*yaffs does not mind the extra slash. */               
                strcat(new_path,path1);
                strcat(new_path,path2);
 
-       } 
-       else{
+       } else {
                //error 
                //return -1;
        }
 }
 
+void print_message(char *message,char print_level)
+{
+       if (print_level <= PRINT_LEVEL){
+               printf(message);
+       }
+}
+       
+
+