00001
00002
00003 #include <iostream>
00004
00005 using std::cerr ;
00006 using std::cout ;
00007 using std::endl ;
00008
00009 #include "scrubT.h"
00010 #include "BESScrub.h"
00011 #include "BESException.h"
00012
00013 int scrubT::
00014 run(void)
00015 {
00016 cout << endl << "*****************************************" << endl;
00017 cout << "Entered scrubT::run" << endl;
00018 int retVal = 0;
00019
00020 {
00021 cout << endl << "*****************************************" << endl;
00022 cout << "Test command line length over 255 characters" << endl;
00023 char arg[512] ;
00024 memset( arg, 'a', 300 ) ;
00025 arg[300] = '\0' ;
00026 if( BESScrub::command_line_arg_ok( arg ) )
00027 {
00028 cerr << "command line ok, shouldn't be" << endl ;
00029 return 1 ;
00030 }
00031 else
00032 {
00033 cout << "command line not ok, good" << endl ;
00034 }
00035 }
00036
00037 {
00038 cout << endl << "*****************************************" << endl;
00039 cout << "Test command line length ok" << endl;
00040 string arg = "anarg" ;
00041 if( BESScrub::command_line_arg_ok( arg ) )
00042 {
00043 cout << "command line ok, good" << endl ;
00044 }
00045 else
00046 {
00047 cerr << "command line not ok, should be" << endl ;
00048 return 1 ;
00049 }
00050 }
00051
00052 {
00053 cout << endl << "*****************************************" << endl;
00054 cout << "Test path name length over 255 characters" << endl;
00055 char path_name[512] ;
00056 memset( path_name, 'a', 300 ) ;
00057 path_name[300] = '\0' ;
00058 if( BESScrub::pathname_ok( path_name, true ) )
00059 {
00060 cerr << "path name ok, shouldn't be" << endl ;
00061 return 1 ;
00062 }
00063 else
00064 {
00065 cout << "path name not ok, good" << endl ;
00066 }
00067 }
00068
00069 {
00070 cout << endl << "*****************************************" << endl;
00071 cout << "Test path name good" << endl;
00072 if( BESScrub::pathname_ok( "/usr/local/something_goes_here-and-is-ok.txt", true ) )
00073 {
00074 cout << "path name ok, good" << endl ;
00075 }
00076 else
00077 {
00078 cerr << "path name not ok, should be" << endl ;
00079 return 1 ;
00080 }
00081 }
00082
00083 {
00084 cout << endl << "*****************************************" << endl;
00085 cout << "Test path name bad characters strict" << endl;
00086 if( BESScrub::pathname_ok( "*$^&;@/user/local/bin/ls", true ) )
00087 {
00088 cerr << "path name ok, shouldn't be" << endl ;
00089 return 1 ;
00090 }
00091 else
00092 {
00093 cout << "path name not ok, good" << endl ;
00094 }
00095 }
00096
00097 {
00098 cout << endl << "*****************************************" << endl;
00099 cout << "Test array size too big" << endl;
00100 if( BESScrub::size_ok( 4, UINT_MAX ) )
00101 {
00102 cerr << "array size ok, shouldn't be" << endl ;
00103 return 1 ;
00104 }
00105 else
00106 {
00107 cout << "array size not ok, good" << endl ;
00108 }
00109 }
00110
00111 {
00112 cout << endl << "*****************************************" << endl;
00113 cout << "Test array size ok" << endl;
00114 if( BESScrub::size_ok( 4, 32 ) )
00115 {
00116 cout << "array size ok, good" << endl ;
00117 }
00118 else
00119 {
00120 cerr << "array size not ok, should be" << endl ;
00121 return 1 ;
00122 }
00123 }
00124
00125 cout << endl << "*****************************************" << endl;
00126 cout << "Returning from scrubT::run" << endl;
00127
00128 return retVal;
00129 }
00130
00131 int
00132 main(int argC, char **argV) {
00133 Application *app = new scrubT();
00134 return app->main(argC, argV);
00135 }
00136