Changes in tests/configs/parsenums.cfa [9e042d8:0b6089f]
- File:
-
- 1 edited
-
tests/configs/parsenums.cfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/configs/parsenums.cfa
r9e042d8 r0b6089f 32 32 #endif 33 33 34 int true_main( const char * exec);35 36 int main( int argc, char * argv[]) {37 check_main( argv[0]);34 int true_main( const char * exec ); 35 36 int main( int argc, char * argv[]) { 37 check_main( argv[0]); 38 38 39 39 int i = -3; … … 52 52 53 53 char **left; 54 parse_args( options, "[OPTIONS]...\ntesting bool parameters", left );54 parse_args( options, "[OPTIONS]...\ntesting bool parameters", left ); 55 55 56 56 sout | "int :" | i; … … 61 61 } 62 62 63 int true_main(const char * path, char * env[]) { 64 printf("no arg:\n"); 65 if(pid_t child = strict_fork(); child == 0) { 66 int ret = execle(path, "parsenums", (const char*)0p, env); 67 if(ret < 0) { 68 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 69 exit(1); 70 } 71 } 72 else { 73 int status = do_wait(child); 74 print_status(status); 75 } 76 77 printf("all 0 arg:\n"); 78 if(pid_t child = strict_fork(); child == 0) { 79 int ret = execle(path, "parsenums", "-i=0", "-u=0", "-l=0", "-L=0", "-d=0", (const char*)0p, env); 80 if(ret < 0) { 81 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 82 exit(1); 83 } 84 } 85 else { 86 int status = do_wait(child); 87 print_status(status); 88 } 89 90 printf("negative vals arg:\n"); 91 if(pid_t child = strict_fork(); child == 0) { 92 int ret = execle(path, "parsenums", "-i=-1", "-d=-1", (const char*)0p, env); 93 if(ret < 0) { 94 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 95 exit(1); 96 } 97 } 98 else { 99 int status = do_wait(child); 100 print_status(status); 101 } 102 103 printf("funky notation arg:\n"); 104 if(pid_t child = strict_fork(); child == 0) { 105 int ret = execle(path, "parsenums", "-i=0x10", "-u=0x20", "-l=0x300", "-L=0x4000", "-d=5e6", (const char*)0p, env); 106 if(ret < 0) { 107 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 108 exit(1); 109 } 110 } 111 else { 112 int status = do_wait(child); 113 print_status(status); 114 } 115 116 printf("big values arg:\n"); 117 if(pid_t child = strict_fork(); child == 0) { 118 int ret = execle(path, "parsenums", "-i=2147483647", "-u=4294967295", "-l=" BIG_UNSIGNED_LONG, "-L=18446744073709551615", "-d=5e6", (const char*)0p, env); 119 if(ret < 0) { 120 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 121 exit(1); 122 } 123 } 124 else { 125 int status = do_wait(child); 126 print_status(status); 127 } 128 129 printf("too big values arg:\n"); 130 if(pid_t child = strict_fork(); child == 0) { 131 int ret = execle(path, "parsenums", "-i=2147483648", (const char*)0p, env); 132 if(ret < 0) { 133 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 134 exit(1); 135 } 136 } 137 else { 138 int status = do_wait(child); 139 print_status(status); 140 } 141 142 if(pid_t child = strict_fork(); child == 0) { 143 int ret = execle(path, "parsenums", "-u=4294967296", (const char*)0p, env); 144 if(ret < 0) { 145 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 146 exit(1); 147 } 148 } 149 else { 150 int status = do_wait(child); 151 print_status(status); 152 } 153 154 if(pid_t child = strict_fork(); child == 0) { 155 int ret = execle(path, "parsenums", "-l=" TOO_BIG_UNSIGNED_LONG, (const char*)0p, env); 156 if(ret < 0) { 157 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 158 exit(1); 159 } 160 } 161 else { 162 int status = do_wait(child); 163 print_status(status); 164 } 165 166 if(pid_t child = strict_fork(); child == 0) { 167 int ret = execle(path, "parsenums", "-L=18446744073709551616", (const char*)0p, env); 168 if(ret < 0) { 169 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 170 exit(1); 171 } 172 } 173 else { 174 int status = do_wait(child); 175 print_status(status); 176 } 177 178 printf("negative errors arg:\n"); 179 if(pid_t child = strict_fork(); child == 0) { 180 int ret = execle(path, "parsenums", "-u=-1", (const char*)0p, env); 181 if(ret < 0) { 182 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 183 exit(1); 184 } 185 } 186 else { 187 int status = do_wait(child); 188 print_status(status); 189 } 190 191 if(pid_t child = strict_fork(); child == 0) { 192 int ret = execle(path, "parsenums", "-l=-1", (const char*)0p, env); 193 if(ret < 0) { 194 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 195 exit(1); 196 } 197 } 198 else { 199 int status = do_wait(child); 200 print_status(status); 201 } 202 203 if(pid_t child = strict_fork(); child == 0) { 204 int ret = execle(path, "parsenums", "-L=-1", (const char*)0p, env); 205 if(ret < 0) { 206 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 207 exit(1); 208 } 209 } 210 else { 211 int status = do_wait(child); 212 print_status(status); 213 } 214 215 printf("All Done!\n"); 63 int true_main( const char * path, char * env[] ) { 64 printf( "no arg:\n" ); 65 if ( pid_t child = strict_fork(); child == 0 ) { 66 int ret = execle( path, "parsenums", (const char*)0p, env ); 67 if ( ret < 0 ) { 68 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 69 exit( 1 ); 70 } // if 71 } else { 72 int status = do_wait( child ); 73 print_status( status ); 74 } // if 75 76 printf( "all 0 arg:\n" ); 77 if ( pid_t child = strict_fork(); child == 0 ) { 78 int ret = execle( path, "parsenums", "-i=0", "-u=0", "-l=0", "-L=0", "-d=0", (const char*)0p, env ); 79 if ( ret < 0 ) { 80 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 81 exit( 1 ); 82 } // if 83 } else { 84 int status = do_wait( child ); 85 print_status( status ); 86 } // if 87 88 printf( "negative vals arg:\n" ); 89 if ( pid_t child = strict_fork(); child == 0 ) { 90 int ret = execle( path, "parsenums", "-i=-1", "-d=-1", (const char*)0p, env ); 91 if ( ret < 0 ) { 92 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 93 exit( 1 ); 94 } // if 95 } else { 96 int status = do_wait( child ); 97 print_status( status ); 98 } // if 99 100 printf( "funky notation arg:\n" ); 101 if ( pid_t child = strict_fork(); child == 0 ) { 102 int ret = execle( path, "parsenums", "-i=0x10", "-u=0x20", "-l=0x300", "-L=0x4000", "-d=5e6", (const char*)0p, env ); 103 if ( ret < 0 ) { 104 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 105 exit( 1 ); 106 } // if 107 } else { 108 int status = do_wait( child ); 109 print_status( status ); 110 } // if 111 112 printf( "big values arg:\n" ); 113 if ( pid_t child = strict_fork(); child == 0 ) { 114 int ret = execle( path, "parsenums", "-i=2147483647", "-u=4294967295", "-l=" BIG_UNSIGNED_LONG, "-L=18446744073709551615", "-d=5e6", (const char*)0p, env ); 115 if ( ret < 0 ) { 116 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 117 exit( 1 ); 118 } // if 119 } else { 120 int status = do_wait( child ); 121 print_status( status ); 122 } // if 123 124 printf( "too big values arg:\n" ); 125 if ( pid_t child = strict_fork(); child == 0 ) { 126 int ret = execle( path, "parsenums", "-i=2147483648", (const char*)0p, env ); 127 if ( ret < 0 ) { 128 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 129 exit( 1 ); 130 } // if 131 } else { 132 int status = do_wait( child ); 133 print_status( status ); 134 } // if 135 136 if ( pid_t child = strict_fork(); child == 0 ) { 137 int ret = execle( path, "parsenums", "-u=4294967296", (const char*)0p, env ); 138 if ( ret < 0 ) { 139 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 140 exit( 1 ); 141 } // if 142 } else { 143 int status = do_wait( child ); 144 print_status( status ); 145 } // if 146 147 if ( pid_t child = strict_fork(); child == 0 ) { 148 int ret = execle( path, "parsenums", "-l=" TOO_BIG_UNSIGNED_LONG, (const char*)0p, env ); 149 if ( ret < 0 ) { 150 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 151 exit( 1 ); 152 } // if 153 } else { 154 int status = do_wait( child ); 155 print_status( status ); 156 } // if 157 158 if ( pid_t child = strict_fork(); child == 0 ) { 159 int ret = execle( path, "parsenums", "-L=18446744073709551616", (const char*)0p, env ); 160 if ( ret < 0 ) { 161 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 162 exit( 1 ); 163 } // if 164 } else { 165 int status = do_wait( child ); 166 print_status( status ); 167 } // if 168 169 printf( "negative errors arg:\n" ); 170 if ( pid_t child = strict_fork(); child == 0 ) { 171 int ret = execle( path, "parsenums", "-u=-1", (const char*)0p, env ); 172 if ( ret < 0 ) { 173 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 174 exit( 1 ); 175 } // if 176 } else { 177 int status = do_wait( child ); 178 print_status( status ); 179 } // if 180 181 if ( pid_t child = strict_fork(); child == 0 ) { 182 int ret = execle( path, "parsenums", "-l=-1", (const char*)0p, env ); 183 if ( ret < 0 ) { 184 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 185 exit( 1 ); 186 } // if 187 } else { 188 int status = do_wait( child ); 189 print_status( status ); 190 } // if 191 192 if ( pid_t child = strict_fork(); child == 0 ) { 193 int ret = execle( path, "parsenums", "-L=-1", (const char*)0p, env ); 194 if ( ret < 0 ) { 195 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 196 exit( 1 ); 197 } // if 198 } else { 199 int status = do_wait( child ); 200 print_status( status ); 201 } // if 202 203 printf( "All Done!\n" ); 216 204 217 205 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.