test-args.c

Go to the documentation of this file.
00001 #include "config.h"
00002 
00003 #include "headers.h"
00004 #include "types.h"
00005 #include "error.h"
00006 #include "fd.h"
00007 #include "io.h"
00008 #include "display.h"
00009 #include "args.h"
00010 
00011 /*
00012 #define PRINT_DEBUG
00013 #define PRINT_ERRORS
00014 */
00015 
00016 #ifdef PRINT_DEBUG
00017 void print(void)
00018 {
00019         fprintf(stderr, "d.start_time == %llu\n", (unsigned long long)d.start_time);
00020         fprintf(stderr, "d.total_time == %llu\n", (unsigned long long)d.total_time);
00021         fprintf(stderr, "d.current_time == %llu\n", (unsigned long long)d.current_time);
00022         fprintf(stderr, "d.elapsed_time == %llu\n", (unsigned long long)d.elapsed_time);
00023         fprintf(stderr, "d.percent_complete == %d\n", (int)d.percent_complete);
00024         fprintf(stderr, "d.display_interval == %d\n", d.display_interval);
00025         fprintf(stderr, "d.overtime_flag == %d\n", d.overtime_flag);
00026         fprintf(stderr, "d.k == %d\n", d.k);
00027         fprintf(stderr, "d.twiddle == %d\n", d.twiddle);
00028         fprintf(stderr, "d.screen_width == %d\n", d.screen_width);
00029         fprintf(stderr, "d.manual_width == %d\n", d.manual_width);
00030         fprintf(stderr, "d.display_twiddle == %d\n", d.display_twiddle);
00031         fprintf(stderr, "d.display_datacount == %d\n", d.display_datacount);
00032         fprintf(stderr, "d.display_throughput == %d\n", d.display_throughput);
00033         fprintf(stderr, "d.display_time == %d\n", d.display_time);
00034         fprintf(stderr, "d.display_percent == %d\n", d.display_percent);
00035         fprintf(stderr, "d.display_bar == %d\n", d.display_bar);
00036         fprintf(stderr, "d.display_summary == %d\n", d.display_summary);
00037         fprintf(stderr, "d.display_ansi == %d\n", d.display_ansi);
00038 
00039         fprintf(stderr, "d.twiddle_fg_color == %s\n",
00040                 (d.twiddle_fg_color != 0) ? d.twiddle_fg_color+1 : "");
00041         fprintf(stderr, "d.twiddle_bg_color == %s\n",
00042                 (d.twiddle_bg_color != 0) ? d.twiddle_bg_color+1 : "");
00043         fprintf(stderr, "d.twiddle_fg_bold == %d\n", d.twiddle_fg_bold);
00044 
00045         fprintf(stderr, "d.datacount_fg_color == %s\n",
00046                 (d.datacount_fg_color != 0) ? d.datacount_fg_color+1 : "");
00047         fprintf(stderr, "d.datacount_bg_color == %s\n",
00048                 (d.datacount_bg_color != 0) ? d.datacount_bg_color+1 : "");
00049         fprintf(stderr, "d.datacount_fg_bold == %d\n", d.datacount_fg_bold);
00050 
00051         fprintf(stderr, "d.throughput_label_fg_color == %s\n",
00052                 (d.throughput_label_fg_color != 0) ? d.throughput_label_fg_color+1 : "");
00053         fprintf(stderr, "d.throughput_label_bg_color == %s\n",
00054                 (d.throughput_label_bg_color != 0) ? d.throughput_label_bg_color+1 : "");
00055         fprintf(stderr, "d.throughput_label_fg_bold == %d\n", d.throughput_label_fg_bold);
00056 
00057         fprintf(stderr, "d.throughput_fg_color == %s\n",
00058                 (d.throughput_fg_color != 0) ? d.throughput_fg_color+1 : "");
00059         fprintf(stderr, "d.throughput_bg_color == %s\n",
00060                 (d.throughput_bg_color != 0) ? d.throughput_bg_color+1 : "");
00061         fprintf(stderr, "d.throughput_fg_bold == %d\n", d.throughput_fg_bold);
00062 
00063         fprintf(stderr, "d.time_label_fg_color == %s\n",
00064                 (d.time_label_fg_color != 0) ? d.time_label_fg_color+1 : "");
00065         fprintf(stderr, "d.time_label_bg_color == %s\n",
00066                 (d.time_label_bg_color != 0) ? d.time_label_bg_color+1 : "");
00067         fprintf(stderr, "d.time_label_fg_bold == %d\n", d.time_label_fg_bold);
00068 
00069         fprintf(stderr, "d.time_fg_color == %s\n",
00070                 (d.time_fg_color != 0) ? d.time_fg_color+1 : "");
00071         fprintf(stderr, "d.time_bg_color == %s\n",
00072                 (d.time_bg_color != 0) ? d.time_bg_color+1 : "");
00073         fprintf(stderr, "d.time_fg_bold == %d\n", d.time_fg_bold);
00074 
00075         fprintf(stderr, "d.percent_fg_color == %s\n",
00076                 (d.percent_fg_color != 0) ? d.percent_fg_color+1 : "");
00077         fprintf(stderr, "d.percent_bg_color == %s\n",
00078                 (d.percent_bg_color != 0) ? d.percent_bg_color+1 : "");
00079         fprintf(stderr, "d.percent_fg_bold == %d\n", d.percent_fg_bold);
00080 
00081         fprintf(stderr, "d.barbrace_fg_color == %s\n",
00082                 (d.barbrace_fg_color != 0) ? d.barbrace_fg_color+1 : "");
00083         fprintf(stderr, "d.barbrace_bg_color == %s\n",
00084                 (d.barbrace_bg_color != 0) ? d.barbrace_bg_color+1 : "");
00085         fprintf(stderr, "d.barbrace_fg_bold == %d\n", d.barbrace_fg_bold);
00086 
00087         fprintf(stderr, "d.bar_fg_color == %s\n",
00088                 (d.bar_fg_color != 0) ? d.bar_fg_color+1 : "");
00089         fprintf(stderr, "d.bar_bg_color == %s\n",
00090                 (d.bar_bg_color != 0) ? d.bar_bg_color+1 : "");
00091         fprintf(stderr, "d.bar_fg_bold == %d\n", d.bar_fg_bold);
00092 
00093         fprintf(stderr, "io.in == %d\n", io.in);
00094         fprintf(stderr, "io.out == %d\n", io.out);
00095         fprintf(stderr, "io.in_ready == %d\n", io.in_ready);
00096         fprintf(stderr, "io.out_ready == %d\n", io.out_ready);
00097         fprintf(stderr, "io.eof_in == %d\n", io.eof_in);
00098         fprintf(stderr, "io.eof_out == %d\n", io.eof_out);
00099         fprintf(stderr, "io.buffer_size == %llu\n", (unsigned long long)io.buffer_size);
00100         /* fprintf(stderr, "io.cbuf == %p\n", io.cbuf); */
00101         fprintf(stderr, "io.last_read == %llu\n", (unsigned long long)io.last_read);
00102         fprintf(stderr, "io.last_write == %llu\n", (unsigned long long)io.last_write);
00103         fprintf(stderr, "io.total_read == %llu\n", (unsigned long long)io.total_read);
00104         fprintf(stderr, "io.total_write == %llu\n", (unsigned long long)io.total_write);
00105         fprintf(stderr, "io.total_size == %llu\n", (unsigned long long)io.total_size);
00106         fprintf(stderr, "io.total_size_known == %d\n", io.total_size_known);
00107         fprintf(stderr, "io.timeout == %llu\n", (unsigned long long)io.timeout);
00108 }
00109 #endif
00110 
00111 int test_parse(FILE *out, char* s, int r, uint64 n)
00112 {
00113         int result_r;
00114         uint64 result_n;
00115 
00116 #ifdef PRINT_ERRORS
00117         if (r != 0) {
00118                 fprintf(out, "\n");
00119                 fprintf(out, "You should see an error message here:\n");
00120                 fprintf(out, "---[ BEGIN ]-----------------------------------\n");
00121         }
00122 #endif
00123         result_r = parse_num(out, s, &result_n, 0, MAX_UINT64);
00124 #ifdef PRINT_ERRORS
00125         if (r != 0) {
00126                 fprintf(out, "---[ END ]-------------------------------------\n");
00127         }
00128 #endif
00129         if ((result_r != r) || (result_n != n)) {
00130 #ifdef PRINT_ERRORS
00131                 fprintf(out, "*** ERROR: Number parse test failed on: %s\n", s);
00132                 fprintf(out, "           Expected result: %d  Got: %d\n", r, result_r);
00133                 fprintf(out, "           Expected number: %llu\n", n);
00134                 fprintf(out, "                Got number: %llu\n", result_n);
00135 #endif
00136                 return(0);
00137         }
00138         return(1);
00139 }
00140 
00141 int test_parse_rc(FILE *out, int r)
00142 {
00143         int result_r = 0;
00144 
00145 #ifdef PRINT_ERRORS
00146         if (r != 0) {
00147                 fprintf(out, "\n");
00148                 fprintf(out, "You should see an error message here: \n");
00149                 fprintf(out, "---[ BEGIN ]-----------------------------------\n");
00150         }
00151 #endif
00152         result_r = parse_rcfile(out,"./test-rcfile.txt");
00153 #ifdef PRINT_ERRORS
00154         if (r != 0) {
00155                 fprintf(out, "---[ END ]-------------------------------------\n");
00156         }
00157 #endif
00158 
00159         return(r == result_r);
00160 }
00161 
00162 
00163 void test1(FILE *out)
00164 {
00165         uint64 k = 1000;
00166         uint64 m = k*k;
00167         uint64 e;
00168 
00169         displayInit();
00170         ioInit();
00171         d.k = k;
00172 
00173         assert(test_parse(out, "", 0, 0));
00174         assert(test_parse(out, "m", 1, 0));
00175         assert(test_parse(out, "1m1", 1, 0));
00176         assert(test_parse(out, ".m", 1, 0));
00177         assert(test_parse(out, ".0m", 0, 0));
00178         assert(test_parse(out, ".1m", 0, 0.1*m));
00179         assert(test_parse(out, ".10m", 0, 0.1*m));
00180         assert(test_parse(out, "1024.38m", 0, 1024.38*m));
00181         assert(test_parse(out, "1024.380m", 0, 1024.38*m));
00182         assert(test_parse(out, "1024.38002m", 0, 1024.38002*m));
00183 
00184         /*
00185          * The following workaround avoids the following compiler warning:
00186          * "warning: decimal constant is so large that it is unsigned" on
00187          * the number 18446744073709551615
00188          */
00189         e = 18;
00190         e *= 1000;
00191         e += 446;
00192         e *= 1000;
00193         e += 744;
00194         e *= 1000;
00195         e += 73;
00196         e *= 1000;
00197         e += 709;
00198         e *= 1000;
00199         e += 551;
00200         e *= 1000;
00201         e += 615;
00202         assert(test_parse(out, "18446744073709551615", 0, e));
00203 
00204         assert(test_parse(out, "18446744073709551616", 1, 0));
00205         assert(test_parse(out, "15.9999999999k", 0, 16000));
00206 
00207         /*
00208          * The following workaround avoids the following compiler warning:
00209          * "warning: decimal constant is so large that it is unsigned" on
00210          * the number 15999999999999999900
00211          */
00212         e = 15;
00213         e *= 1000;
00214         e += 999;
00215         e *= 1000;
00216         e += 999;
00217         e *= 1000;
00218         e += 999;
00219         e *= 1000;
00220         e += 999;
00221         e *= 1000;
00222         e += 999;
00223         e *= 1000;
00224         e += 900;
00225         assert(test_parse(out, "15.9999999999999999e", 0, e));
00226 
00227         /*
00228          * The following workaround avoids the following compiler warning:
00229          * "warning: decimal constant is so large that it is unsigned" on
00230          * the number 15999999999999999999
00231          */
00232         e = 15;
00233         e *= 1000;
00234         e += 999;
00235         e *= 1000;
00236         e += 999;
00237         e *= 1000;
00238         e += 999;
00239         e *= 1000;
00240         e += 999;
00241         e *= 1000;
00242         e += 999;
00243         e *= 1000;
00244         e += 999;
00245         assert(test_parse(out, "15.999999999999999999e", 0, e));
00246 
00247         assert(test_parse(out, "18.44674407370955161e", 0, MAX_UINT64/10*10));
00248 }
00249 
00250 void test2(FILE *out)
00251 {
00252         uint64 k = 1024;
00253         uint64 e;
00254 
00255         displayInit();
00256         ioInit();
00257         d.k = k;
00258 
00259         assert(test_parse(out, "", 0, 0));
00260         assert(test_parse(out, "m", 1, 0));
00261         assert(test_parse(out, "1m1", 1, 0));
00262         assert(test_parse(out, ".m", 1, 0));
00263         assert(test_parse(out, ".0m", 0, 0));
00264         assert(test_parse(out, ".1m", 0, 104858));
00265         assert(test_parse(out, ".10m", 0, 104858));
00266         assert(test_parse(out, "1024.38m", 0, 1074140283));
00267         assert(test_parse(out, "1024.380m", 0, 1074140283));
00268         assert(test_parse(out, "1024.38002m", 0, 1074140304));
00269 
00270         /*
00271          * The following workaround avoids the following compiler warning:
00272          * "warning: decimal constant is so large that it is unsigned" on
00273          * the number 18446744073709551615
00274          */
00275         e = 18;
00276         e *= 1000;
00277         e += 446;
00278         e *= 1000;
00279         e += 744;
00280         e *= 1000;
00281         e += 73;
00282         e *= 1000;
00283         e += 709;
00284         e *= 1000;
00285         e += 551;
00286         e *= 1000;
00287         e += 615;
00288         assert(test_parse(out, "18446744073709551615", 0, e));
00289         assert(test_parse(out, "18446744073709551616", 1, 0));
00290         assert(test_parse(out, "15.9999999999k", 0, 16384));
00291 
00292         /*
00293          * The following workaround avoids the following compiler warning:
00294          * "warning: decimal constant is so large that it is unsigned" on
00295          * the number 18446744073709551500
00296          */
00297         e = 18;
00298         e *= 1000;
00299         e += 446;
00300         e *= 1000;
00301         e += 744;
00302         e *= 1000;
00303         e += 73;
00304         e *= 1000;
00305         e += 709;
00306         e *= 1000;
00307         e += 551;
00308         e *= 1000;
00309         e += 500;
00310         assert(test_parse(out, "15.9999999999999999e", 0, e));
00311 
00312         /*
00313          * The following workaround avoids the following compiler warning:
00314          * "warning: decimal constant is so large that it is unsigned" on
00315          * the number 18446744073709551614
00316          */
00317         e = 18;
00318         e *= 1000;
00319         e += 446;
00320         e *= 1000;
00321         e += 744;
00322         e *= 1000;
00323         e += 73;
00324         e *= 1000;
00325         e += 709;
00326         e *= 1000;
00327         e += 551;
00328         e *= 1000;
00329         e += 614;
00330         assert(test_parse(out, "15.999999999999999999e", 0, e));
00331 
00332         /*
00333          * The following workaround avoids the following compiler warning:
00334          * "warning: decimal constant is so large that it is unsigned"
00335          */
00336         e = 18;
00337         e *= 1000;
00338         e += 446;
00339         e *= 1000;
00340         e += 744;
00341         e *= 1000;
00342         e += 73;
00343         e *= 1000;
00344         e += 709;
00345         e *= 1000;
00346         e += 551;
00347         e *= 1000;
00348         e += 614;
00349         assert(test_parse(out, "15.99999999999999999913e", 0, e));
00350 }
00351 
00352 void test3(FILE* out)
00353 {
00354         displayInit();
00355         ioInit();
00356 
00357 #ifdef PRINT_DEBUG
00358         print();
00359 #endif
00360         assert(d.start_time == 0);
00361         assert(d.total_time == 0);
00362         assert(d.current_time == 0);
00363         assert(d.elapsed_time == 0);
00364         assert(d.percent_complete == 0);
00365         assert(d.display_interval == 1);
00366         assert(d.overtime_flag == 0);
00367         assert(d.k == 1024);
00368         assert(d.twiddle == '-');
00369         assert(d.manual_width == 0);
00370         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
00371         assert(d.display_datacount == 1);
00372         assert(d.display_throughput == 1);
00373         assert(d.display_time == 1);
00374         assert(d.display_percent == 1);
00375         assert(d.display_bar == 1);
00376         assert(d.display_summary == 1);
00377         assert(d.display_ansi == 0);
00378         assert(d.twiddle_fg_color == 0);
00379         assert(d.twiddle_bg_color == 0);
00380         assert(d.twiddle_fg_bold == 0);
00381         assert(d.datacount_fg_color == 0);
00382         assert(d.datacount_bg_color == 0);
00383         assert(d.datacount_fg_bold == 0);
00384         assert(d.throughput_label_fg_color == 0);
00385         assert(d.throughput_label_bg_color == 0);
00386         assert(d.throughput_label_fg_bold == 0);
00387         assert(d.throughput_fg_color == 0);
00388         assert(d.throughput_bg_color == 0);
00389         assert(d.throughput_fg_bold == 0);
00390         assert(d.time_label_fg_color == 0);
00391         assert(d.time_label_bg_color == 0);
00392         assert(d.time_label_fg_bold == 0);
00393         assert(d.percent_fg_color == 0);
00394         assert(d.percent_bg_color == 0);
00395         assert(d.percent_fg_bold == 0);
00396         assert(d.barbrace_fg_color == 0);
00397         assert(d.barbrace_bg_color == 0);
00398         assert(d.barbrace_fg_bold == 0);
00399         assert(d.bar_fg_color == 0);
00400         assert(d.bar_bg_color == 0);
00401         assert(d.bar_fg_bold == 0);
00402         assert(io.in == 0);
00403         assert(io.out == 1);
00404         assert(io.in_ready == 0);
00405         assert(io.out_ready == 0);
00406         assert(io.eof_in == 0);
00407         assert(io.eof_out == 0);
00408         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
00409         /* assert(io.cbuf == 0x0); */
00410         assert(io.last_read == 0);
00411         assert(io.last_write == 0);
00412         assert(io.total_read == 0);
00413         assert(io.total_write == 0);
00414         assert(io.total_size == 0);
00415         assert(io.total_size_known == 0);
00416         assert(io.timeout == 250000);
00417 }
00418 
00419 void test4(FILE* out)
00420 {
00421         int argc = 0;
00422         char *argv[256] = { 0 };
00423 
00424         argv[argc++] = "ProgramName";
00425 
00426         displayInit();
00427         ioInit();
00428 
00429 #ifdef PRINT_DEBUG
00430         print();
00431 #endif
00432         assert(d.start_time == 0);
00433         assert(d.total_time == 0);
00434         assert(d.current_time == 0);
00435         assert(d.elapsed_time == 0);
00436         assert(d.percent_complete == 0);
00437         assert(d.display_interval == 1);
00438         assert(d.overtime_flag == 0);
00439         assert(d.k == 1024);
00440         assert(d.twiddle == '-');
00441         assert(d.manual_width == 0);
00442         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
00443         assert(d.display_datacount == 1);
00444         assert(d.display_throughput == 1);
00445         assert(d.display_time == 1);
00446         assert(d.display_percent == 1);
00447         assert(d.display_bar == 1);
00448         assert(d.display_summary == 1);
00449         assert(d.display_ansi == 0);
00450         assert(d.twiddle_fg_color == 0);
00451         assert(d.twiddle_bg_color == 0);
00452         assert(d.twiddle_fg_bold == 0);
00453         assert(d.datacount_fg_color == 0);
00454         assert(d.datacount_bg_color == 0);
00455         assert(d.datacount_fg_bold == 0);
00456         assert(d.throughput_label_fg_color == 0);
00457         assert(d.throughput_label_bg_color == 0);
00458         assert(d.throughput_label_fg_bold == 0);
00459         assert(d.throughput_fg_color == 0);
00460         assert(d.throughput_bg_color == 0);
00461         assert(d.throughput_fg_bold == 0);
00462         assert(d.time_label_fg_color == 0);
00463         assert(d.time_label_bg_color == 0);
00464         assert(d.time_label_fg_bold == 0);
00465         assert(d.percent_fg_color == 0);
00466         assert(d.percent_bg_color == 0);
00467         assert(d.percent_fg_bold == 0);
00468         assert(d.barbrace_fg_color == 0);
00469         assert(d.barbrace_bg_color == 0);
00470         assert(d.barbrace_fg_bold == 0);
00471         assert(d.bar_fg_color == 0);
00472         assert(d.bar_bg_color == 0);
00473         assert(d.bar_fg_bold == 0);
00474         assert(io.in == 0);
00475         assert(io.out == 1);
00476         assert(io.in_ready == 0);
00477         assert(io.out_ready == 0);
00478         assert(io.eof_in == 0);
00479         assert(io.eof_out == 0);
00480         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
00481         /* assert(io.cbuf == 0x0); */
00482         assert(io.last_read == 0);
00483         assert(io.last_write == 0);
00484         assert(io.total_read == 0);
00485         assert(io.total_write == 0);
00486         assert(io.total_size == 0);
00487         assert(io.total_size_known == 0);
00488         assert(io.timeout == 250000);
00489 
00490         assert(parse_args(out, argc, argv) == 0);
00491 
00492 #ifdef PRINT_DEBUG
00493         print();
00494 #endif
00495         assert(d.start_time == 0);
00496         assert(d.total_time == 0);
00497         assert(d.current_time == 0);
00498         assert(d.elapsed_time == 0);
00499         assert(d.percent_complete == 0);
00500         assert(d.display_interval == 1);
00501         assert(d.overtime_flag == 0);
00502         assert(d.k == 1024);
00503         assert(d.twiddle == '-');
00504         assert(d.manual_width == 0);
00505         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
00506         assert(d.display_datacount == 1);
00507         assert(d.display_throughput == 1);
00508         assert(d.display_time == 1);
00509         assert(d.display_percent == 1);
00510         assert(d.display_bar == 1);
00511         assert(d.display_summary == 1);
00512         assert(d.display_ansi == 0);
00513         assert(d.twiddle_fg_color == 0);
00514         assert(d.twiddle_bg_color == 0);
00515         assert(d.twiddle_fg_bold == 0);
00516         assert(d.datacount_fg_color == 0);
00517         assert(d.datacount_bg_color == 0);
00518         assert(d.datacount_fg_bold == 0);
00519         assert(d.throughput_label_fg_color == 0);
00520         assert(d.throughput_label_bg_color == 0);
00521         assert(d.throughput_label_fg_bold == 0);
00522         assert(d.throughput_fg_color == 0);
00523         assert(d.throughput_bg_color == 0);
00524         assert(d.throughput_fg_bold == 0);
00525         assert(d.time_label_fg_color == 0);
00526         assert(d.time_label_bg_color == 0);
00527         assert(d.time_label_fg_bold == 0);
00528         assert(d.percent_fg_color == 0);
00529         assert(d.percent_bg_color == 0);
00530         assert(d.percent_fg_bold == 0);
00531         assert(d.barbrace_fg_color == 0);
00532         assert(d.barbrace_bg_color == 0);
00533         assert(d.barbrace_fg_bold == 0);
00534         assert(d.bar_fg_color == 0);
00535         assert(d.bar_bg_color == 0);
00536         assert(d.bar_fg_bold == 0);
00537         assert(io.in == 0);
00538         assert(io.out == 1);
00539         assert(io.in_ready == 0);
00540         assert(io.out_ready == 0);
00541         assert(io.eof_in == 0);
00542         assert(io.eof_out == 0);
00543         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
00544         /* assert(io.cbuf == 0x0); */
00545         assert(io.last_read == 0);
00546         assert(io.last_write == 0);
00547         assert(io.total_read == 0);
00548         assert(io.total_write == 0);
00549         assert(io.total_size == 0);
00550         assert(io.total_size_known == 0);
00551         assert(io.timeout == 250000);
00552 }
00553 
00554 void test5(FILE* out)
00555 {
00556         int argc = 0;
00557         char *argv[256] = { 0 };
00558 
00559         argv[argc++] = "ProgramName";
00560         argv[argc++] = "-if";
00561 
00562         displayInit();
00563         ioInit();
00564 
00565 #ifdef PRINT_DEBUG
00566         print();
00567 #endif
00568         assert(d.start_time == 0);
00569         assert(d.total_time == 0);
00570         assert(d.current_time == 0);
00571         assert(d.elapsed_time == 0);
00572         assert(d.percent_complete == 0);
00573         assert(d.display_interval == 1);
00574         assert(d.overtime_flag == 0);
00575         assert(d.k == 1024);
00576         assert(d.twiddle == '-');
00577         assert(d.manual_width == 0);
00578         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
00579         assert(d.display_datacount == 1);
00580         assert(d.display_throughput == 1);
00581         assert(d.display_time == 1);
00582         assert(d.display_percent == 1);
00583         assert(d.display_bar == 1);
00584         assert(d.display_summary == 1);
00585         assert(d.display_ansi == 0);
00586         assert(d.twiddle_fg_color == 0);
00587         assert(d.twiddle_bg_color == 0);
00588         assert(d.twiddle_fg_bold == 0);
00589         assert(d.datacount_fg_color == 0);
00590         assert(d.datacount_bg_color == 0);
00591         assert(d.datacount_fg_bold == 0);
00592         assert(d.throughput_label_fg_color == 0);
00593         assert(d.throughput_label_bg_color == 0);
00594         assert(d.throughput_label_fg_bold == 0);
00595         assert(d.throughput_fg_color == 0);
00596         assert(d.throughput_bg_color == 0);
00597         assert(d.throughput_fg_bold == 0);
00598         assert(d.time_label_fg_color == 0);
00599         assert(d.time_label_bg_color == 0);
00600         assert(d.time_label_fg_bold == 0);
00601         assert(d.percent_fg_color == 0);
00602         assert(d.percent_bg_color == 0);
00603         assert(d.percent_fg_bold == 0);
00604         assert(d.barbrace_fg_color == 0);
00605         assert(d.barbrace_bg_color == 0);
00606         assert(d.barbrace_fg_bold == 0);
00607         assert(d.bar_fg_color == 0);
00608         assert(d.bar_bg_color == 0);
00609         assert(d.bar_fg_bold == 0);
00610         assert(io.in == 0);
00611         assert(io.out == 1);
00612         assert(io.in_ready == 0);
00613         assert(io.out_ready == 0);
00614         assert(io.eof_in == 0);
00615         assert(io.eof_out == 0);
00616         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
00617         /* assert(io.cbuf == 0x0); */
00618         assert(io.last_read == 0);
00619         assert(io.last_write == 0);
00620         assert(io.total_read == 0);
00621         assert(io.total_write == 0);
00622         assert(io.total_size == 0);
00623         assert(io.total_size_known == 0);
00624         assert(io.timeout == 250000);
00625 
00626         assert(parse_args(out, argc, argv) == 1);
00627 
00628 #ifdef PRINT_DEBUG
00629         print();
00630 #endif
00631         assert(d.start_time == 0);
00632         assert(d.total_time == 0);
00633         assert(d.current_time == 0);
00634         assert(d.elapsed_time == 0);
00635         assert(d.percent_complete == 0);
00636         assert(d.display_interval == 1);
00637         assert(d.overtime_flag == 0);
00638         assert(d.k == 1024);
00639         assert(d.twiddle == '-');
00640         assert(d.manual_width == 0);
00641         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
00642         assert(d.display_datacount == 1);
00643         assert(d.display_throughput == 1);
00644         assert(d.display_time == 1);
00645         assert(d.display_percent == 1);
00646         assert(d.display_bar == 1);
00647         assert(d.display_summary == 1);
00648         assert(d.display_ansi == 0);
00649         assert(d.twiddle_fg_color == 0);
00650         assert(d.twiddle_bg_color == 0);
00651         assert(d.twiddle_fg_bold == 0);
00652         assert(d.datacount_fg_color == 0);
00653         assert(d.datacount_bg_color == 0);
00654         assert(d.datacount_fg_bold == 0);
00655         assert(d.throughput_label_fg_color == 0);
00656         assert(d.throughput_label_bg_color == 0);
00657         assert(d.throughput_label_fg_bold == 0);
00658         assert(d.throughput_fg_color == 0);
00659         assert(d.throughput_bg_color == 0);
00660         assert(d.throughput_fg_bold == 0);
00661         assert(d.time_label_fg_color == 0);
00662         assert(d.time_label_bg_color == 0);
00663         assert(d.time_label_fg_bold == 0);
00664         assert(d.percent_fg_color == 0);
00665         assert(d.percent_bg_color == 0);
00666         assert(d.percent_fg_bold == 0);
00667         assert(d.barbrace_fg_color == 0);
00668         assert(d.barbrace_bg_color == 0);
00669         assert(d.barbrace_fg_bold == 0);
00670         assert(d.bar_fg_color == 0);
00671         assert(d.bar_bg_color == 0);
00672         assert(d.bar_fg_bold == 0);
00673         assert(io.in == 0);
00674         assert(io.out == 1);
00675         assert(io.in_ready == 0);
00676         assert(io.out_ready == 0);
00677         assert(io.eof_in == 0);
00678         assert(io.eof_out == 0);
00679         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
00680         /* assert(io.cbuf == 0x0); */
00681         assert(io.last_read == 0);
00682         assert(io.last_write == 0);
00683         assert(io.total_read == 0);
00684         assert(io.total_write == 0);
00685         assert(io.total_size == 0);
00686         assert(io.total_size_known == 0);
00687         assert(io.timeout == 250000);
00688 }
00689 
00690 void test6(FILE* out)
00691 {
00692         int argc = 0;
00693         char *argv[256] = { 0 };
00694 
00695         argv[argc++] = "ProgramName";
00696         argv[argc++] = "/dev/null";
00697 
00698         displayInit();
00699         ioInit();
00700 
00701 #ifdef PRINT_DEBUG
00702         print();
00703 #endif
00704         assert(d.start_time == 0);
00705         assert(d.total_time == 0);
00706         assert(d.current_time == 0);
00707         assert(d.elapsed_time == 0);
00708         assert(d.percent_complete == 0);
00709         assert(d.display_interval == 1);
00710         assert(d.overtime_flag == 0);
00711         assert(d.k == 1024);
00712         assert(d.twiddle == '-');
00713         assert(d.manual_width == 0);
00714         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
00715         assert(d.display_datacount == 1);
00716         assert(d.display_throughput == 1);
00717         assert(d.display_time == 1);
00718         assert(d.display_percent == 1);
00719         assert(d.display_bar == 1);
00720         assert(d.display_summary == 1);
00721         assert(d.display_ansi == 0);
00722         assert(d.twiddle_fg_color == 0);
00723         assert(d.twiddle_bg_color == 0);
00724         assert(d.twiddle_fg_bold == 0);
00725         assert(d.datacount_fg_color == 0);
00726         assert(d.datacount_bg_color == 0);
00727         assert(d.datacount_fg_bold == 0);
00728         assert(d.throughput_label_fg_color == 0);
00729         assert(d.throughput_label_bg_color == 0);
00730         assert(d.throughput_label_fg_bold == 0);
00731         assert(d.throughput_fg_color == 0);
00732         assert(d.throughput_bg_color == 0);
00733         assert(d.throughput_fg_bold == 0);
00734         assert(d.time_label_fg_color == 0);
00735         assert(d.time_label_bg_color == 0);
00736         assert(d.time_label_fg_bold == 0);
00737         assert(d.percent_fg_color == 0);
00738         assert(d.percent_bg_color == 0);
00739         assert(d.percent_fg_bold == 0);
00740         assert(d.barbrace_fg_color == 0);
00741         assert(d.barbrace_bg_color == 0);
00742         assert(d.barbrace_fg_bold == 0);
00743         assert(d.bar_fg_color == 0);
00744         assert(d.bar_bg_color == 0);
00745         assert(d.bar_fg_bold == 0);
00746         assert(io.in == 0);
00747         assert(io.out == 1);
00748         assert(io.in_ready == 0);
00749         assert(io.out_ready == 0);
00750         assert(io.eof_in == 0);
00751         assert(io.eof_out == 0);
00752         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
00753         /* assert(io.cbuf == 0x0); */
00754         assert(io.last_read == 0);
00755         assert(io.last_write == 0);
00756         assert(io.total_read == 0);
00757         assert(io.total_write == 0);
00758         assert(io.total_size == 0);
00759         assert(io.total_size_known == 0);
00760         assert(io.timeout == 250000);
00761 
00762         assert(parse_args(out, argc, argv) == 1);
00763 
00764 #ifdef PRINT_DEBUG
00765         print();
00766 #endif
00767         assert(d.start_time == 0);
00768         assert(d.total_time == 0);
00769         assert(d.current_time == 0);
00770         assert(d.elapsed_time == 0);
00771         assert(d.percent_complete == 0);
00772         assert(d.display_interval == 1);
00773         assert(d.overtime_flag == 0);
00774         assert(d.k == 1024);
00775         assert(d.twiddle == '-');
00776         assert(d.manual_width == 0);
00777         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
00778         assert(d.display_datacount == 1);
00779         assert(d.display_throughput == 1);
00780         assert(d.display_time == 1);
00781         assert(d.display_percent == 1);
00782         assert(d.display_bar == 1);
00783         assert(d.display_summary == 1);
00784         assert(d.display_ansi == 0);
00785         assert(d.twiddle_fg_color == 0);
00786         assert(d.twiddle_bg_color == 0);
00787         assert(d.twiddle_fg_bold == 0);
00788         assert(d.datacount_fg_color == 0);
00789         assert(d.datacount_bg_color == 0);
00790         assert(d.datacount_fg_bold == 0);
00791         assert(d.throughput_label_fg_color == 0);
00792         assert(d.throughput_label_bg_color == 0);
00793         assert(d.throughput_label_fg_bold == 0);
00794         assert(d.throughput_fg_color == 0);
00795         assert(d.throughput_bg_color == 0);
00796         assert(d.throughput_fg_bold == 0);
00797         assert(d.time_label_fg_color == 0);
00798         assert(d.time_label_bg_color == 0);
00799         assert(d.time_label_fg_bold == 0);
00800         assert(d.percent_fg_color == 0);
00801         assert(d.percent_bg_color == 0);
00802         assert(d.percent_fg_bold == 0);
00803         assert(d.barbrace_fg_color == 0);
00804         assert(d.barbrace_bg_color == 0);
00805         assert(d.barbrace_fg_bold == 0);
00806         assert(d.bar_fg_color == 0);
00807         assert(d.bar_bg_color == 0);
00808         assert(d.bar_fg_bold == 0);
00809         assert(io.in == 0);
00810         assert(io.out == 1);
00811         assert(io.in_ready == 0);
00812         assert(io.out_ready == 0);
00813         assert(io.eof_in == 0);
00814         assert(io.eof_out == 0);
00815         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
00816         /* assert(io.cbuf == 0x0); */
00817         assert(io.last_read == 0);
00818         assert(io.last_write == 0);
00819         assert(io.total_read == 0);
00820         assert(io.total_write == 0);
00821         assert(io.total_size == 0);
00822         assert(io.total_size_known == 0);
00823         assert(io.timeout == 250000);
00824 }
00825 
00826 void test7(FILE* out)
00827 {
00828         int argc = 0;
00829         char *argv[256] = { 0 };
00830 
00831         argv[argc++] = "ProgramName";
00832         argv[argc++] = "-if";
00833         argv[argc++] = "/dev/null";
00834 
00835         displayInit();
00836         ioInit();
00837 
00838 #ifdef PRINT_DEBUG
00839         print();
00840 #endif
00841         assert(d.start_time == 0);
00842         assert(d.total_time == 0);
00843         assert(d.current_time == 0);
00844         assert(d.elapsed_time == 0);
00845         assert(d.percent_complete == 0);
00846         assert(d.display_interval == 1);
00847         assert(d.overtime_flag == 0);
00848         assert(d.k == 1024);
00849         assert(d.twiddle == '-');
00850         assert(d.manual_width == 0);
00851         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
00852         assert(d.display_datacount == 1);
00853         assert(d.display_throughput == 1);
00854         assert(d.display_time == 1);
00855         assert(d.display_percent == 1);
00856         assert(d.display_bar == 1);
00857         assert(d.display_summary == 1);
00858         assert(d.display_ansi == 0);
00859         assert(d.twiddle_fg_color == 0);
00860         assert(d.twiddle_bg_color == 0);
00861         assert(d.twiddle_fg_bold == 0);
00862         assert(d.datacount_fg_color == 0);
00863         assert(d.datacount_bg_color == 0);
00864         assert(d.datacount_fg_bold == 0);
00865         assert(d.throughput_label_fg_color == 0);
00866         assert(d.throughput_label_bg_color == 0);
00867         assert(d.throughput_label_fg_bold == 0);
00868         assert(d.throughput_fg_color == 0);
00869         assert(d.throughput_bg_color == 0);
00870         assert(d.throughput_fg_bold == 0);
00871         assert(d.time_label_fg_color == 0);
00872         assert(d.time_label_bg_color == 0);
00873         assert(d.time_label_fg_bold == 0);
00874         assert(d.percent_fg_color == 0);
00875         assert(d.percent_bg_color == 0);
00876         assert(d.percent_fg_bold == 0);
00877         assert(d.barbrace_fg_color == 0);
00878         assert(d.barbrace_bg_color == 0);
00879         assert(d.barbrace_fg_bold == 0);
00880         assert(d.bar_fg_color == 0);
00881         assert(d.bar_bg_color == 0);
00882         assert(d.bar_fg_bold == 0);
00883         assert(io.in == 0);
00884         assert(io.out == 1);
00885         assert(io.in_ready == 0);
00886         assert(io.out_ready == 0);
00887         assert(io.eof_in == 0);
00888         assert(io.eof_out == 0);
00889         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
00890         /* assert(io.cbuf == 0x0); */
00891         assert(io.last_read == 0);
00892         assert(io.last_write == 0);
00893         assert(io.total_read == 0);
00894         assert(io.total_write == 0);
00895         assert(io.total_size == 0);
00896         assert(io.total_size_known == 0);
00897         assert(io.timeout == 250000);
00898 
00899         assert(parse_args(out, argc, argv) == 0);
00900 
00901 #ifdef PRINT_DEBUG
00902         print();
00903 #endif
00904         assert(d.start_time == 0);
00905         assert(d.total_time == 0);
00906         assert(d.current_time == 0);
00907         assert(d.elapsed_time == 0);
00908         assert(d.percent_complete == 0);
00909         assert(d.display_interval == 1);
00910         assert(d.overtime_flag == 0);
00911         assert(d.k == 1024);
00912         assert(d.twiddle == '-');
00913         assert(d.manual_width == 0);
00914         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
00915         assert(d.display_datacount == 1);
00916         assert(d.display_throughput == 1);
00917         assert(d.display_time == 1);
00918         assert(d.display_percent == 1);
00919         assert(d.display_bar == 1);
00920         assert(d.display_summary == 1);
00921         assert(io.in != 0);
00922         assert(io.out == 1);
00923         assert(io.in_ready == 0);
00924         assert(io.out_ready == 0);
00925         assert(io.eof_in == 0);
00926         assert(io.eof_out == 0);
00927         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
00928         /* assert(io.cbuf == 0x0); */
00929         assert(io.last_read == 0);
00930         assert(io.last_write == 0);
00931         assert(io.total_read == 0);
00932         assert(io.total_write == 0);
00933         assert(io.total_size == 0);
00934         assert(io.total_size_known == 0);
00935         assert(io.timeout == 250000);
00936 }
00937 
00938 void test8(FILE* out)
00939 {
00940         int argc = 0;
00941         char *argv[256] = { 0 };
00942 
00943         argv[argc++] = "ProgramName";
00944         argv[argc++] = "-of";
00945 
00946         displayInit();
00947         ioInit();
00948 
00949 #ifdef PRINT_DEBUG
00950         print();
00951 #endif
00952         assert(d.start_time == 0);
00953         assert(d.total_time == 0);
00954         assert(d.current_time == 0);
00955         assert(d.elapsed_time == 0);
00956         assert(d.percent_complete == 0);
00957         assert(d.display_interval == 1);
00958         assert(d.overtime_flag == 0);
00959         assert(d.k == 1024);
00960         assert(d.twiddle == '-');
00961         assert(d.manual_width == 0);
00962         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
00963         assert(d.display_datacount == 1);
00964         assert(d.display_throughput == 1);
00965         assert(d.display_time == 1);
00966         assert(d.display_percent == 1);
00967         assert(d.display_bar == 1);
00968         assert(d.display_summary == 1);
00969         assert(d.display_ansi == 0);
00970         assert(d.twiddle_fg_color == 0);
00971         assert(d.twiddle_bg_color == 0);
00972         assert(d.twiddle_fg_bold == 0);
00973         assert(d.datacount_fg_color == 0);
00974         assert(d.datacount_bg_color == 0);
00975         assert(d.datacount_fg_bold == 0);
00976         assert(d.throughput_label_fg_color == 0);
00977         assert(d.throughput_label_bg_color == 0);
00978         assert(d.throughput_label_fg_bold == 0);
00979         assert(d.throughput_fg_color == 0);
00980         assert(d.throughput_bg_color == 0);
00981         assert(d.throughput_fg_bold == 0);
00982         assert(d.time_label_fg_color == 0);
00983         assert(d.time_label_bg_color == 0);
00984         assert(d.time_label_fg_bold == 0);
00985         assert(d.percent_fg_color == 0);
00986         assert(d.percent_bg_color == 0);
00987         assert(d.percent_fg_bold == 0);
00988         assert(d.barbrace_fg_color == 0);
00989         assert(d.barbrace_bg_color == 0);
00990         assert(d.barbrace_fg_bold == 0);
00991         assert(d.bar_fg_color == 0);
00992         assert(d.bar_bg_color == 0);
00993         assert(d.bar_fg_bold == 0);
00994         assert(io.in == 0);
00995         assert(io.out == 1);
00996         assert(io.in_ready == 0);
00997         assert(io.out_ready == 0);
00998         assert(io.eof_in == 0);
00999         assert(io.eof_out == 0);
01000         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01001         /* assert(io.cbuf == 0x0); */
01002         assert(io.last_read == 0);
01003         assert(io.last_write == 0);
01004         assert(io.total_read == 0);
01005         assert(io.total_write == 0);
01006         assert(io.total_size == 0);
01007         assert(io.total_size_known == 0);
01008         assert(io.timeout == 250000);
01009 
01010         assert(parse_args(out, argc, argv) == 1);
01011 
01012 #ifdef PRINT_DEBUG
01013         print();
01014 #endif
01015         assert(d.start_time == 0);
01016         assert(d.total_time == 0);
01017         assert(d.current_time == 0);
01018         assert(d.elapsed_time == 0);
01019         assert(d.percent_complete == 0);
01020         assert(d.display_interval == 1);
01021         assert(d.overtime_flag == 0);
01022         assert(d.k == 1024);
01023         assert(d.twiddle == '-');
01024         assert(d.manual_width == 0);
01025         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01026         assert(d.display_datacount == 1);
01027         assert(d.display_throughput == 1);
01028         assert(d.display_time == 1);
01029         assert(d.display_percent == 1);
01030         assert(d.display_bar == 1);
01031         assert(d.display_summary == 1);
01032         assert(d.display_ansi == 0);
01033         assert(d.twiddle_fg_color == 0);
01034         assert(d.twiddle_bg_color == 0);
01035         assert(d.twiddle_fg_bold == 0);
01036         assert(d.datacount_fg_color == 0);
01037         assert(d.datacount_bg_color == 0);
01038         assert(d.datacount_fg_bold == 0);
01039         assert(d.throughput_label_fg_color == 0);
01040         assert(d.throughput_label_bg_color == 0);
01041         assert(d.throughput_label_fg_bold == 0);
01042         assert(d.throughput_fg_color == 0);
01043         assert(d.throughput_bg_color == 0);
01044         assert(d.throughput_fg_bold == 0);
01045         assert(d.time_label_fg_color == 0);
01046         assert(d.time_label_bg_color == 0);
01047         assert(d.time_label_fg_bold == 0);
01048         assert(d.percent_fg_color == 0);
01049         assert(d.percent_bg_color == 0);
01050         assert(d.percent_fg_bold == 0);
01051         assert(d.barbrace_fg_color == 0);
01052         assert(d.barbrace_bg_color == 0);
01053         assert(d.barbrace_fg_bold == 0);
01054         assert(d.bar_fg_color == 0);
01055         assert(d.bar_bg_color == 0);
01056         assert(d.bar_fg_bold == 0);
01057         assert(io.in == 0);
01058         assert(io.out == 1);
01059         assert(io.in_ready == 0);
01060         assert(io.out_ready == 0);
01061         assert(io.eof_in == 0);
01062         assert(io.eof_out == 0);
01063         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01064         /* assert(io.cbuf == 0x0); */
01065         assert(io.last_read == 0);
01066         assert(io.last_write == 0);
01067         assert(io.total_read == 0);
01068         assert(io.total_write == 0);
01069         assert(io.total_size == 0);
01070         assert(io.total_size_known == 0);
01071         assert(io.timeout == 250000);
01072 }
01073 
01074 void test9(FILE* out)
01075 {
01076         int argc = 0;
01077         char *argv[256] = { 0 };
01078 
01079         argv[argc++] = "ProgramName";
01080         argv[argc++] = "-of";
01081         argv[argc++] = "/dev/null";
01082 
01083         displayInit();
01084         ioInit();
01085 
01086 #ifdef PRINT_DEBUG
01087         print();
01088 #endif
01089         assert(d.start_time == 0);
01090         assert(d.total_time == 0);
01091         assert(d.current_time == 0);
01092         assert(d.elapsed_time == 0);
01093         assert(d.percent_complete == 0);
01094         assert(d.display_interval == 1);
01095         assert(d.overtime_flag == 0);
01096         assert(d.k == 1024);
01097         assert(d.twiddle == '-');
01098         assert(d.manual_width == 0);
01099         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01100         assert(d.display_datacount == 1);
01101         assert(d.display_throughput == 1);
01102         assert(d.display_time == 1);
01103         assert(d.display_percent == 1);
01104         assert(d.display_bar == 1);
01105         assert(d.display_summary == 1);
01106         assert(d.display_ansi == 0);
01107         assert(d.twiddle_fg_color == 0);
01108         assert(d.twiddle_bg_color == 0);
01109         assert(d.twiddle_fg_bold == 0);
01110         assert(d.datacount_fg_color == 0);
01111         assert(d.datacount_bg_color == 0);
01112         assert(d.datacount_fg_bold == 0);
01113         assert(d.throughput_label_fg_color == 0);
01114         assert(d.throughput_label_bg_color == 0);
01115         assert(d.throughput_label_fg_bold == 0);
01116         assert(d.throughput_fg_color == 0);
01117         assert(d.throughput_bg_color == 0);
01118         assert(d.throughput_fg_bold == 0);
01119         assert(d.time_label_fg_color == 0);
01120         assert(d.time_label_bg_color == 0);
01121         assert(d.time_label_fg_bold == 0);
01122         assert(d.percent_fg_color == 0);
01123         assert(d.percent_bg_color == 0);
01124         assert(d.percent_fg_bold == 0);
01125         assert(d.barbrace_fg_color == 0);
01126         assert(d.barbrace_bg_color == 0);
01127         assert(d.barbrace_fg_bold == 0);
01128         assert(d.bar_fg_color == 0);
01129         assert(d.bar_bg_color == 0);
01130         assert(d.bar_fg_bold == 0);
01131         assert(io.in == 0);
01132         assert(io.out == 1);
01133         assert(io.in_ready == 0);
01134         assert(io.out_ready == 0);
01135         assert(io.eof_in == 0);
01136         assert(io.eof_out == 0);
01137         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01138         /* assert(io.cbuf == 0x0); */
01139         assert(io.last_read == 0);
01140         assert(io.last_write == 0);
01141         assert(io.total_read == 0);
01142         assert(io.total_write == 0);
01143         assert(io.total_size == 0);
01144         assert(io.total_size_known == 0);
01145         assert(io.timeout == 250000);
01146 
01147         assert(parse_args(out, argc, argv) == 0);
01148 
01149 #ifdef PRINT_DEBUG
01150         print();
01151 #endif
01152         assert(d.start_time == 0);
01153         assert(d.total_time == 0);
01154         assert(d.current_time == 0);
01155         assert(d.elapsed_time == 0);
01156         assert(d.percent_complete == 0);
01157         assert(d.display_interval == 1);
01158         assert(d.overtime_flag == 0);
01159         assert(d.k == 1024);
01160         assert(d.twiddle == '-');
01161         assert(d.manual_width == 0);
01162         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01163         assert(d.display_datacount == 1);
01164         assert(d.display_throughput == 1);
01165         assert(d.display_time == 1);
01166         assert(d.display_percent == 1);
01167         assert(d.display_bar == 1);
01168         assert(d.display_summary == 1);
01169         assert(d.display_ansi == 0);
01170         assert(d.twiddle_fg_color == 0);
01171         assert(d.twiddle_bg_color == 0);
01172         assert(d.twiddle_fg_bold == 0);
01173         assert(d.datacount_fg_color == 0);
01174         assert(d.datacount_bg_color == 0);
01175         assert(d.datacount_fg_bold == 0);
01176         assert(d.throughput_label_fg_color == 0);
01177         assert(d.throughput_label_bg_color == 0);
01178         assert(d.throughput_label_fg_bold == 0);
01179         assert(d.throughput_fg_color == 0);
01180         assert(d.throughput_bg_color == 0);
01181         assert(d.throughput_fg_bold == 0);
01182         assert(d.time_label_fg_color == 0);
01183         assert(d.time_label_bg_color == 0);
01184         assert(d.time_label_fg_bold == 0);
01185         assert(d.percent_fg_color == 0);
01186         assert(d.percent_bg_color == 0);
01187         assert(d.percent_fg_bold == 0);
01188         assert(d.barbrace_fg_color == 0);
01189         assert(d.barbrace_bg_color == 0);
01190         assert(d.barbrace_fg_bold == 0);
01191         assert(d.bar_fg_color == 0);
01192         assert(d.bar_bg_color == 0);
01193         assert(d.bar_fg_bold == 0);
01194         assert(io.in == 0);
01195         assert(io.out != 1);
01196         assert(io.in_ready == 0);
01197         assert(io.out_ready == 0);
01198         assert(io.eof_in == 0);
01199         assert(io.eof_out == 0);
01200         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01201         /* assert(io.cbuf == 0x0); */
01202         assert(io.last_read == 0);
01203         assert(io.last_write == 0);
01204         assert(io.total_read == 0);
01205         assert(io.total_write == 0);
01206         assert(io.total_size == 0);
01207         assert(io.total_size_known == 0);
01208         assert(io.timeout == 250000);
01209 }
01210 
01211 void test10(FILE* out)
01212 {
01213         int argc = 0;
01214         char *argv[256] = { 0 };
01215 
01216         argv[argc++] = "ProgramName";
01217         argv[argc++] = "-s";
01218 
01219         displayInit();
01220         ioInit();
01221 
01222 #ifdef PRINT_DEBUG
01223         print();
01224 #endif
01225         assert(d.start_time == 0);
01226         assert(d.total_time == 0);
01227         assert(d.current_time == 0);
01228         assert(d.elapsed_time == 0);
01229         assert(d.percent_complete == 0);
01230         assert(d.display_interval == 1);
01231         assert(d.overtime_flag == 0);
01232         assert(d.k == 1024);
01233         assert(d.twiddle == '-');
01234         assert(d.manual_width == 0);
01235         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01236         assert(d.display_datacount == 1);
01237         assert(d.display_throughput == 1);
01238         assert(d.display_time == 1);
01239         assert(d.display_percent == 1);
01240         assert(d.display_bar == 1);
01241         assert(d.display_summary == 1);
01242         assert(d.display_ansi == 0);
01243         assert(d.twiddle_fg_color == 0);
01244         assert(d.twiddle_bg_color == 0);
01245         assert(d.twiddle_fg_bold == 0);
01246         assert(d.datacount_fg_color == 0);
01247         assert(d.datacount_bg_color == 0);
01248         assert(d.datacount_fg_bold == 0);
01249         assert(d.throughput_label_fg_color == 0);
01250         assert(d.throughput_label_bg_color == 0);
01251         assert(d.throughput_label_fg_bold == 0);
01252         assert(d.throughput_fg_color == 0);
01253         assert(d.throughput_bg_color == 0);
01254         assert(d.throughput_fg_bold == 0);
01255         assert(d.time_label_fg_color == 0);
01256         assert(d.time_label_bg_color == 0);
01257         assert(d.time_label_fg_bold == 0);
01258         assert(d.percent_fg_color == 0);
01259         assert(d.percent_bg_color == 0);
01260         assert(d.percent_fg_bold == 0);
01261         assert(d.barbrace_fg_color == 0);
01262         assert(d.barbrace_bg_color == 0);
01263         assert(d.barbrace_fg_bold == 0);
01264         assert(d.bar_fg_color == 0);
01265         assert(d.bar_bg_color == 0);
01266         assert(d.bar_fg_bold == 0);
01267         assert(io.in == 0);
01268         assert(io.out == 1);
01269         assert(io.in_ready == 0);
01270         assert(io.out_ready == 0);
01271         assert(io.eof_in == 0);
01272         assert(io.eof_out == 0);
01273         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01274         /* assert(io.cbuf == 0x0); */
01275         assert(io.last_read == 0);
01276         assert(io.last_write == 0);
01277         assert(io.total_read == 0);
01278         assert(io.total_write == 0);
01279         assert(io.total_size == 0);
01280         assert(io.total_size_known == 0);
01281         assert(io.timeout == 250000);
01282 
01283         assert(parse_args(out, argc, argv) == 1);
01284 
01285 #ifdef PRINT_DEBUG
01286         print();
01287 #endif
01288         assert(d.start_time == 0);
01289         assert(d.total_time == 0);
01290         assert(d.current_time == 0);
01291         assert(d.elapsed_time == 0);
01292         assert(d.percent_complete == 0);
01293         assert(d.display_interval == 1);
01294         assert(d.overtime_flag == 0);
01295         assert(d.k == 1024);
01296         assert(d.twiddle == '-');
01297         assert(d.manual_width == 0);
01298         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01299         assert(d.display_datacount == 1);
01300         assert(d.display_throughput == 1);
01301         assert(d.display_time == 1);
01302         assert(d.display_percent == 1);
01303         assert(d.display_bar == 1);
01304         assert(d.display_summary == 1);
01305         assert(d.display_ansi == 0);
01306         assert(d.twiddle_fg_color == 0);
01307         assert(d.twiddle_bg_color == 0);
01308         assert(d.twiddle_fg_bold == 0);
01309         assert(d.datacount_fg_color == 0);
01310         assert(d.datacount_bg_color == 0);
01311         assert(d.datacount_fg_bold == 0);
01312         assert(d.throughput_label_fg_color == 0);
01313         assert(d.throughput_label_bg_color == 0);
01314         assert(d.throughput_label_fg_bold == 0);
01315         assert(d.throughput_fg_color == 0);
01316         assert(d.throughput_bg_color == 0);
01317         assert(d.throughput_fg_bold == 0);
01318         assert(d.time_label_fg_color == 0);
01319         assert(d.time_label_bg_color == 0);
01320         assert(d.time_label_fg_bold == 0);
01321         assert(d.percent_fg_color == 0);
01322         assert(d.percent_bg_color == 0);
01323         assert(d.percent_fg_bold == 0);
01324         assert(d.barbrace_fg_color == 0);
01325         assert(d.barbrace_bg_color == 0);
01326         assert(d.barbrace_fg_bold == 0);
01327         assert(d.bar_fg_color == 0);
01328         assert(d.bar_bg_color == 0);
01329         assert(d.bar_fg_bold == 0);
01330         assert(io.in == 0);
01331         assert(io.out == 1);
01332         assert(io.in_ready == 0);
01333         assert(io.out_ready == 0);
01334         assert(io.eof_in == 0);
01335         assert(io.eof_out == 0);
01336         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01337         /* assert(io.cbuf == 0x0); */
01338         assert(io.last_read == 0);
01339         assert(io.last_write == 0);
01340         assert(io.total_read == 0);
01341         assert(io.total_write == 0);
01342         assert(io.total_size == 0);
01343         assert(io.total_size_known == 0);
01344         assert(io.timeout == 250000);
01345 }
01346 
01347 void test11(FILE* out)
01348 {
01349         int argc = 0;
01350         char *argv[256] = { 0 };
01351 
01352         argv[argc++] = "ProgramName";
01353         argv[argc++] = "-s";
01354         argv[argc++] = "/dev/null";
01355 
01356         displayInit();
01357         ioInit();
01358 
01359 #ifdef PRINT_DEBUG
01360         print();
01361 #endif
01362         assert(d.start_time == 0);
01363         assert(d.total_time == 0);
01364         assert(d.current_time == 0);
01365         assert(d.elapsed_time == 0);
01366         assert(d.percent_complete == 0);
01367         assert(d.display_interval == 1);
01368         assert(d.overtime_flag == 0);
01369         assert(d.k == 1024);
01370         assert(d.twiddle == '-');
01371         assert(d.manual_width == 0);
01372         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01373         assert(d.display_datacount == 1);
01374         assert(d.display_throughput == 1);
01375         assert(d.display_time == 1);
01376         assert(d.display_percent == 1);
01377         assert(d.display_bar == 1);
01378         assert(d.display_summary == 1);
01379         assert(d.display_ansi == 0);
01380         assert(d.twiddle_fg_color == 0);
01381         assert(d.twiddle_bg_color == 0);
01382         assert(d.twiddle_fg_bold == 0);
01383         assert(d.datacount_fg_color == 0);
01384         assert(d.datacount_bg_color == 0);
01385         assert(d.datacount_fg_bold == 0);
01386         assert(d.throughput_label_fg_color == 0);
01387         assert(d.throughput_label_bg_color == 0);
01388         assert(d.throughput_label_fg_bold == 0);
01389         assert(d.throughput_fg_color == 0);
01390         assert(d.throughput_bg_color == 0);
01391         assert(d.throughput_fg_bold == 0);
01392         assert(d.time_label_fg_color == 0);
01393         assert(d.time_label_bg_color == 0);
01394         assert(d.time_label_fg_bold == 0);
01395         assert(d.percent_fg_color == 0);
01396         assert(d.percent_bg_color == 0);
01397         assert(d.percent_fg_bold == 0);
01398         assert(d.barbrace_fg_color == 0);
01399         assert(d.barbrace_bg_color == 0);
01400         assert(d.barbrace_fg_bold == 0);
01401         assert(d.bar_fg_color == 0);
01402         assert(d.bar_bg_color == 0);
01403         assert(d.bar_fg_bold == 0);
01404         assert(io.in == 0);
01405         assert(io.out == 1);
01406         assert(io.in_ready == 0);
01407         assert(io.out_ready == 0);
01408         assert(io.eof_in == 0);
01409         assert(io.eof_out == 0);
01410         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01411         /* assert(io.cbuf == 0x0); */
01412         assert(io.last_read == 0);
01413         assert(io.last_write == 0);
01414         assert(io.total_read == 0);
01415         assert(io.total_write == 0);
01416         assert(io.total_size == 0);
01417         assert(io.total_size_known == 0);
01418         assert(io.timeout == 250000);
01419 
01420         assert(parse_args(out, argc, argv) == 0);
01421 
01422 #ifdef PRINT_DEBUG
01423         print();
01424 #endif
01425         assert(d.start_time == 0);
01426         assert(d.total_time == 0);
01427         assert(d.current_time == 0);
01428         assert(d.elapsed_time == 0);
01429         assert(d.percent_complete == 0);
01430         assert(d.display_interval == 1);
01431         assert(d.overtime_flag == 0);
01432         assert(d.k == 1024);
01433         assert(d.twiddle == '-');
01434         assert(d.manual_width == 0);
01435         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01436         assert(d.display_datacount == 1);
01437         assert(d.display_throughput == 1);
01438         assert(d.display_time == 1);
01439         assert(d.display_percent == 1);
01440         assert(d.display_bar == 1);
01441         assert(d.display_summary == 1);
01442         assert(d.display_ansi == 0);
01443         assert(d.twiddle_fg_color == 0);
01444         assert(d.twiddle_bg_color == 0);
01445         assert(d.twiddle_fg_bold == 0);
01446         assert(d.datacount_fg_color == 0);
01447         assert(d.datacount_bg_color == 0);
01448         assert(d.datacount_fg_bold == 0);
01449         assert(d.throughput_label_fg_color == 0);
01450         assert(d.throughput_label_bg_color == 0);
01451         assert(d.throughput_label_fg_bold == 0);
01452         assert(d.throughput_fg_color == 0);
01453         assert(d.throughput_bg_color == 0);
01454         assert(d.throughput_fg_bold == 0);
01455         assert(d.time_label_fg_color == 0);
01456         assert(d.time_label_bg_color == 0);
01457         assert(d.time_label_fg_bold == 0);
01458         assert(d.percent_fg_color == 0);
01459         assert(d.percent_bg_color == 0);
01460         assert(d.percent_fg_bold == 0);
01461         assert(d.barbrace_fg_color == 0);
01462         assert(d.barbrace_bg_color == 0);
01463         assert(d.barbrace_fg_bold == 0);
01464         assert(d.bar_fg_color == 0);
01465         assert(d.bar_bg_color == 0);
01466         assert(d.bar_fg_bold == 0);
01467         assert(io.in == 0);
01468         assert(io.out == 1);
01469         assert(io.in_ready == 0);
01470         assert(io.out_ready == 0);
01471         assert(io.eof_in == 0);
01472         assert(io.eof_out == 0);
01473         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01474         /* assert(io.cbuf == 0x0); */
01475         assert(io.last_read == 0);
01476         assert(io.last_write == 0);
01477         assert(io.total_read == 0);
01478         assert(io.total_write == 0);
01479         assert(io.total_size == 0);
01480         assert(io.total_size_known == 0);
01481         assert(io.timeout == 250000);
01482 }
01483 
01484 void test12(FILE* out)
01485 {
01486         int argc = 0;
01487         char *argv[256] = { 0 };
01488 
01489         argv[argc++] = "ProgramName";
01490         argv[argc++] = "-s";
01491         argv[argc++] = "1024.38002m";
01492 
01493         displayInit();
01494         ioInit();
01495 
01496 #ifdef PRINT_DEBUG
01497         print();
01498 #endif
01499         assert(d.start_time == 0);
01500         assert(d.total_time == 0);
01501         assert(d.current_time == 0);
01502         assert(d.elapsed_time == 0);
01503         assert(d.percent_complete == 0);
01504         assert(d.display_interval == 1);
01505         assert(d.overtime_flag == 0);
01506         assert(d.k == 1024);
01507         assert(d.twiddle == '-');
01508         assert(d.manual_width == 0);
01509         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01510         assert(d.display_datacount == 1);
01511         assert(d.display_throughput == 1);
01512         assert(d.display_time == 1);
01513         assert(d.display_percent == 1);
01514         assert(d.display_bar == 1);
01515         assert(d.display_summary == 1);
01516         assert(d.display_ansi == 0);
01517         assert(d.twiddle_fg_color == 0);
01518         assert(d.twiddle_bg_color == 0);
01519         assert(d.twiddle_fg_bold == 0);
01520         assert(d.datacount_fg_color == 0);
01521         assert(d.datacount_bg_color == 0);
01522         assert(d.datacount_fg_bold == 0);
01523         assert(d.throughput_label_fg_color == 0);
01524         assert(d.throughput_label_bg_color == 0);
01525         assert(d.throughput_label_fg_bold == 0);
01526         assert(d.throughput_fg_color == 0);
01527         assert(d.throughput_bg_color == 0);
01528         assert(d.throughput_fg_bold == 0);
01529         assert(d.time_label_fg_color == 0);
01530         assert(d.time_label_bg_color == 0);
01531         assert(d.time_label_fg_bold == 0);
01532         assert(d.percent_fg_color == 0);
01533         assert(d.percent_bg_color == 0);
01534         assert(d.percent_fg_bold == 0);
01535         assert(d.barbrace_fg_color == 0);
01536         assert(d.barbrace_bg_color == 0);
01537         assert(d.barbrace_fg_bold == 0);
01538         assert(d.bar_fg_color == 0);
01539         assert(d.bar_bg_color == 0);
01540         assert(d.bar_fg_bold == 0);
01541         assert(io.in == 0);
01542         assert(io.out == 1);
01543         assert(io.in_ready == 0);
01544         assert(io.out_ready == 0);
01545         assert(io.eof_in == 0);
01546         assert(io.eof_out == 0);
01547         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01548         /* assert(io.cbuf == 0x0); */
01549         assert(io.last_read == 0);
01550         assert(io.last_write == 0);
01551         assert(io.total_read == 0);
01552         assert(io.total_write == 0);
01553         assert(io.total_size == 0);
01554         assert(io.total_size_known == 0);
01555         assert(io.timeout == 250000);
01556 
01557         assert(parse_args(out, argc, argv) == 0);
01558 
01559 #ifdef PRINT_DEBUG
01560         print();
01561 #endif
01562         assert(d.start_time == 0);
01563         assert(d.total_time == 0);
01564         assert(d.current_time == 0);
01565         assert(d.elapsed_time == 0);
01566         assert(d.percent_complete == 0);
01567         assert(d.display_interval == 1);
01568         assert(d.overtime_flag == 0);
01569         assert(d.k == 1024);
01570         assert(d.twiddle == '-');
01571         assert(d.manual_width == 0);
01572         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01573         assert(d.display_datacount == 1);
01574         assert(d.display_throughput == 1);
01575         assert(d.display_time == 1);
01576         assert(d.display_percent == 1);
01577         assert(d.display_bar == 1);
01578         assert(d.display_summary == 1);
01579         assert(d.display_ansi == 0);
01580         assert(d.twiddle_fg_color == 0);
01581         assert(d.twiddle_bg_color == 0);
01582         assert(d.twiddle_fg_bold == 0);
01583         assert(d.datacount_fg_color == 0);
01584         assert(d.datacount_bg_color == 0);
01585         assert(d.datacount_fg_bold == 0);
01586         assert(d.throughput_label_fg_color == 0);
01587         assert(d.throughput_label_bg_color == 0);
01588         assert(d.throughput_label_fg_bold == 0);
01589         assert(d.throughput_fg_color == 0);
01590         assert(d.throughput_bg_color == 0);
01591         assert(d.throughput_fg_bold == 0);
01592         assert(d.time_label_fg_color == 0);
01593         assert(d.time_label_bg_color == 0);
01594         assert(d.time_label_fg_bold == 0);
01595         assert(d.percent_fg_color == 0);
01596         assert(d.percent_bg_color == 0);
01597         assert(d.percent_fg_bold == 0);
01598         assert(d.barbrace_fg_color == 0);
01599         assert(d.barbrace_bg_color == 0);
01600         assert(d.barbrace_fg_bold == 0);
01601         assert(d.bar_fg_color == 0);
01602         assert(d.bar_bg_color == 0);
01603         assert(d.bar_fg_bold == 0);
01604         assert(io.in == 0);
01605         assert(io.out == 1);
01606         assert(io.in_ready == 0);
01607         assert(io.out_ready == 0);
01608         assert(io.eof_in == 0);
01609         assert(io.eof_out == 0);
01610         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01611         /* assert(io.cbuf == 0x0); */
01612         assert(io.last_read == 0);
01613         assert(io.last_write == 0);
01614         assert(io.total_read == 0);
01615         assert(io.total_write == 0);
01616         assert(io.total_size == 1074140304);
01617         assert(io.total_size_known == 1);
01618         assert(io.timeout == 250000);
01619 }
01620 
01621 void test13(FILE* out)
01622 {
01623         int argc = 0;
01624         char *argv[256] = { 0 };
01625 
01626         argv[argc++] = "ProgramName";
01627         argv[argc++] = "-bs";
01628 
01629         displayInit();
01630         ioInit();
01631 
01632 #ifdef PRINT_DEBUG
01633         print();
01634 #endif
01635         assert(d.start_time == 0);
01636         assert(d.total_time == 0);
01637         assert(d.current_time == 0);
01638         assert(d.elapsed_time == 0);
01639         assert(d.percent_complete == 0);
01640         assert(d.display_interval == 1);
01641         assert(d.overtime_flag == 0);
01642         assert(d.k == 1024);
01643         assert(d.twiddle == '-');
01644         assert(d.manual_width == 0);
01645         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01646         assert(d.display_datacount == 1);
01647         assert(d.display_throughput == 1);
01648         assert(d.display_time == 1);
01649         assert(d.display_percent == 1);
01650         assert(d.display_bar == 1);
01651         assert(d.display_summary == 1);
01652         assert(d.display_ansi == 0);
01653         assert(d.twiddle_fg_color == 0);
01654         assert(d.twiddle_bg_color == 0);
01655         assert(d.twiddle_fg_bold == 0);
01656         assert(d.datacount_fg_color == 0);
01657         assert(d.datacount_bg_color == 0);
01658         assert(d.datacount_fg_bold == 0);
01659         assert(d.throughput_label_fg_color == 0);
01660         assert(d.throughput_label_bg_color == 0);
01661         assert(d.throughput_label_fg_bold == 0);
01662         assert(d.throughput_fg_color == 0);
01663         assert(d.throughput_bg_color == 0);
01664         assert(d.throughput_fg_bold == 0);
01665         assert(d.time_label_fg_color == 0);
01666         assert(d.time_label_bg_color == 0);
01667         assert(d.time_label_fg_bold == 0);
01668         assert(d.percent_fg_color == 0);
01669         assert(d.percent_bg_color == 0);
01670         assert(d.percent_fg_bold == 0);
01671         assert(d.barbrace_fg_color == 0);
01672         assert(d.barbrace_bg_color == 0);
01673         assert(d.barbrace_fg_bold == 0);
01674         assert(d.bar_fg_color == 0);
01675         assert(d.bar_bg_color == 0);
01676         assert(d.bar_fg_bold == 0);
01677         assert(io.in == 0);
01678         assert(io.out == 1);
01679         assert(io.in_ready == 0);
01680         assert(io.out_ready == 0);
01681         assert(io.eof_in == 0);
01682         assert(io.eof_out == 0);
01683         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01684         /* assert(io.cbuf == 0x0); */
01685         assert(io.last_read == 0);
01686         assert(io.last_write == 0);
01687         assert(io.total_read == 0);
01688         assert(io.total_write == 0);
01689         assert(io.total_size == 0);
01690         assert(io.total_size_known == 0);
01691         assert(io.timeout == 250000);
01692 
01693         assert(parse_args(out, argc, argv) == 1);
01694 
01695 #ifdef PRINT_DEBUG
01696         print();
01697 #endif
01698         assert(d.start_time == 0);
01699         assert(d.total_time == 0);
01700         assert(d.current_time == 0);
01701         assert(d.elapsed_time == 0);
01702         assert(d.percent_complete == 0);
01703         assert(d.display_interval == 1);
01704         assert(d.overtime_flag == 0);
01705         assert(d.k == 1024);
01706         assert(d.twiddle == '-');
01707         assert(d.manual_width == 0);
01708         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01709         assert(d.display_datacount == 1);
01710         assert(d.display_throughput == 1);
01711         assert(d.display_time == 1);
01712         assert(d.display_percent == 1);
01713         assert(d.display_bar == 1);
01714         assert(d.display_summary == 1);
01715         assert(d.display_ansi == 0);
01716         assert(d.twiddle_fg_color == 0);
01717         assert(d.twiddle_bg_color == 0);
01718         assert(d.twiddle_fg_bold == 0);
01719         assert(d.datacount_fg_color == 0);
01720         assert(d.datacount_bg_color == 0);
01721         assert(d.datacount_fg_bold == 0);
01722         assert(d.throughput_label_fg_color == 0);
01723         assert(d.throughput_label_bg_color == 0);
01724         assert(d.throughput_label_fg_bold == 0);
01725         assert(d.throughput_fg_color == 0);
01726         assert(d.throughput_bg_color == 0);
01727         assert(d.throughput_fg_bold == 0);
01728         assert(d.time_label_fg_color == 0);
01729         assert(d.time_label_bg_color == 0);
01730         assert(d.time_label_fg_bold == 0);
01731         assert(d.percent_fg_color == 0);
01732         assert(d.percent_bg_color == 0);
01733         assert(d.percent_fg_bold == 0);
01734         assert(d.barbrace_fg_color == 0);
01735         assert(d.barbrace_bg_color == 0);
01736         assert(d.barbrace_fg_bold == 0);
01737         assert(d.bar_fg_color == 0);
01738         assert(d.bar_bg_color == 0);
01739         assert(d.bar_fg_bold == 0);
01740         assert(io.in == 0);
01741         assert(io.out == 1);
01742         assert(io.in_ready == 0);
01743         assert(io.out_ready == 0);
01744         assert(io.eof_in == 0);
01745         assert(io.eof_out == 0);
01746         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01747         /* assert(io.cbuf == 0x0); */
01748         assert(io.last_read == 0);
01749         assert(io.last_write == 0);
01750         assert(io.total_read == 0);
01751         assert(io.total_write == 0);
01752         assert(io.total_size == 0);
01753         assert(io.total_size_known == 0);
01754         assert(io.timeout == 250000);
01755 }
01756 
01757 void test14(FILE* out)
01758 {
01759         int argc = 0;
01760         char *argv[256] = { 0 };
01761 
01762         argv[argc++] = "ProgramName";
01763         argv[argc++] = "-bs";
01764         argv[argc++] = "/dev/null";
01765 
01766         displayInit();
01767         ioInit();
01768 
01769 #ifdef PRINT_DEBUG
01770         print();
01771 #endif
01772         assert(d.start_time == 0);
01773         assert(d.total_time == 0);
01774         assert(d.current_time == 0);
01775         assert(d.elapsed_time == 0);
01776         assert(d.percent_complete == 0);
01777         assert(d.display_interval == 1);
01778         assert(d.overtime_flag == 0);
01779         assert(d.k == 1024);
01780         assert(d.twiddle == '-');
01781         assert(d.manual_width == 0);
01782         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01783         assert(d.display_datacount == 1);
01784         assert(d.display_throughput == 1);
01785         assert(d.display_time == 1);
01786         assert(d.display_percent == 1);
01787         assert(d.display_bar == 1);
01788         assert(d.display_summary == 1);
01789         assert(d.display_ansi == 0);
01790         assert(d.twiddle_fg_color == 0);
01791         assert(d.twiddle_bg_color == 0);
01792         assert(d.twiddle_fg_bold == 0);
01793         assert(d.datacount_fg_color == 0);
01794         assert(d.datacount_bg_color == 0);
01795         assert(d.datacount_fg_bold == 0);
01796         assert(d.throughput_label_fg_color == 0);
01797         assert(d.throughput_label_bg_color == 0);
01798         assert(d.throughput_label_fg_bold == 0);
01799         assert(d.throughput_fg_color == 0);
01800         assert(d.throughput_bg_color == 0);
01801         assert(d.throughput_fg_bold == 0);
01802         assert(d.time_label_fg_color == 0);
01803         assert(d.time_label_bg_color == 0);
01804         assert(d.time_label_fg_bold == 0);
01805         assert(d.percent_fg_color == 0);
01806         assert(d.percent_bg_color == 0);
01807         assert(d.percent_fg_bold == 0);
01808         assert(d.barbrace_fg_color == 0);
01809         assert(d.barbrace_bg_color == 0);
01810         assert(d.barbrace_fg_bold == 0);
01811         assert(d.bar_fg_color == 0);
01812         assert(d.bar_bg_color == 0);
01813         assert(d.bar_fg_bold == 0);
01814         assert(io.in == 0);
01815         assert(io.out == 1);
01816         assert(io.in_ready == 0);
01817         assert(io.out_ready == 0);
01818         assert(io.eof_in == 0);
01819         assert(io.eof_out == 0);
01820         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01821         /* assert(io.cbuf == 0x0); */
01822         assert(io.last_read == 0);
01823         assert(io.last_write == 0);
01824         assert(io.total_read == 0);
01825         assert(io.total_write == 0);
01826         assert(io.total_size == 0);
01827         assert(io.total_size_known == 0);
01828         assert(io.timeout == 250000);
01829 
01830         assert(parse_args(out, argc, argv) == 0);
01831 
01832 #ifdef PRINT_DEBUG
01833         print();
01834 #endif
01835         assert(d.start_time == 0);
01836         assert(d.total_time == 0);
01837         assert(d.current_time == 0);
01838         assert(d.elapsed_time == 0);
01839         assert(d.percent_complete == 0);
01840         assert(d.display_interval == 1);
01841         assert(d.overtime_flag == 0);
01842         assert(d.k == 1024);
01843         assert(d.twiddle == '-');
01844         assert(d.manual_width == 0);
01845         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01846         assert(d.display_datacount == 1);
01847         assert(d.display_throughput == 1);
01848         assert(d.display_time == 1);
01849         assert(d.display_percent == 1);
01850         assert(d.display_bar == 1);
01851         assert(d.display_summary == 1);
01852         assert(d.display_ansi == 0);
01853         assert(d.twiddle_fg_color == 0);
01854         assert(d.twiddle_bg_color == 0);
01855         assert(d.twiddle_fg_bold == 0);
01856         assert(d.datacount_fg_color == 0);
01857         assert(d.datacount_bg_color == 0);
01858         assert(d.datacount_fg_bold == 0);
01859         assert(d.throughput_label_fg_color == 0);
01860         assert(d.throughput_label_bg_color == 0);
01861         assert(d.throughput_label_fg_bold == 0);
01862         assert(d.throughput_fg_color == 0);
01863         assert(d.throughput_bg_color == 0);
01864         assert(d.throughput_fg_bold == 0);
01865         assert(d.time_label_fg_color == 0);
01866         assert(d.time_label_bg_color == 0);
01867         assert(d.time_label_fg_bold == 0);
01868         assert(d.percent_fg_color == 0);
01869         assert(d.percent_bg_color == 0);
01870         assert(d.percent_fg_bold == 0);
01871         assert(d.barbrace_fg_color == 0);
01872         assert(d.barbrace_bg_color == 0);
01873         assert(d.barbrace_fg_bold == 0);
01874         assert(d.bar_fg_color == 0);
01875         assert(d.bar_bg_color == 0);
01876         assert(d.bar_fg_bold == 0);
01877         assert(io.in == 0);
01878         assert(io.out == 1);
01879         assert(io.in_ready == 0);
01880         assert(io.out_ready == 0);
01881         assert(io.eof_in == 0);
01882         assert(io.eof_out == 0);
01883         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01884         /* assert(io.cbuf == 0x0); */
01885         assert(io.last_read == 0);
01886         assert(io.last_write == 0);
01887         assert(io.total_read == 0);
01888         assert(io.total_write == 0);
01889         assert(io.total_size == 0);
01890         assert(io.total_size_known == 0);
01891         assert(io.timeout == 250000);
01892 }
01893 
01894 void test15(FILE* out)
01895 {
01896         int argc = 0;
01897         char *argv[256] = { 0 };
01898 
01899         argv[argc++] = "ProgramName";
01900         argv[argc++] = "-bs";
01901         argv[argc++] = "1024.38002m";
01902 
01903         displayInit();
01904         ioInit();
01905 
01906 #ifdef PRINT_DEBUG
01907         print();
01908 #endif
01909         assert(d.start_time == 0);
01910         assert(d.total_time == 0);
01911         assert(d.current_time == 0);
01912         assert(d.elapsed_time == 0);
01913         assert(d.percent_complete == 0);
01914         assert(d.display_interval == 1);
01915         assert(d.overtime_flag == 0);
01916         assert(d.k == 1024);
01917         assert(d.twiddle == '-');
01918         assert(d.manual_width == 0);
01919         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01920         assert(d.display_datacount == 1);
01921         assert(d.display_throughput == 1);
01922         assert(d.display_time == 1);
01923         assert(d.display_percent == 1);
01924         assert(d.display_bar == 1);
01925         assert(d.display_summary == 1);
01926         assert(d.display_ansi == 0);
01927         assert(d.twiddle_fg_color == 0);
01928         assert(d.twiddle_bg_color == 0);
01929         assert(d.twiddle_fg_bold == 0);
01930         assert(d.datacount_fg_color == 0);
01931         assert(d.datacount_bg_color == 0);
01932         assert(d.datacount_fg_bold == 0);
01933         assert(d.throughput_label_fg_color == 0);
01934         assert(d.throughput_label_bg_color == 0);
01935         assert(d.throughput_label_fg_bold == 0);
01936         assert(d.throughput_fg_color == 0);
01937         assert(d.throughput_bg_color == 0);
01938         assert(d.throughput_fg_bold == 0);
01939         assert(d.time_label_fg_color == 0);
01940         assert(d.time_label_bg_color == 0);
01941         assert(d.time_label_fg_bold == 0);
01942         assert(d.percent_fg_color == 0);
01943         assert(d.percent_bg_color == 0);
01944         assert(d.percent_fg_bold == 0);
01945         assert(d.barbrace_fg_color == 0);
01946         assert(d.barbrace_bg_color == 0);
01947         assert(d.barbrace_fg_bold == 0);
01948         assert(d.bar_fg_color == 0);
01949         assert(d.bar_bg_color == 0);
01950         assert(d.bar_fg_bold == 0);
01951         assert(io.in == 0);
01952         assert(io.out == 1);
01953         assert(io.in_ready == 0);
01954         assert(io.out_ready == 0);
01955         assert(io.eof_in == 0);
01956         assert(io.eof_out == 0);
01957         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
01958         /* assert(io.cbuf == 0x0); */
01959         assert(io.last_read == 0);
01960         assert(io.last_write == 0);
01961         assert(io.total_read == 0);
01962         assert(io.total_write == 0);
01963         assert(io.total_size == 0);
01964         assert(io.total_size_known == 0);
01965         assert(io.timeout == 250000);
01966 
01967         assert(parse_args(out, argc, argv) == 0);
01968 
01969 #ifdef PRINT_DEBUG
01970         print();
01971 #endif
01972         assert(d.start_time == 0);
01973         assert(d.total_time == 0);
01974         assert(d.current_time == 0);
01975         assert(d.elapsed_time == 0);
01976         assert(d.percent_complete == 0);
01977         assert(d.display_interval == 1);
01978         assert(d.overtime_flag == 0);
01979         assert(d.k == 1024);
01980         assert(d.twiddle == '-');
01981         assert(d.manual_width == 0);
01982         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
01983         assert(d.display_datacount == 1);
01984         assert(d.display_throughput == 1);
01985         assert(d.display_time == 1);
01986         assert(d.display_percent == 1);
01987         assert(d.display_bar == 1);
01988         assert(d.display_summary == 1);
01989         assert(d.display_ansi == 0);
01990         assert(d.twiddle_fg_color == 0);
01991         assert(d.twiddle_bg_color == 0);
01992         assert(d.twiddle_fg_bold == 0);
01993         assert(d.datacount_fg_color == 0);
01994         assert(d.datacount_bg_color == 0);
01995         assert(d.datacount_fg_bold == 0);
01996         assert(d.throughput_label_fg_color == 0);
01997         assert(d.throughput_label_bg_color == 0);
01998         assert(d.throughput_label_fg_bold == 0);
01999         assert(d.throughput_fg_color == 0);
02000         assert(d.throughput_bg_color == 0);
02001         assert(d.throughput_fg_bold == 0);
02002         assert(d.time_label_fg_color == 0);
02003         assert(d.time_label_bg_color == 0);
02004         assert(d.time_label_fg_bold == 0);
02005         assert(d.percent_fg_color == 0);
02006         assert(d.percent_bg_color == 0);
02007         assert(d.percent_fg_bold == 0);
02008         assert(d.barbrace_fg_color == 0);
02009         assert(d.barbrace_bg_color == 0);
02010         assert(d.barbrace_fg_bold == 0);
02011         assert(d.bar_fg_color == 0);
02012         assert(d.bar_bg_color == 0);
02013         assert(d.bar_fg_bold == 0);
02014         assert(io.in == 0);
02015         assert(io.out == 1);
02016         assert(io.in_ready == 0);
02017         assert(io.out_ready == 0);
02018         assert(io.eof_in == 0);
02019         assert(io.eof_out == 0);
02020         assert(io.buffer_size == 1074140304);
02021         /* assert(io.cbuf == 0x0); */
02022         assert(io.last_read == 0);
02023         assert(io.last_write == 0);
02024         assert(io.total_read == 0);
02025         assert(io.total_write == 0);
02026         assert(io.total_size == 0);
02027         assert(io.total_size_known == 0);
02028         assert(io.timeout == 250000);
02029 }
02030 
02031 void test16(FILE* out)
02032 {
02033         int argc = 0;
02034         char *argv[256] = { 0 };
02035 
02036         argv[argc++] = "ProgramName";
02037         argv[argc++] = "-i";
02038 
02039         displayInit();
02040         ioInit();
02041 
02042 #ifdef PRINT_DEBUG
02043         print();
02044 #endif
02045         assert(d.start_time == 0);
02046         assert(d.total_time == 0);
02047         assert(d.current_time == 0);
02048         assert(d.elapsed_time == 0);
02049         assert(d.percent_complete == 0);
02050         assert(d.display_interval == 1);
02051         assert(d.overtime_flag == 0);
02052         assert(d.k == 1024);
02053         assert(d.twiddle == '-');
02054         assert(d.manual_width == 0);
02055         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02056         assert(d.display_datacount == 1);
02057         assert(d.display_throughput == 1);
02058         assert(d.display_time == 1);
02059         assert(d.display_percent == 1);
02060         assert(d.display_bar == 1);
02061         assert(d.display_summary == 1);
02062         assert(d.display_ansi == 0);
02063         assert(d.twiddle_fg_color == 0);
02064         assert(d.twiddle_bg_color == 0);
02065         assert(d.twiddle_fg_bold == 0);
02066         assert(d.datacount_fg_color == 0);
02067         assert(d.datacount_bg_color == 0);
02068         assert(d.datacount_fg_bold == 0);
02069         assert(d.throughput_label_fg_color == 0);
02070         assert(d.throughput_label_bg_color == 0);
02071         assert(d.throughput_label_fg_bold == 0);
02072         assert(d.throughput_fg_color == 0);
02073         assert(d.throughput_bg_color == 0);
02074         assert(d.throughput_fg_bold == 0);
02075         assert(d.time_label_fg_color == 0);
02076         assert(d.time_label_bg_color == 0);
02077         assert(d.time_label_fg_bold == 0);
02078         assert(d.percent_fg_color == 0);
02079         assert(d.percent_bg_color == 0);
02080         assert(d.percent_fg_bold == 0);
02081         assert(d.barbrace_fg_color == 0);
02082         assert(d.barbrace_bg_color == 0);
02083         assert(d.barbrace_fg_bold == 0);
02084         assert(d.bar_fg_color == 0);
02085         assert(d.bar_bg_color == 0);
02086         assert(d.bar_fg_bold == 0);
02087         assert(io.in == 0);
02088         assert(io.out == 1);
02089         assert(io.in_ready == 0);
02090         assert(io.out_ready == 0);
02091         assert(io.eof_in == 0);
02092         assert(io.eof_out == 0);
02093         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02094         /* assert(io.cbuf == 0x0); */
02095         assert(io.last_read == 0);
02096         assert(io.last_write == 0);
02097         assert(io.total_read == 0);
02098         assert(io.total_write == 0);
02099         assert(io.total_size == 0);
02100         assert(io.total_size_known == 0);
02101         assert(io.timeout == 250000);
02102 
02103         assert(parse_args(out, argc, argv) == 1);
02104 
02105 #ifdef PRINT_DEBUG
02106         print();
02107 #endif
02108         assert(d.start_time == 0);
02109         assert(d.total_time == 0);
02110         assert(d.current_time == 0);
02111         assert(d.elapsed_time == 0);
02112         assert(d.percent_complete == 0);
02113         assert(d.display_interval == 1);
02114         assert(d.overtime_flag == 0);
02115         assert(d.k == 1024);
02116         assert(d.twiddle == '-');
02117         assert(d.manual_width == 0);
02118         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02119         assert(d.display_datacount == 1);
02120         assert(d.display_throughput == 1);
02121         assert(d.display_time == 1);
02122         assert(d.display_percent == 1);
02123         assert(d.display_bar == 1);
02124         assert(d.display_summary == 1);
02125         assert(d.display_ansi == 0);
02126         assert(d.twiddle_fg_color == 0);
02127         assert(d.twiddle_bg_color == 0);
02128         assert(d.twiddle_fg_bold == 0);
02129         assert(d.datacount_fg_color == 0);
02130         assert(d.datacount_bg_color == 0);
02131         assert(d.datacount_fg_bold == 0);
02132         assert(d.throughput_label_fg_color == 0);
02133         assert(d.throughput_label_bg_color == 0);
02134         assert(d.throughput_label_fg_bold == 0);
02135         assert(d.throughput_fg_color == 0);
02136         assert(d.throughput_bg_color == 0);
02137         assert(d.throughput_fg_bold == 0);
02138         assert(d.time_label_fg_color == 0);
02139         assert(d.time_label_bg_color == 0);
02140         assert(d.time_label_fg_bold == 0);
02141         assert(d.percent_fg_color == 0);
02142         assert(d.percent_bg_color == 0);
02143         assert(d.percent_fg_bold == 0);
02144         assert(d.barbrace_fg_color == 0);
02145         assert(d.barbrace_bg_color == 0);
02146         assert(d.barbrace_fg_bold == 0);
02147         assert(d.bar_fg_color == 0);
02148         assert(d.bar_bg_color == 0);
02149         assert(d.bar_fg_bold == 0);
02150         assert(io.in == 0);
02151         assert(io.out == 1);
02152         assert(io.in_ready == 0);
02153         assert(io.out_ready == 0);
02154         assert(io.eof_in == 0);
02155         assert(io.eof_out == 0);
02156         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02157         /* assert(io.cbuf == 0x0); */
02158         assert(io.last_read == 0);
02159         assert(io.last_write == 0);
02160         assert(io.total_read == 0);
02161         assert(io.total_write == 0);
02162         assert(io.total_size == 0);
02163         assert(io.total_size_known == 0);
02164         assert(io.timeout == 250000);
02165 }
02166 
02167 void test17(FILE* out)
02168 {
02169         int argc = 0;
02170         char *argv[256] = { 0 };
02171 
02172         argv[argc++] = "ProgramName";
02173         argv[argc++] = "-i";
02174         argv[argc++] = "/dev/null";
02175 
02176         displayInit();
02177         ioInit();
02178 
02179 #ifdef PRINT_DEBUG
02180         print();
02181 #endif
02182         assert(d.start_time == 0);
02183         assert(d.total_time == 0);
02184         assert(d.current_time == 0);
02185         assert(d.elapsed_time == 0);
02186         assert(d.percent_complete == 0);
02187         assert(d.display_interval == 1);
02188         assert(d.overtime_flag == 0);
02189         assert(d.k == 1024);
02190         assert(d.twiddle == '-');
02191         assert(d.manual_width == 0);
02192         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02193         assert(d.display_datacount == 1);
02194         assert(d.display_throughput == 1);
02195         assert(d.display_time == 1);
02196         assert(d.display_percent == 1);
02197         assert(d.display_bar == 1);
02198         assert(d.display_summary == 1);
02199         assert(d.display_ansi == 0);
02200         assert(d.twiddle_fg_color == 0);
02201         assert(d.twiddle_bg_color == 0);
02202         assert(d.twiddle_fg_bold == 0);
02203         assert(d.datacount_fg_color == 0);
02204         assert(d.datacount_bg_color == 0);
02205         assert(d.datacount_fg_bold == 0);
02206         assert(d.throughput_label_fg_color == 0);
02207         assert(d.throughput_label_bg_color == 0);
02208         assert(d.throughput_label_fg_bold == 0);
02209         assert(d.throughput_fg_color == 0);
02210         assert(d.throughput_bg_color == 0);
02211         assert(d.throughput_fg_bold == 0);
02212         assert(d.time_label_fg_color == 0);
02213         assert(d.time_label_bg_color == 0);
02214         assert(d.time_label_fg_bold == 0);
02215         assert(d.percent_fg_color == 0);
02216         assert(d.percent_bg_color == 0);
02217         assert(d.percent_fg_bold == 0);
02218         assert(d.barbrace_fg_color == 0);
02219         assert(d.barbrace_bg_color == 0);
02220         assert(d.barbrace_fg_bold == 0);
02221         assert(d.bar_fg_color == 0);
02222         assert(d.bar_bg_color == 0);
02223         assert(d.bar_fg_bold == 0);
02224         assert(io.in == 0);
02225         assert(io.out == 1);
02226         assert(io.in_ready == 0);
02227         assert(io.out_ready == 0);
02228         assert(io.eof_in == 0);
02229         assert(io.eof_out == 0);
02230         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02231         /* assert(io.cbuf == 0x0); */
02232         assert(io.last_read == 0);
02233         assert(io.last_write == 0);
02234         assert(io.total_read == 0);
02235         assert(io.total_write == 0);
02236         assert(io.total_size == 0);
02237         assert(io.total_size_known == 0);
02238         assert(io.timeout == 250000);
02239 
02240         assert(parse_args(out, argc, argv) == 0);
02241 
02242 #ifdef PRINT_DEBUG
02243         print();
02244 #endif
02245         assert(d.start_time == 0);
02246         assert(d.total_time == 0);
02247         assert(d.current_time == 0);
02248         assert(d.elapsed_time == 0);
02249         assert(d.percent_complete == 0);
02250         assert(d.display_interval == 1);
02251         assert(d.overtime_flag == 0);
02252         assert(d.k == 1024);
02253         assert(d.twiddle == '-');
02254         assert(d.manual_width == 0);
02255         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02256         assert(d.display_datacount == 1);
02257         assert(d.display_throughput == 1);
02258         assert(d.display_time == 1);
02259         assert(d.display_percent == 1);
02260         assert(d.display_bar == 1);
02261         assert(d.display_summary == 1);
02262         assert(d.display_ansi == 0);
02263         assert(d.twiddle_fg_color == 0);
02264         assert(d.twiddle_bg_color == 0);
02265         assert(d.twiddle_fg_bold == 0);
02266         assert(d.datacount_fg_color == 0);
02267         assert(d.datacount_bg_color == 0);
02268         assert(d.datacount_fg_bold == 0);
02269         assert(d.throughput_label_fg_color == 0);
02270         assert(d.throughput_label_bg_color == 0);
02271         assert(d.throughput_label_fg_bold == 0);
02272         assert(d.throughput_fg_color == 0);
02273         assert(d.throughput_bg_color == 0);
02274         assert(d.throughput_fg_bold == 0);
02275         assert(d.time_label_fg_color == 0);
02276         assert(d.time_label_bg_color == 0);
02277         assert(d.time_label_fg_bold == 0);
02278         assert(d.percent_fg_color == 0);
02279         assert(d.percent_bg_color == 0);
02280         assert(d.percent_fg_bold == 0);
02281         assert(d.barbrace_fg_color == 0);
02282         assert(d.barbrace_bg_color == 0);
02283         assert(d.barbrace_fg_bold == 0);
02284         assert(d.bar_fg_color == 0);
02285         assert(d.bar_bg_color == 0);
02286         assert(d.bar_fg_bold == 0);
02287         assert(io.in == 0);
02288         assert(io.out == 1);
02289         assert(io.in_ready == 0);
02290         assert(io.out_ready == 0);
02291         assert(io.eof_in == 0);
02292         assert(io.eof_out == 0);
02293         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02294         /* assert(io.cbuf == 0x0); */
02295         assert(io.last_read == 0);
02296         assert(io.last_write == 0);
02297         assert(io.total_read == 0);
02298         assert(io.total_write == 0);
02299         assert(io.total_size == 0);
02300         assert(io.total_size_known == 0);
02301         assert(io.timeout == 250000);
02302 }
02303 
02304 void test18(FILE* out)
02305 {
02306         int argc = 0;
02307         char *argv[256] = { 0 };
02308 
02309         argv[argc++] = "ProgramName";
02310         argv[argc++] = "-i";
02311         argv[argc++] = "1024.38002m";
02312 
02313         displayInit();
02314         ioInit();
02315 
02316 #ifdef PRINT_DEBUG
02317         print();
02318 #endif
02319         assert(d.start_time == 0);
02320         assert(d.total_time == 0);
02321         assert(d.current_time == 0);
02322         assert(d.elapsed_time == 0);
02323         assert(d.percent_complete == 0);
02324         assert(d.display_interval == 1);
02325         assert(d.overtime_flag == 0);
02326         assert(d.k == 1024);
02327         assert(d.twiddle == '-');
02328         assert(d.manual_width == 0);
02329         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02330         assert(d.display_datacount == 1);
02331         assert(d.display_throughput == 1);
02332         assert(d.display_time == 1);
02333         assert(d.display_percent == 1);
02334         assert(d.display_bar == 1);
02335         assert(d.display_summary == 1);
02336         assert(d.display_ansi == 0);
02337         assert(d.twiddle_fg_color == 0);
02338         assert(d.twiddle_bg_color == 0);
02339         assert(d.twiddle_fg_bold == 0);
02340         assert(d.datacount_fg_color == 0);
02341         assert(d.datacount_bg_color == 0);
02342         assert(d.datacount_fg_bold == 0);
02343         assert(d.throughput_label_fg_color == 0);
02344         assert(d.throughput_label_bg_color == 0);
02345         assert(d.throughput_label_fg_bold == 0);
02346         assert(d.throughput_fg_color == 0);
02347         assert(d.throughput_bg_color == 0);
02348         assert(d.throughput_fg_bold == 0);
02349         assert(d.time_label_fg_color == 0);
02350         assert(d.time_label_bg_color == 0);
02351         assert(d.time_label_fg_bold == 0);
02352         assert(d.percent_fg_color == 0);
02353         assert(d.percent_bg_color == 0);
02354         assert(d.percent_fg_bold == 0);
02355         assert(d.barbrace_fg_color == 0);
02356         assert(d.barbrace_bg_color == 0);
02357         assert(d.barbrace_fg_bold == 0);
02358         assert(d.bar_fg_color == 0);
02359         assert(d.bar_bg_color == 0);
02360         assert(d.bar_fg_bold == 0);
02361         assert(io.in == 0);
02362         assert(io.out == 1);
02363         assert(io.in_ready == 0);
02364         assert(io.out_ready == 0);
02365         assert(io.eof_in == 0);
02366         assert(io.eof_out == 0);
02367         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02368         /* assert(io.cbuf == 0x0); */
02369         assert(io.last_read == 0);
02370         assert(io.last_write == 0);
02371         assert(io.total_read == 0);
02372         assert(io.total_write == 0);
02373         assert(io.total_size == 0);
02374         assert(io.total_size_known == 0);
02375         assert(io.timeout == 250000);
02376 
02377         assert(parse_args(out, argc, argv) == 0);
02378 
02379 #ifdef PRINT_DEBUG
02380         print();
02381 #endif
02382         assert(d.start_time == 0);
02383         assert(d.total_time == 0);
02384         assert(d.current_time == 0);
02385         assert(d.elapsed_time == 0);
02386         assert(d.percent_complete == 0);
02387         assert(d.display_interval == 1);
02388         assert(d.overtime_flag == 0);
02389         assert(d.k == 1024);
02390         assert(d.twiddle == '-');
02391         assert(d.manual_width == 0);
02392         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02393         assert(d.display_datacount == 1);
02394         assert(d.display_throughput == 1);
02395         assert(d.display_time == 1);
02396         assert(d.display_percent == 1);
02397         assert(d.display_bar == 1);
02398         assert(d.display_summary == 1);
02399         assert(d.display_ansi == 0);
02400         assert(d.twiddle_fg_color == 0);
02401         assert(d.twiddle_bg_color == 0);
02402         assert(d.twiddle_fg_bold == 0);
02403         assert(d.datacount_fg_color == 0);
02404         assert(d.datacount_bg_color == 0);
02405         assert(d.datacount_fg_bold == 0);
02406         assert(d.throughput_label_fg_color == 0);
02407         assert(d.throughput_label_bg_color == 0);
02408         assert(d.throughput_label_fg_bold == 0);
02409         assert(d.throughput_fg_color == 0);
02410         assert(d.throughput_bg_color == 0);
02411         assert(d.throughput_fg_bold == 0);
02412         assert(d.time_label_fg_color == 0);
02413         assert(d.time_label_bg_color == 0);
02414         assert(d.time_label_fg_bold == 0);
02415         assert(d.percent_fg_color == 0);
02416         assert(d.percent_bg_color == 0);
02417         assert(d.percent_fg_bold == 0);
02418         assert(d.barbrace_fg_color == 0);
02419         assert(d.barbrace_bg_color == 0);
02420         assert(d.barbrace_fg_bold == 0);
02421         assert(d.bar_fg_color == 0);
02422         assert(d.bar_bg_color == 0);
02423         assert(d.bar_fg_bold == 0);
02424         assert(io.in == 0);
02425         assert(io.out == 1);
02426         assert(io.in_ready == 0);
02427         assert(io.out_ready == 0);
02428         assert(io.eof_in == 0);
02429         assert(io.eof_out == 0);
02430         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02431         /* assert(io.cbuf == 0x0); */
02432         assert(io.last_read == 0);
02433         assert(io.last_write == 0);
02434         assert(io.total_read == 0);
02435         assert(io.total_write == 0);
02436         assert(io.total_size == 0);
02437         assert(io.total_size_known == 0);
02438         assert(io.timeout == 250000);
02439 }
02440 
02441 void test19(FILE* out)
02442 {
02443         int argc = 0;
02444         char *argv[256] = { 0 };
02445 
02446         argv[argc++] = "ProgramName";
02447         argv[argc++] = "-i";
02448         argv[argc++] = "1024.38002";
02449 
02450         displayInit();
02451         ioInit();
02452 
02453 #ifdef PRINT_DEBUG
02454         print();
02455 #endif
02456         assert(d.start_time == 0);
02457         assert(d.total_time == 0);
02458         assert(d.current_time == 0);
02459         assert(d.elapsed_time == 0);
02460         assert(d.percent_complete == 0);
02461         assert(d.display_interval == 1);
02462         assert(d.overtime_flag == 0);
02463         assert(d.k == 1024);
02464         assert(d.twiddle == '-');
02465         assert(d.manual_width == 0);
02466         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02467         assert(d.display_datacount == 1);
02468         assert(d.display_throughput == 1);
02469         assert(d.display_time == 1);
02470         assert(d.display_percent == 1);
02471         assert(d.display_bar == 1);
02472         assert(d.display_summary == 1);
02473         assert(d.display_ansi == 0);
02474         assert(d.twiddle_fg_color == 0);
02475         assert(d.twiddle_bg_color == 0);
02476         assert(d.twiddle_fg_bold == 0);
02477         assert(d.datacount_fg_color == 0);
02478         assert(d.datacount_bg_color == 0);
02479         assert(d.datacount_fg_bold == 0);
02480         assert(d.throughput_label_fg_color == 0);
02481         assert(d.throughput_label_bg_color == 0);
02482         assert(d.throughput_label_fg_bold == 0);
02483         assert(d.throughput_fg_color == 0);
02484         assert(d.throughput_bg_color == 0);
02485         assert(d.throughput_fg_bold == 0);
02486         assert(d.time_label_fg_color == 0);
02487         assert(d.time_label_bg_color == 0);
02488         assert(d.time_label_fg_bold == 0);
02489         assert(d.percent_fg_color == 0);
02490         assert(d.percent_bg_color == 0);
02491         assert(d.percent_fg_bold == 0);
02492         assert(d.barbrace_fg_color == 0);
02493         assert(d.barbrace_bg_color == 0);
02494         assert(d.barbrace_fg_bold == 0);
02495         assert(d.bar_fg_color == 0);
02496         assert(d.bar_bg_color == 0);
02497         assert(d.bar_fg_bold == 0);
02498         assert(io.in == 0);
02499         assert(io.out == 1);
02500         assert(io.in_ready == 0);
02501         assert(io.out_ready == 0);
02502         assert(io.eof_in == 0);
02503         assert(io.eof_out == 0);
02504         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02505         /* assert(io.cbuf == 0x0); */
02506         assert(io.last_read == 0);
02507         assert(io.last_write == 0);
02508         assert(io.total_read == 0);
02509         assert(io.total_write == 0);
02510         assert(io.total_size == 0);
02511         assert(io.total_size_known == 0);
02512         assert(io.timeout == 250000);
02513 
02514         assert(parse_args(out, argc, argv) == 0);
02515 
02516 #ifdef PRINT_DEBUG
02517         print();
02518 #endif
02519         assert(d.start_time == 0);
02520         assert(d.total_time == 0);
02521         assert(d.current_time == 0);
02522         assert(d.elapsed_time == 0);
02523         assert(d.percent_complete == 0);
02524         assert(d.display_interval == 1);
02525         assert(d.overtime_flag == 0);
02526         assert(d.k == 1024);
02527         assert(d.twiddle == '-');
02528         assert(d.manual_width == 0);
02529         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02530         assert(d.display_datacount == 1);
02531         assert(d.display_throughput == 1);
02532         assert(d.display_time == 1);
02533         assert(d.display_percent == 1);
02534         assert(d.display_bar == 1);
02535         assert(d.display_summary == 1);
02536         assert(d.display_ansi == 0);
02537         assert(d.twiddle_fg_color == 0);
02538         assert(d.twiddle_bg_color == 0);
02539         assert(d.twiddle_fg_bold == 0);
02540         assert(d.datacount_fg_color == 0);
02541         assert(d.datacount_bg_color == 0);
02542         assert(d.datacount_fg_bold == 0);
02543         assert(d.throughput_label_fg_color == 0);
02544         assert(d.throughput_label_bg_color == 0);
02545         assert(d.throughput_label_fg_bold == 0);
02546         assert(d.throughput_fg_color == 0);
02547         assert(d.throughput_bg_color == 0);
02548         assert(d.throughput_fg_bold == 0);
02549         assert(d.time_label_fg_color == 0);
02550         assert(d.time_label_bg_color == 0);
02551         assert(d.time_label_fg_bold == 0);
02552         assert(d.percent_fg_color == 0);
02553         assert(d.percent_bg_color == 0);
02554         assert(d.percent_fg_bold == 0);
02555         assert(d.barbrace_fg_color == 0);
02556         assert(d.barbrace_bg_color == 0);
02557         assert(d.barbrace_fg_bold == 0);
02558         assert(d.bar_fg_color == 0);
02559         assert(d.bar_bg_color == 0);
02560         assert(d.bar_fg_bold == 0);
02561         assert(io.in == 0);
02562         assert(io.out == 1);
02563         assert(io.in_ready == 0);
02564         assert(io.out_ready == 0);
02565         assert(io.eof_in == 0);
02566         assert(io.eof_out == 0);
02567         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02568         /* assert(io.cbuf == 0x0); */
02569         assert(io.last_read == 0);
02570         assert(io.last_write == 0);
02571         assert(io.total_read == 0);
02572         assert(io.total_write == 0);
02573         assert(io.total_size == 0);
02574         assert(io.total_size_known == 0);
02575         assert(io.timeout == 250000);
02576 }
02577 
02578 void test20(FILE* out)
02579 {
02580         int argc = 0;
02581         char *argv[256] = { 0 };
02582 
02583         argv[argc++] = "ProgramName";
02584         argv[argc++] = "-i";
02585         argv[argc++] = "30";
02586 
02587         displayInit();
02588         ioInit();
02589 
02590 #ifdef PRINT_DEBUG
02591         print();
02592 #endif
02593         assert(d.start_time == 0);
02594         assert(d.total_time == 0);
02595         assert(d.current_time == 0);
02596         assert(d.elapsed_time == 0);
02597         assert(d.percent_complete == 0);
02598         assert(d.display_interval == 1);
02599         assert(d.overtime_flag == 0);
02600         assert(d.k == 1024);
02601         assert(d.twiddle == '-');
02602         assert(d.manual_width == 0);
02603         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02604         assert(d.display_datacount == 1);
02605         assert(d.display_throughput == 1);
02606         assert(d.display_time == 1);
02607         assert(d.display_percent == 1);
02608         assert(d.display_bar == 1);
02609         assert(d.display_summary == 1);
02610         assert(d.display_ansi == 0);
02611         assert(d.twiddle_fg_color == 0);
02612         assert(d.twiddle_bg_color == 0);
02613         assert(d.twiddle_fg_bold == 0);
02614         assert(d.datacount_fg_color == 0);
02615         assert(d.datacount_bg_color == 0);
02616         assert(d.datacount_fg_bold == 0);
02617         assert(d.throughput_label_fg_color == 0);
02618         assert(d.throughput_label_bg_color == 0);
02619         assert(d.throughput_label_fg_bold == 0);
02620         assert(d.throughput_fg_color == 0);
02621         assert(d.throughput_bg_color == 0);
02622         assert(d.throughput_fg_bold == 0);
02623         assert(d.time_label_fg_color == 0);
02624         assert(d.time_label_bg_color == 0);
02625         assert(d.time_label_fg_bold == 0);
02626         assert(d.percent_fg_color == 0);
02627         assert(d.percent_bg_color == 0);
02628         assert(d.percent_fg_bold == 0);
02629         assert(d.barbrace_fg_color == 0);
02630         assert(d.barbrace_bg_color == 0);
02631         assert(d.barbrace_fg_bold == 0);
02632         assert(d.bar_fg_color == 0);
02633         assert(d.bar_bg_color == 0);
02634         assert(d.bar_fg_bold == 0);
02635         assert(io.in == 0);
02636         assert(io.out == 1);
02637         assert(io.in_ready == 0);
02638         assert(io.out_ready == 0);
02639         assert(io.eof_in == 0);
02640         assert(io.eof_out == 0);
02641         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02642         /* assert(io.cbuf == 0x0); */
02643         assert(io.last_read == 0);
02644         assert(io.last_write == 0);
02645         assert(io.total_read == 0);
02646         assert(io.total_write == 0);
02647         assert(io.total_size == 0);
02648         assert(io.total_size_known == 0);
02649         assert(io.timeout == 250000);
02650 
02651         assert(parse_args(out, argc, argv) == 0);
02652 
02653 #ifdef PRINT_DEBUG
02654         print();
02655 #endif
02656         assert(d.start_time == 0);
02657         assert(d.total_time == 0);
02658         assert(d.current_time == 0);
02659         assert(d.elapsed_time == 0);
02660         assert(d.percent_complete == 0);
02661         assert(d.display_interval == 30);
02662         assert(d.overtime_flag == 0);
02663         assert(d.k == 1024);
02664         assert(d.twiddle == '-');
02665         assert(d.manual_width == 0);
02666         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02667         assert(d.display_datacount == 1);
02668         assert(d.display_throughput == 1);
02669         assert(d.display_time == 1);
02670         assert(d.display_percent == 1);
02671         assert(d.display_bar == 1);
02672         assert(d.display_summary == 1);
02673         assert(d.display_ansi == 0);
02674         assert(d.twiddle_fg_color == 0);
02675         assert(d.twiddle_bg_color == 0);
02676         assert(d.twiddle_fg_bold == 0);
02677         assert(d.datacount_fg_color == 0);
02678         assert(d.datacount_bg_color == 0);
02679         assert(d.datacount_fg_bold == 0);
02680         assert(d.throughput_label_fg_color == 0);
02681         assert(d.throughput_label_bg_color == 0);
02682         assert(d.throughput_label_fg_bold == 0);
02683         assert(d.throughput_fg_color == 0);
02684         assert(d.throughput_bg_color == 0);
02685         assert(d.throughput_fg_bold == 0);
02686         assert(d.time_label_fg_color == 0);
02687         assert(d.time_label_bg_color == 0);
02688         assert(d.time_label_fg_bold == 0);
02689         assert(d.percent_fg_color == 0);
02690         assert(d.percent_bg_color == 0);
02691         assert(d.percent_fg_bold == 0);
02692         assert(d.barbrace_fg_color == 0);
02693         assert(d.barbrace_bg_color == 0);
02694         assert(d.barbrace_fg_bold == 0);
02695         assert(d.bar_fg_color == 0);
02696         assert(d.bar_bg_color == 0);
02697         assert(d.bar_fg_bold == 0);
02698         assert(io.in == 0);
02699         assert(io.out == 1);
02700         assert(io.in_ready == 0);
02701         assert(io.out_ready == 0);
02702         assert(io.eof_in == 0);
02703         assert(io.eof_out == 0);
02704         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02705         /* assert(io.cbuf == 0x0); */
02706         assert(io.last_read == 0);
02707         assert(io.last_write == 0);
02708         assert(io.total_read == 0);
02709         assert(io.total_write == 0);
02710         assert(io.total_size == 0);
02711         assert(io.total_size_known == 0);
02712         assert(io.timeout == 250000);
02713 }
02714 
02715 void test21(FILE* out)
02716 {
02717         int argc = 0;
02718         char *argv[256] = { 0 };
02719 
02720         argv[argc++] = "ProgramName";
02721         argv[argc++] = "-t";
02722 
02723         displayInit();
02724         ioInit();
02725 
02726 #ifdef PRINT_DEBUG
02727         print();
02728 #endif
02729         assert(d.start_time == 0);
02730         assert(d.total_time == 0);
02731         assert(d.current_time == 0);
02732         assert(d.elapsed_time == 0);
02733         assert(d.percent_complete == 0);
02734         assert(d.display_interval == 1);
02735         assert(d.overtime_flag == 0);
02736         assert(d.k == 1024);
02737         assert(d.twiddle == '-');
02738         assert(d.manual_width == 0);
02739         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02740         assert(d.display_datacount == 1);
02741         assert(d.display_throughput == 1);
02742         assert(d.display_time == 1);
02743         assert(d.display_percent == 1);
02744         assert(d.display_bar == 1);
02745         assert(d.display_summary == 1);
02746         assert(d.display_ansi == 0);
02747         assert(d.twiddle_fg_color == 0);
02748         assert(d.twiddle_bg_color == 0);
02749         assert(d.twiddle_fg_bold == 0);
02750         assert(d.datacount_fg_color == 0);
02751         assert(d.datacount_bg_color == 0);
02752         assert(d.datacount_fg_bold == 0);
02753         assert(d.throughput_label_fg_color == 0);
02754         assert(d.throughput_label_bg_color == 0);
02755         assert(d.throughput_label_fg_bold == 0);
02756         assert(d.throughput_fg_color == 0);
02757         assert(d.throughput_bg_color == 0);
02758         assert(d.throughput_fg_bold == 0);
02759         assert(d.time_label_fg_color == 0);
02760         assert(d.time_label_bg_color == 0);
02761         assert(d.time_label_fg_bold == 0);
02762         assert(d.percent_fg_color == 0);
02763         assert(d.percent_bg_color == 0);
02764         assert(d.percent_fg_bold == 0);
02765         assert(d.barbrace_fg_color == 0);
02766         assert(d.barbrace_bg_color == 0);
02767         assert(d.barbrace_fg_bold == 0);
02768         assert(d.bar_fg_color == 0);
02769         assert(d.bar_bg_color == 0);
02770         assert(d.bar_fg_bold == 0);
02771         assert(io.in == 0);
02772         assert(io.out == 1);
02773         assert(io.in_ready == 0);
02774         assert(io.out_ready == 0);
02775         assert(io.eof_in == 0);
02776         assert(io.eof_out == 0);
02777         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02778         /* assert(io.cbuf == 0x0); */
02779         assert(io.last_read == 0);
02780         assert(io.last_write == 0);
02781         assert(io.total_read == 0);
02782         assert(io.total_write == 0);
02783         assert(io.total_size == 0);
02784         assert(io.total_size_known == 0);
02785         assert(io.timeout == 250000);
02786 
02787         assert(parse_args(out, argc, argv) == 1);
02788 
02789 #ifdef PRINT_DEBUG
02790         print();
02791 #endif
02792         assert(d.start_time == 0);
02793         assert(d.total_time == 0);
02794         assert(d.current_time == 0);
02795         assert(d.elapsed_time == 0);
02796         assert(d.percent_complete == 0);
02797         assert(d.display_interval == 1);
02798         assert(d.overtime_flag == 0);
02799         assert(d.k == 1024);
02800         assert(d.twiddle == '-');
02801         assert(d.manual_width == 0);
02802         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02803         assert(d.display_datacount == 1);
02804         assert(d.display_throughput == 1);
02805         assert(d.display_time == 1);
02806         assert(d.display_percent == 1);
02807         assert(d.display_bar == 1);
02808         assert(d.display_summary == 1);
02809         assert(d.display_ansi == 0);
02810         assert(d.twiddle_fg_color == 0);
02811         assert(d.twiddle_bg_color == 0);
02812         assert(d.twiddle_fg_bold == 0);
02813         assert(d.datacount_fg_color == 0);
02814         assert(d.datacount_bg_color == 0);
02815         assert(d.datacount_fg_bold == 0);
02816         assert(d.throughput_label_fg_color == 0);
02817         assert(d.throughput_label_bg_color == 0);
02818         assert(d.throughput_label_fg_bold == 0);
02819         assert(d.throughput_fg_color == 0);
02820         assert(d.throughput_bg_color == 0);
02821         assert(d.throughput_fg_bold == 0);
02822         assert(d.time_label_fg_color == 0);
02823         assert(d.time_label_bg_color == 0);
02824         assert(d.time_label_fg_bold == 0);
02825         assert(d.percent_fg_color == 0);
02826         assert(d.percent_bg_color == 0);
02827         assert(d.percent_fg_bold == 0);
02828         assert(d.barbrace_fg_color == 0);
02829         assert(d.barbrace_bg_color == 0);
02830         assert(d.barbrace_fg_bold == 0);
02831         assert(d.bar_fg_color == 0);
02832         assert(d.bar_bg_color == 0);
02833         assert(d.bar_fg_bold == 0);
02834         assert(io.in == 0);
02835         assert(io.out == 1);
02836         assert(io.in_ready == 0);
02837         assert(io.out_ready == 0);
02838         assert(io.eof_in == 0);
02839         assert(io.eof_out == 0);
02840         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02841         /* assert(io.cbuf == 0x0); */
02842         assert(io.last_read == 0);
02843         assert(io.last_write == 0);
02844         assert(io.total_read == 0);
02845         assert(io.total_write == 0);
02846         assert(io.total_size == 0);
02847         assert(io.total_size_known == 0);
02848         assert(io.timeout == 250000);
02849 }
02850 
02851 void test22(FILE* out)
02852 {
02853         int argc = 0;
02854         char *argv[256] = { 0 };
02855 
02856         argv[argc++] = "ProgramName";
02857         argv[argc++] = "-t";
02858         argv[argc++] = "/dev/null";
02859 
02860         displayInit();
02861         ioInit();
02862 
02863 #ifdef PRINT_DEBUG
02864         print();
02865 #endif
02866         assert(d.start_time == 0);
02867         assert(d.total_time == 0);
02868         assert(d.current_time == 0);
02869         assert(d.elapsed_time == 0);
02870         assert(d.percent_complete == 0);
02871         assert(d.display_interval == 1);
02872         assert(d.overtime_flag == 0);
02873         assert(d.k == 1024);
02874         assert(d.twiddle == '-');
02875         assert(d.manual_width == 0);
02876         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02877         assert(d.display_datacount == 1);
02878         assert(d.display_throughput == 1);
02879         assert(d.display_time == 1);
02880         assert(d.display_percent == 1);
02881         assert(d.display_bar == 1);
02882         assert(d.display_summary == 1);
02883         assert(d.display_ansi == 0);
02884         assert(d.twiddle_fg_color == 0);
02885         assert(d.twiddle_bg_color == 0);
02886         assert(d.twiddle_fg_bold == 0);
02887         assert(d.datacount_fg_color == 0);
02888         assert(d.datacount_bg_color == 0);
02889         assert(d.datacount_fg_bold == 0);
02890         assert(d.throughput_label_fg_color == 0);
02891         assert(d.throughput_label_bg_color == 0);
02892         assert(d.throughput_label_fg_bold == 0);
02893         assert(d.throughput_fg_color == 0);
02894         assert(d.throughput_bg_color == 0);
02895         assert(d.throughput_fg_bold == 0);
02896         assert(d.time_label_fg_color == 0);
02897         assert(d.time_label_bg_color == 0);
02898         assert(d.time_label_fg_bold == 0);
02899         assert(d.percent_fg_color == 0);
02900         assert(d.percent_bg_color == 0);
02901         assert(d.percent_fg_bold == 0);
02902         assert(d.barbrace_fg_color == 0);
02903         assert(d.barbrace_bg_color == 0);
02904         assert(d.barbrace_fg_bold == 0);
02905         assert(d.bar_fg_color == 0);
02906         assert(d.bar_bg_color == 0);
02907         assert(d.bar_fg_bold == 0);
02908         assert(io.in == 0);
02909         assert(io.out == 1);
02910         assert(io.in_ready == 0);
02911         assert(io.out_ready == 0);
02912         assert(io.eof_in == 0);
02913         assert(io.eof_out == 0);
02914         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02915         /* assert(io.cbuf == 0x0); */
02916         assert(io.last_read == 0);
02917         assert(io.last_write == 0);
02918         assert(io.total_read == 0);
02919         assert(io.total_write == 0);
02920         assert(io.total_size == 0);
02921         assert(io.total_size_known == 0);
02922         assert(io.timeout == 250000);
02923 
02924         assert(parse_args(out, argc, argv) == 0);
02925 
02926 #ifdef PRINT_DEBUG
02927         print();
02928 #endif
02929         assert(d.start_time == 0);
02930         assert(d.total_time == 0);
02931         assert(d.current_time == 0);
02932         assert(d.elapsed_time == 0);
02933         assert(d.percent_complete == 0);
02934         assert(d.display_interval == 1);
02935         assert(d.overtime_flag == 0);
02936         assert(d.k == 1024);
02937         assert(d.twiddle == '-');
02938         assert(d.manual_width == 0);
02939         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
02940         assert(d.display_datacount == 1);
02941         assert(d.display_throughput == 1);
02942         assert(d.display_time == 1);
02943         assert(d.display_percent == 1);
02944         assert(d.display_bar == 1);
02945         assert(d.display_summary == 1);
02946         assert(d.display_ansi == 0);
02947         assert(d.twiddle_fg_color == 0);
02948         assert(d.twiddle_bg_color == 0);
02949         assert(d.twiddle_fg_bold == 0);
02950         assert(d.datacount_fg_color == 0);
02951         assert(d.datacount_bg_color == 0);
02952         assert(d.datacount_fg_bold == 0);
02953         assert(d.throughput_label_fg_color == 0);
02954         assert(d.throughput_label_bg_color == 0);
02955         assert(d.throughput_label_fg_bold == 0);
02956         assert(d.throughput_fg_color == 0);
02957         assert(d.throughput_bg_color == 0);
02958         assert(d.throughput_fg_bold == 0);
02959         assert(d.time_label_fg_color == 0);
02960         assert(d.time_label_bg_color == 0);
02961         assert(d.time_label_fg_bold == 0);
02962         assert(d.percent_fg_color == 0);
02963         assert(d.percent_bg_color == 0);
02964         assert(d.percent_fg_bold == 0);
02965         assert(d.barbrace_fg_color == 0);
02966         assert(d.barbrace_bg_color == 0);
02967         assert(d.barbrace_fg_bold == 0);
02968         assert(d.bar_fg_color == 0);
02969         assert(d.bar_bg_color == 0);
02970         assert(d.bar_fg_bold == 0);
02971         assert(io.in == 0);
02972         assert(io.out == 1);
02973         assert(io.in_ready == 0);
02974         assert(io.out_ready == 0);
02975         assert(io.eof_in == 0);
02976         assert(io.eof_out == 0);
02977         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
02978         /* assert(io.cbuf == 0x0); */
02979         assert(io.last_read == 0);
02980         assert(io.last_write == 0);
02981         assert(io.total_read == 0);
02982         assert(io.total_write == 0);
02983         assert(io.total_size == 0);
02984         assert(io.total_size_known == 0);
02985         assert(io.timeout == 250000);
02986 }
02987 
02988 void test23(FILE* out)
02989 {
02990         int argc = 0;
02991         char *argv[256] = { 0 };
02992 
02993         argv[argc++] = "ProgramName";
02994         argv[argc++] = "-t";
02995         argv[argc++] = "1024.38002m";
02996 
02997         displayInit();
02998         ioInit();
02999 
03000 #ifdef PRINT_DEBUG
03001         print();
03002 #endif
03003         assert(d.start_time == 0);
03004         assert(d.total_time == 0);
03005         assert(d.current_time == 0);
03006         assert(d.elapsed_time == 0);
03007         assert(d.percent_complete == 0);
03008         assert(d.display_interval == 1);
03009         assert(d.overtime_flag == 0);
03010         assert(d.k == 1024);
03011         assert(d.twiddle == '-');
03012         assert(d.manual_width == 0);
03013         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03014         assert(d.display_datacount == 1);
03015         assert(d.display_throughput == 1);
03016         assert(d.display_time == 1);
03017         assert(d.display_percent == 1);
03018         assert(d.display_bar == 1);
03019         assert(d.display_summary == 1);
03020         assert(d.display_ansi == 0);
03021         assert(d.twiddle_fg_color == 0);
03022         assert(d.twiddle_bg_color == 0);
03023         assert(d.twiddle_fg_bold == 0);
03024         assert(d.datacount_fg_color == 0);
03025         assert(d.datacount_bg_color == 0);
03026         assert(d.datacount_fg_bold == 0);
03027         assert(d.throughput_label_fg_color == 0);
03028         assert(d.throughput_label_bg_color == 0);
03029         assert(d.throughput_label_fg_bold == 0);
03030         assert(d.throughput_fg_color == 0);
03031         assert(d.throughput_bg_color == 0);
03032         assert(d.throughput_fg_bold == 0);
03033         assert(d.time_label_fg_color == 0);
03034         assert(d.time_label_bg_color == 0);
03035         assert(d.time_label_fg_bold == 0);
03036         assert(d.percent_fg_color == 0);
03037         assert(d.percent_bg_color == 0);
03038         assert(d.percent_fg_bold == 0);
03039         assert(d.barbrace_fg_color == 0);
03040         assert(d.barbrace_bg_color == 0);
03041         assert(d.barbrace_fg_bold == 0);
03042         assert(d.bar_fg_color == 0);
03043         assert(d.bar_bg_color == 0);
03044         assert(d.bar_fg_bold == 0);
03045         assert(io.in == 0);
03046         assert(io.out == 1);
03047         assert(io.in_ready == 0);
03048         assert(io.out_ready == 0);
03049         assert(io.eof_in == 0);
03050         assert(io.eof_out == 0);
03051         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03052         /* assert(io.cbuf == 0x0); */
03053         assert(io.last_read == 0);
03054         assert(io.last_write == 0);
03055         assert(io.total_read == 0);
03056         assert(io.total_write == 0);
03057         assert(io.total_size == 0);
03058         assert(io.total_size_known == 0);
03059         assert(io.timeout == 250000);
03060 
03061         assert(parse_args(out, argc, argv) == 0);
03062 
03063 #ifdef PRINT_DEBUG
03064         print();
03065 #endif
03066         assert(d.start_time == 0);
03067         assert(d.total_time == 0);
03068         assert(d.current_time == 0);
03069         assert(d.elapsed_time == 0);
03070         assert(d.percent_complete == 0);
03071         assert(d.display_interval == 1);
03072         assert(d.overtime_flag == 0);
03073         assert(d.k == 1024);
03074         assert(d.twiddle == '-');
03075         assert(d.manual_width == 0);
03076         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03077         assert(d.display_datacount == 1);
03078         assert(d.display_throughput == 1);
03079         assert(d.display_time == 1);
03080         assert(d.display_percent == 1);
03081         assert(d.display_bar == 1);
03082         assert(d.display_summary == 1);
03083         assert(d.display_ansi == 0);
03084         assert(d.twiddle_fg_color == 0);
03085         assert(d.twiddle_bg_color == 0);
03086         assert(d.twiddle_fg_bold == 0);
03087         assert(d.datacount_fg_color == 0);
03088         assert(d.datacount_bg_color == 0);
03089         assert(d.datacount_fg_bold == 0);
03090         assert(d.throughput_label_fg_color == 0);
03091         assert(d.throughput_label_bg_color == 0);
03092         assert(d.throughput_label_fg_bold == 0);
03093         assert(d.throughput_fg_color == 0);
03094         assert(d.throughput_bg_color == 0);
03095         assert(d.throughput_fg_bold == 0);
03096         assert(d.time_label_fg_color == 0);
03097         assert(d.time_label_bg_color == 0);
03098         assert(d.time_label_fg_bold == 0);
03099         assert(d.percent_fg_color == 0);
03100         assert(d.percent_bg_color == 0);
03101         assert(d.percent_fg_bold == 0);
03102         assert(d.barbrace_fg_color == 0);
03103         assert(d.barbrace_bg_color == 0);
03104         assert(d.barbrace_fg_bold == 0);
03105         assert(d.bar_fg_color == 0);
03106         assert(d.bar_bg_color == 0);
03107         assert(d.bar_fg_bold == 0);
03108         assert(io.in == 0);
03109         assert(io.out == 1);
03110         assert(io.in_ready == 0);
03111         assert(io.out_ready == 0);
03112         assert(io.eof_in == 0);
03113         assert(io.eof_out == 0);
03114         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03115         /* assert(io.cbuf == 0x0); */
03116         assert(io.last_read == 0);
03117         assert(io.last_write == 0);
03118         assert(io.total_read == 0);
03119         assert(io.total_write == 0);
03120         assert(io.total_size == 0);
03121         assert(io.total_size_known == 0);
03122         assert(io.timeout == 250000);
03123 }
03124 
03125 void test24(FILE* out)
03126 {
03127         int argc = 0;
03128         char *argv[256] = { 0 };
03129 
03130         argv[argc++] = "ProgramName";
03131         argv[argc++] = "-t";
03132         argv[argc++] = "1024.38002";
03133 
03134         displayInit();
03135         ioInit();
03136 
03137 #ifdef PRINT_DEBUG
03138         print();
03139 #endif
03140         assert(d.start_time == 0);
03141         assert(d.total_time == 0);
03142         assert(d.current_time == 0);
03143         assert(d.elapsed_time == 0);
03144         assert(d.percent_complete == 0);
03145         assert(d.display_interval == 1);
03146         assert(d.overtime_flag == 0);
03147         assert(d.k == 1024);
03148         assert(d.twiddle == '-');
03149         assert(d.manual_width == 0);
03150         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03151         assert(d.display_datacount == 1);
03152         assert(d.display_throughput == 1);
03153         assert(d.display_time == 1);
03154         assert(d.display_percent == 1);
03155         assert(d.display_bar == 1);
03156         assert(d.display_summary == 1);
03157         assert(d.display_ansi == 0);
03158         assert(d.twiddle_fg_color == 0);
03159         assert(d.twiddle_bg_color == 0);
03160         assert(d.twiddle_fg_bold == 0);
03161         assert(d.datacount_fg_color == 0);
03162         assert(d.datacount_bg_color == 0);
03163         assert(d.datacount_fg_bold == 0);
03164         assert(d.throughput_label_fg_color == 0);
03165         assert(d.throughput_label_bg_color == 0);
03166         assert(d.throughput_label_fg_bold == 0);
03167         assert(d.throughput_fg_color == 0);
03168         assert(d.throughput_bg_color == 0);
03169         assert(d.throughput_fg_bold == 0);
03170         assert(d.time_label_fg_color == 0);
03171         assert(d.time_label_bg_color == 0);
03172         assert(d.time_label_fg_bold == 0);
03173         assert(d.percent_fg_color == 0);
03174         assert(d.percent_bg_color == 0);
03175         assert(d.percent_fg_bold == 0);
03176         assert(d.barbrace_fg_color == 0);
03177         assert(d.barbrace_bg_color == 0);
03178         assert(d.barbrace_fg_bold == 0);
03179         assert(d.bar_fg_color == 0);
03180         assert(d.bar_bg_color == 0);
03181         assert(d.bar_fg_bold == 0);
03182         assert(io.in == 0);
03183         assert(io.out == 1);
03184         assert(io.in_ready == 0);
03185         assert(io.out_ready == 0);
03186         assert(io.eof_in == 0);
03187         assert(io.eof_out == 0);
03188         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03189         /* assert(io.cbuf == 0x0); */
03190         assert(io.last_read == 0);
03191         assert(io.last_write == 0);
03192         assert(io.total_read == 0);
03193         assert(io.total_write == 0);
03194         assert(io.total_size == 0);
03195         assert(io.total_size_known == 0);
03196         assert(io.timeout == 250000);
03197 
03198         assert(parse_args(out, argc, argv) == 0);
03199 
03200 #ifdef PRINT_DEBUG
03201         print();
03202 #endif
03203         assert(d.start_time == 0);
03204         assert(d.total_time == 0);
03205         assert(d.current_time == 0);
03206         assert(d.elapsed_time == 0);
03207         assert(d.percent_complete == 0);
03208         assert(d.display_interval == 1);
03209         assert(d.overtime_flag == 0);
03210         assert(d.k == 1024);
03211         assert(d.twiddle == '-');
03212         assert(d.manual_width == 0);
03213         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03214         assert(d.display_datacount == 1);
03215         assert(d.display_throughput == 1);
03216         assert(d.display_time == 1);
03217         assert(d.display_percent == 1);
03218         assert(d.display_bar == 1);
03219         assert(d.display_summary == 1);
03220         assert(d.display_ansi == 0);
03221         assert(d.twiddle_fg_color == 0);
03222         assert(d.twiddle_bg_color == 0);
03223         assert(d.twiddle_fg_bold == 0);
03224         assert(d.datacount_fg_color == 0);
03225         assert(d.datacount_bg_color == 0);
03226         assert(d.datacount_fg_bold == 0);
03227         assert(d.throughput_label_fg_color == 0);
03228         assert(d.throughput_label_bg_color == 0);
03229         assert(d.throughput_label_fg_bold == 0);
03230         assert(d.throughput_fg_color == 0);
03231         assert(d.throughput_bg_color == 0);
03232         assert(d.throughput_fg_bold == 0);
03233         assert(d.time_label_fg_color == 0);
03234         assert(d.time_label_bg_color == 0);
03235         assert(d.time_label_fg_bold == 0);
03236         assert(d.percent_fg_color == 0);
03237         assert(d.percent_bg_color == 0);
03238         assert(d.percent_fg_bold == 0);
03239         assert(d.barbrace_fg_color == 0);
03240         assert(d.barbrace_bg_color == 0);
03241         assert(d.barbrace_fg_bold == 0);
03242         assert(d.bar_fg_color == 0);
03243         assert(d.bar_bg_color == 0);
03244         assert(d.bar_fg_bold == 0);
03245         assert(io.in == 0);
03246         assert(io.out == 1);
03247         assert(io.in_ready == 0);
03248         assert(io.out_ready == 0);
03249         assert(io.eof_in == 0);
03250         assert(io.eof_out == 0);
03251         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03252         /* assert(io.cbuf == 0x0); */
03253         assert(io.last_read == 0);
03254         assert(io.last_write == 0);
03255         assert(io.total_read == 0);
03256         assert(io.total_write == 0);
03257         assert(io.total_size == 0);
03258         assert(io.total_size_known == 0);
03259         assert(io.timeout == 250000);
03260 }
03261 
03262 void test25(FILE* out)
03263 {
03264         int argc = 0;
03265         char *argv[256] = { 0 };
03266 
03267         argv[argc++] = "ProgramName";
03268         argv[argc++] = "-t";
03269         argv[argc++] = "30";
03270 
03271         displayInit();
03272         ioInit();
03273 
03274 #ifdef PRINT_DEBUG
03275         print();
03276 #endif
03277         assert(d.start_time == 0);
03278         assert(d.total_time == 0);
03279         assert(d.current_time == 0);
03280         assert(d.elapsed_time == 0);
03281         assert(d.percent_complete == 0);
03282         assert(d.display_interval == 1);
03283         assert(d.overtime_flag == 0);
03284         assert(d.k == 1024);
03285         assert(d.twiddle == '-');
03286         assert(d.manual_width == 0);
03287         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03288         assert(d.display_datacount == 1);
03289         assert(d.display_throughput == 1);
03290         assert(d.display_time == 1);
03291         assert(d.display_percent == 1);
03292         assert(d.display_bar == 1);
03293         assert(d.display_summary == 1);
03294         assert(d.display_ansi == 0);
03295         assert(d.twiddle_fg_color == 0);
03296         assert(d.twiddle_bg_color == 0);
03297         assert(d.twiddle_fg_bold == 0);
03298         assert(d.datacount_fg_color == 0);
03299         assert(d.datacount_bg_color == 0);
03300         assert(d.datacount_fg_bold == 0);
03301         assert(d.throughput_label_fg_color == 0);
03302         assert(d.throughput_label_bg_color == 0);
03303         assert(d.throughput_label_fg_bold == 0);
03304         assert(d.throughput_fg_color == 0);
03305         assert(d.throughput_bg_color == 0);
03306         assert(d.throughput_fg_bold == 0);
03307         assert(d.time_label_fg_color == 0);
03308         assert(d.time_label_bg_color == 0);
03309         assert(d.time_label_fg_bold == 0);
03310         assert(d.percent_fg_color == 0);
03311         assert(d.percent_bg_color == 0);
03312         assert(d.percent_fg_bold == 0);
03313         assert(d.barbrace_fg_color == 0);
03314         assert(d.barbrace_bg_color == 0);
03315         assert(d.barbrace_fg_bold == 0);
03316         assert(d.bar_fg_color == 0);
03317         assert(d.bar_bg_color == 0);
03318         assert(d.bar_fg_bold == 0);
03319         assert(io.in == 0);
03320         assert(io.out == 1);
03321         assert(io.in_ready == 0);
03322         assert(io.out_ready == 0);
03323         assert(io.eof_in == 0);
03324         assert(io.eof_out == 0);
03325         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03326         /* assert(io.cbuf == 0x0); */
03327         assert(io.last_read == 0);
03328         assert(io.last_write == 0);
03329         assert(io.total_read == 0);
03330         assert(io.total_write == 0);
03331         assert(io.total_size == 0);
03332         assert(io.total_size_known == 0);
03333         assert(io.timeout == 250000);
03334 
03335         assert(parse_args(out, argc, argv) == 0);
03336 
03337 #ifdef PRINT_DEBUG
03338         print();
03339 #endif
03340         assert(d.start_time == 0);
03341         assert(d.total_time == 0);
03342         assert(d.current_time == 0);
03343         assert(d.elapsed_time == 0);
03344         assert(d.percent_complete == 0);
03345         assert(d.display_interval == 1);
03346         assert(d.overtime_flag == 0);
03347         assert(d.k == 1024);
03348         assert(d.twiddle == '-');
03349         assert(d.manual_width == 0);
03350         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03351         assert(d.display_datacount == 1);
03352         assert(d.display_throughput == 1);
03353         assert(d.display_time == 1);
03354         assert(d.display_percent == 1);
03355         assert(d.display_bar == 1);
03356         assert(d.display_summary == 1);
03357         assert(d.display_ansi == 0);
03358         assert(d.twiddle_fg_color == 0);
03359         assert(d.twiddle_bg_color == 0);
03360         assert(d.twiddle_fg_bold == 0);
03361         assert(d.datacount_fg_color == 0);
03362         assert(d.datacount_bg_color == 0);
03363         assert(d.datacount_fg_bold == 0);
03364         assert(d.throughput_label_fg_color == 0);
03365         assert(d.throughput_label_bg_color == 0);
03366         assert(d.throughput_label_fg_bold == 0);
03367         assert(d.throughput_fg_color == 0);
03368         assert(d.throughput_bg_color == 0);
03369         assert(d.throughput_fg_bold == 0);
03370         assert(d.time_label_fg_color == 0);
03371         assert(d.time_label_bg_color == 0);
03372         assert(d.time_label_fg_bold == 0);
03373         assert(d.percent_fg_color == 0);
03374         assert(d.percent_bg_color == 0);
03375         assert(d.percent_fg_bold == 0);
03376         assert(d.barbrace_fg_color == 0);
03377         assert(d.barbrace_bg_color == 0);
03378         assert(d.barbrace_fg_bold == 0);
03379         assert(d.bar_fg_color == 0);
03380         assert(d.bar_bg_color == 0);
03381         assert(d.bar_fg_bold == 0);
03382         assert(io.in == 0);
03383         assert(io.out == 1);
03384         assert(io.in_ready == 0);
03385         assert(io.out_ready == 0);
03386         assert(io.eof_in == 0);
03387         assert(io.eof_out == 0);
03388         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03389         /* assert(io.cbuf == 0x0); */
03390         assert(io.last_read == 0);
03391         assert(io.last_write == 0);
03392         assert(io.total_read == 0);
03393         assert(io.total_write == 0);
03394         assert(io.total_size == 0);
03395         assert(io.total_size_known == 0);
03396         assert(io.timeout == 30);
03397 }
03398 
03399 void test26(FILE* out)
03400 {
03401         int argc = 0;
03402         char *argv[256] = { 0 };
03403 
03404         argv[argc++] = "ProgramName";
03405         argv[argc++] = "-k";
03406 
03407         displayInit();
03408         ioInit();
03409 
03410 #ifdef PRINT_DEBUG
03411         print();
03412 #endif
03413         assert(d.start_time == 0);
03414         assert(d.total_time == 0);
03415         assert(d.current_time == 0);
03416         assert(d.elapsed_time == 0);
03417         assert(d.percent_complete == 0);
03418         assert(d.display_interval == 1);
03419         assert(d.overtime_flag == 0);
03420         assert(d.k == 1024);
03421         assert(d.twiddle == '-');
03422         assert(d.manual_width == 0);
03423         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03424         assert(d.display_datacount == 1);
03425         assert(d.display_throughput == 1);
03426         assert(d.display_time == 1);
03427         assert(d.display_percent == 1);
03428         assert(d.display_bar == 1);
03429         assert(d.display_summary == 1);
03430         assert(d.display_ansi == 0);
03431         assert(d.twiddle_fg_color == 0);
03432         assert(d.twiddle_bg_color == 0);
03433         assert(d.twiddle_fg_bold == 0);
03434         assert(d.datacount_fg_color == 0);
03435         assert(d.datacount_bg_color == 0);
03436         assert(d.datacount_fg_bold == 0);
03437         assert(d.throughput_label_fg_color == 0);
03438         assert(d.throughput_label_bg_color == 0);
03439         assert(d.throughput_label_fg_bold == 0);
03440         assert(d.throughput_fg_color == 0);
03441         assert(d.throughput_bg_color == 0);
03442         assert(d.throughput_fg_bold == 0);
03443         assert(d.time_label_fg_color == 0);
03444         assert(d.time_label_bg_color == 0);
03445         assert(d.time_label_fg_bold == 0);
03446         assert(d.percent_fg_color == 0);
03447         assert(d.percent_bg_color == 0);
03448         assert(d.percent_fg_bold == 0);
03449         assert(d.barbrace_fg_color == 0);
03450         assert(d.barbrace_bg_color == 0);
03451         assert(d.barbrace_fg_bold == 0);
03452         assert(d.bar_fg_color == 0);
03453         assert(d.bar_bg_color == 0);
03454         assert(d.bar_fg_bold == 0);
03455         assert(io.in == 0);
03456         assert(io.out == 1);
03457         assert(io.in_ready == 0);
03458         assert(io.out_ready == 0);
03459         assert(io.eof_in == 0);
03460         assert(io.eof_out == 0);
03461         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03462         /* assert(io.cbuf == 0x0); */
03463         assert(io.last_read == 0);
03464         assert(io.last_write == 0);
03465         assert(io.total_read == 0);
03466         assert(io.total_write == 0);
03467         assert(io.total_size == 0);
03468         assert(io.total_size_known == 0);
03469         assert(io.timeout == 250000);
03470 
03471         assert(parse_args(out, argc, argv) == 1);
03472 
03473 #ifdef PRINT_DEBUG
03474         print();
03475 #endif
03476         assert(d.start_time == 0);
03477         assert(d.total_time == 0);
03478         assert(d.current_time == 0);
03479         assert(d.elapsed_time == 0);
03480         assert(d.percent_complete == 0);
03481         assert(d.display_interval == 1);
03482         assert(d.overtime_flag == 0);
03483         assert(d.k == 1024);
03484         assert(d.twiddle == '-');
03485         assert(d.manual_width == 0);
03486         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03487         assert(d.display_datacount == 1);
03488         assert(d.display_throughput == 1);
03489         assert(d.display_time == 1);
03490         assert(d.display_percent == 1);
03491         assert(d.display_bar == 1);
03492         assert(d.display_summary == 1);
03493         assert(d.display_ansi == 0);
03494         assert(d.twiddle_fg_color == 0);
03495         assert(d.twiddle_bg_color == 0);
03496         assert(d.twiddle_fg_bold == 0);
03497         assert(d.datacount_fg_color == 0);
03498         assert(d.datacount_bg_color == 0);
03499         assert(d.datacount_fg_bold == 0);
03500         assert(d.throughput_label_fg_color == 0);
03501         assert(d.throughput_label_bg_color == 0);
03502         assert(d.throughput_label_fg_bold == 0);
03503         assert(d.throughput_fg_color == 0);
03504         assert(d.throughput_bg_color == 0);
03505         assert(d.throughput_fg_bold == 0);
03506         assert(d.time_label_fg_color == 0);
03507         assert(d.time_label_bg_color == 0);
03508         assert(d.time_label_fg_bold == 0);
03509         assert(d.percent_fg_color == 0);
03510         assert(d.percent_bg_color == 0);
03511         assert(d.percent_fg_bold == 0);
03512         assert(d.barbrace_fg_color == 0);
03513         assert(d.barbrace_bg_color == 0);
03514         assert(d.barbrace_fg_bold == 0);
03515         assert(d.bar_fg_color == 0);
03516         assert(d.bar_bg_color == 0);
03517         assert(d.bar_fg_bold == 0);
03518         assert(io.in == 0);
03519         assert(io.out == 1);
03520         assert(io.in_ready == 0);
03521         assert(io.out_ready == 0);
03522         assert(io.eof_in == 0);
03523         assert(io.eof_out == 0);
03524         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03525         /* assert(io.cbuf == 0x0); */
03526         assert(io.last_read == 0);
03527         assert(io.last_write == 0);
03528         assert(io.total_read == 0);
03529         assert(io.total_write == 0);
03530         assert(io.total_size == 0);
03531         assert(io.total_size_known == 0);
03532         assert(io.timeout == 250000);
03533 }
03534 
03535 void test27(FILE* out)
03536 {
03537         int argc = 0;
03538         char *argv[256] = { 0 };
03539 
03540         argv[argc++] = "ProgramName";
03541         argv[argc++] = "-k";
03542         argv[argc++] = "10";
03543 
03544         displayInit();
03545         ioInit();
03546 
03547 #ifdef PRINT_DEBUG
03548         print();
03549 #endif
03550         assert(d.start_time == 0);
03551         assert(d.total_time == 0);
03552         assert(d.current_time == 0);
03553         assert(d.elapsed_time == 0);
03554         assert(d.percent_complete == 0);
03555         assert(d.display_interval == 1);
03556         assert(d.overtime_flag == 0);
03557         assert(d.k == 1024);
03558         assert(d.twiddle == '-');
03559         assert(d.manual_width == 0);
03560         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03561         assert(d.display_datacount == 1);
03562         assert(d.display_throughput == 1);
03563         assert(d.display_time == 1);
03564         assert(d.display_percent == 1);
03565         assert(d.display_bar == 1);
03566         assert(d.display_summary == 1);
03567         assert(d.display_ansi == 0);
03568         assert(d.twiddle_fg_color == 0);
03569         assert(d.twiddle_bg_color == 0);
03570         assert(d.twiddle_fg_bold == 0);
03571         assert(d.datacount_fg_color == 0);
03572         assert(d.datacount_bg_color == 0);
03573         assert(d.datacount_fg_bold == 0);
03574         assert(d.throughput_label_fg_color == 0);
03575         assert(d.throughput_label_bg_color == 0);
03576         assert(d.throughput_label_fg_bold == 0);
03577         assert(d.throughput_fg_color == 0);
03578         assert(d.throughput_bg_color == 0);
03579         assert(d.throughput_fg_bold == 0);
03580         assert(d.time_label_fg_color == 0);
03581         assert(d.time_label_bg_color == 0);
03582         assert(d.time_label_fg_bold == 0);
03583         assert(d.percent_fg_color == 0);
03584         assert(d.percent_bg_color == 0);
03585         assert(d.percent_fg_bold == 0);
03586         assert(d.barbrace_fg_color == 0);
03587         assert(d.barbrace_bg_color == 0);
03588         assert(d.barbrace_fg_bold == 0);
03589         assert(d.bar_fg_color == 0);
03590         assert(d.bar_bg_color == 0);
03591         assert(d.bar_fg_bold == 0);
03592         assert(io.in == 0);
03593         assert(io.out == 1);
03594         assert(io.in_ready == 0);
03595         assert(io.out_ready == 0);
03596         assert(io.eof_in == 0);
03597         assert(io.eof_out == 0);
03598         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03599         /* assert(io.cbuf == 0x0); */
03600         assert(io.last_read == 0);
03601         assert(io.last_write == 0);
03602         assert(io.total_read == 0);
03603         assert(io.total_write == 0);
03604         assert(io.total_size == 0);
03605         assert(io.total_size_known == 0);
03606         assert(io.timeout == 250000);
03607 
03608         assert(parse_args(out, argc, argv) == 1);
03609 
03610 #ifdef PRINT_DEBUG
03611         print();
03612 #endif
03613         assert(d.start_time == 0);
03614         assert(d.total_time == 0);
03615         assert(d.current_time == 0);
03616         assert(d.elapsed_time == 0);
03617         assert(d.percent_complete == 0);
03618         assert(d.display_interval == 1);
03619         assert(d.overtime_flag == 0);
03620         assert(d.k == 1024);
03621         assert(d.twiddle == '-');
03622         assert(d.manual_width == 0);
03623         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03624         assert(d.display_datacount == 1);
03625         assert(d.display_throughput == 1);
03626         assert(d.display_time == 1);
03627         assert(d.display_percent == 1);
03628         assert(d.display_bar == 1);
03629         assert(d.display_summary == 1);
03630         assert(d.display_ansi == 0);
03631         assert(d.twiddle_fg_color == 0);
03632         assert(d.twiddle_bg_color == 0);
03633         assert(d.twiddle_fg_bold == 0);
03634         assert(d.datacount_fg_color == 0);
03635         assert(d.datacount_bg_color == 0);
03636         assert(d.datacount_fg_bold == 0);
03637         assert(d.throughput_label_fg_color == 0);
03638         assert(d.throughput_label_bg_color == 0);
03639         assert(d.throughput_label_fg_bold == 0);
03640         assert(d.throughput_fg_color == 0);
03641         assert(d.throughput_bg_color == 0);
03642         assert(d.throughput_fg_bold == 0);
03643         assert(d.time_label_fg_color == 0);
03644         assert(d.time_label_bg_color == 0);
03645         assert(d.time_label_fg_bold == 0);
03646         assert(d.percent_fg_color == 0);
03647         assert(d.percent_bg_color == 0);
03648         assert(d.percent_fg_bold == 0);
03649         assert(d.barbrace_fg_color == 0);
03650         assert(d.barbrace_bg_color == 0);
03651         assert(d.barbrace_fg_bold == 0);
03652         assert(d.bar_fg_color == 0);
03653         assert(d.bar_bg_color == 0);
03654         assert(d.bar_fg_bold == 0);
03655         assert(io.in == 0);
03656         assert(io.out == 1);
03657         assert(io.in_ready == 0);
03658         assert(io.out_ready == 0);
03659         assert(io.eof_in == 0);
03660         assert(io.eof_out == 0);
03661         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03662         /* assert(io.cbuf == 0x0); */
03663         assert(io.last_read == 0);
03664         assert(io.last_write == 0);
03665         assert(io.total_read == 0);
03666         assert(io.total_write == 0);
03667         assert(io.total_size == 0);
03668         assert(io.total_size_known == 0);
03669         assert(io.timeout == 250000);
03670 }
03671 
03672 void test28(FILE* out)
03673 {
03674         int argc = 0;
03675         char *argv[256] = { 0 };
03676 
03677         argv[argc++] = "ProgramName";
03678         argv[argc++] = "-k";
03679         argv[argc++] = "1000";
03680 
03681         displayInit();
03682         ioInit();
03683 
03684 #ifdef PRINT_DEBUG
03685         print();
03686 #endif
03687         assert(d.start_time == 0);
03688         assert(d.total_time == 0);
03689         assert(d.current_time == 0);
03690         assert(d.elapsed_time == 0);
03691         assert(d.percent_complete == 0);
03692         assert(d.display_interval == 1);
03693         assert(d.overtime_flag == 0);
03694         assert(d.k == 1024);
03695         assert(d.twiddle == '-');
03696         assert(d.manual_width == 0);
03697         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03698         assert(d.display_datacount == 1);
03699         assert(d.display_throughput == 1);
03700         assert(d.display_time == 1);
03701         assert(d.display_percent == 1);
03702         assert(d.display_bar == 1);
03703         assert(d.display_summary == 1);
03704         assert(d.display_ansi == 0);
03705         assert(d.twiddle_fg_color == 0);
03706         assert(d.twiddle_bg_color == 0);
03707         assert(d.twiddle_fg_bold == 0);
03708         assert(d.datacount_fg_color == 0);
03709         assert(d.datacount_bg_color == 0);
03710         assert(d.datacount_fg_bold == 0);
03711         assert(d.throughput_label_fg_color == 0);
03712         assert(d.throughput_label_bg_color == 0);
03713         assert(d.throughput_label_fg_bold == 0);
03714         assert(d.throughput_fg_color == 0);
03715         assert(d.throughput_bg_color == 0);
03716         assert(d.throughput_fg_bold == 0);
03717         assert(d.time_label_fg_color == 0);
03718         assert(d.time_label_bg_color == 0);
03719         assert(d.time_label_fg_bold == 0);
03720         assert(d.percent_fg_color == 0);
03721         assert(d.percent_bg_color == 0);
03722         assert(d.percent_fg_bold == 0);
03723         assert(d.barbrace_fg_color == 0);
03724         assert(d.barbrace_bg_color == 0);
03725         assert(d.barbrace_fg_bold == 0);
03726         assert(d.bar_fg_color == 0);
03727         assert(d.bar_bg_color == 0);
03728         assert(d.bar_fg_bold == 0);
03729         assert(io.in == 0);
03730         assert(io.out == 1);
03731         assert(io.in_ready == 0);
03732         assert(io.out_ready == 0);
03733         assert(io.eof_in == 0);
03734         assert(io.eof_out == 0);
03735         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03736         /* assert(io.cbuf == 0x0); */
03737         assert(io.last_read == 0);
03738         assert(io.last_write == 0);
03739         assert(io.total_read == 0);
03740         assert(io.total_write == 0);
03741         assert(io.total_size == 0);
03742         assert(io.total_size_known == 0);
03743         assert(io.timeout == 250000);
03744 
03745         assert(parse_args(out, argc, argv) == 0);
03746 
03747 #ifdef PRINT_DEBUG
03748         print();
03749 #endif
03750         assert(d.start_time == 0);
03751         assert(d.total_time == 0);
03752         assert(d.current_time == 0);
03753         assert(d.elapsed_time == 0);
03754         assert(d.percent_complete == 0);
03755         assert(d.display_interval == 1);
03756         assert(d.overtime_flag == 0);
03757         assert(d.k == 1000);
03758         assert(d.twiddle == '-');
03759         assert(d.manual_width == 0);
03760         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03761         assert(d.display_datacount == 1);
03762         assert(d.display_throughput == 1);
03763         assert(d.display_time == 1);
03764         assert(d.display_percent == 1);
03765         assert(d.display_bar == 1);
03766         assert(d.display_summary == 1);
03767         assert(d.display_ansi == 0);
03768         assert(d.twiddle_fg_color == 0);
03769         assert(d.twiddle_bg_color == 0);
03770         assert(d.twiddle_fg_bold == 0);
03771         assert(d.datacount_fg_color == 0);
03772         assert(d.datacount_bg_color == 0);
03773         assert(d.datacount_fg_bold == 0);
03774         assert(d.throughput_label_fg_color == 0);
03775         assert(d.throughput_label_bg_color == 0);
03776         assert(d.throughput_label_fg_bold == 0);
03777         assert(d.throughput_fg_color == 0);
03778         assert(d.throughput_bg_color == 0);
03779         assert(d.throughput_fg_bold == 0);
03780         assert(d.time_label_fg_color == 0);
03781         assert(d.time_label_bg_color == 0);
03782         assert(d.time_label_fg_bold == 0);
03783         assert(d.percent_fg_color == 0);
03784         assert(d.percent_bg_color == 0);
03785         assert(d.percent_fg_bold == 0);
03786         assert(d.barbrace_fg_color == 0);
03787         assert(d.barbrace_bg_color == 0);
03788         assert(d.barbrace_fg_bold == 0);
03789         assert(d.bar_fg_color == 0);
03790         assert(d.bar_bg_color == 0);
03791         assert(d.bar_fg_bold == 0);
03792         assert(io.in == 0);
03793         assert(io.out == 1);
03794         assert(io.in_ready == 0);
03795         assert(io.out_ready == 0);
03796         assert(io.eof_in == 0);
03797         assert(io.eof_out == 0);
03798         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03799         /* assert(io.cbuf == 0x0); */
03800         assert(io.last_read == 0);
03801         assert(io.last_write == 0);
03802         assert(io.total_read == 0);
03803         assert(io.total_write == 0);
03804         assert(io.total_size == 0);
03805         assert(io.total_size_known == 0);
03806         assert(io.timeout == 250000);
03807 }
03808 
03809 void test29(FILE* out)
03810 {
03811         int argc = 0;
03812         char *argv[256] = { 0 };
03813 
03814         argv[argc++] = "ProgramName";
03815         argv[argc++] = "-k";
03816         argv[argc++] = "1024";
03817 
03818         displayInit();
03819         ioInit();
03820 
03821 #ifdef PRINT_DEBUG
03822         print();
03823 #endif
03824         assert(d.start_time == 0);
03825         assert(d.total_time == 0);
03826         assert(d.current_time == 0);
03827         assert(d.elapsed_time == 0);
03828         assert(d.percent_complete == 0);
03829         assert(d.display_interval == 1);
03830         assert(d.overtime_flag == 0);
03831         assert(d.k == 1024);
03832         assert(d.twiddle == '-');
03833         assert(d.manual_width == 0);
03834         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03835         assert(d.display_datacount == 1);
03836         assert(d.display_throughput == 1);
03837         assert(d.display_time == 1);
03838         assert(d.display_percent == 1);
03839         assert(d.display_bar == 1);
03840         assert(d.display_summary == 1);
03841         assert(d.display_ansi == 0);
03842         assert(d.twiddle_fg_color == 0);
03843         assert(d.twiddle_bg_color == 0);
03844         assert(d.twiddle_fg_bold == 0);
03845         assert(d.datacount_fg_color == 0);
03846         assert(d.datacount_bg_color == 0);
03847         assert(d.datacount_fg_bold == 0);
03848         assert(d.throughput_label_fg_color == 0);
03849         assert(d.throughput_label_bg_color == 0);
03850         assert(d.throughput_label_fg_bold == 0);
03851         assert(d.throughput_fg_color == 0);
03852         assert(d.throughput_bg_color == 0);
03853         assert(d.throughput_fg_bold == 0);
03854         assert(d.time_label_fg_color == 0);
03855         assert(d.time_label_bg_color == 0);
03856         assert(d.time_label_fg_bold == 0);
03857         assert(d.percent_fg_color == 0);
03858         assert(d.percent_bg_color == 0);
03859         assert(d.percent_fg_bold == 0);
03860         assert(d.barbrace_fg_color == 0);
03861         assert(d.barbrace_bg_color == 0);
03862         assert(d.barbrace_fg_bold == 0);
03863         assert(d.bar_fg_color == 0);
03864         assert(d.bar_bg_color == 0);
03865         assert(d.bar_fg_bold == 0);
03866         assert(io.in == 0);
03867         assert(io.out == 1);
03868         assert(io.in_ready == 0);
03869         assert(io.out_ready == 0);
03870         assert(io.eof_in == 0);
03871         assert(io.eof_out == 0);
03872         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03873         /* assert(io.cbuf == 0x0); */
03874         assert(io.last_read == 0);
03875         assert(io.last_write == 0);
03876         assert(io.total_read == 0);
03877         assert(io.total_write == 0);
03878         assert(io.total_size == 0);
03879         assert(io.total_size_known == 0);
03880         assert(io.timeout == 250000);
03881 
03882         d.k = 1000;
03883         assert(parse_args(out, argc, argv) == 0);
03884 
03885 #ifdef PRINT_DEBUG
03886         print();
03887 #endif
03888         assert(d.start_time == 0);
03889         assert(d.total_time == 0);
03890         assert(d.current_time == 0);
03891         assert(d.elapsed_time == 0);
03892         assert(d.percent_complete == 0);
03893         assert(d.display_interval == 1);
03894         assert(d.overtime_flag == 0);
03895         assert(d.k == 1024);
03896         assert(d.twiddle == '-');
03897         assert(d.manual_width == 0);
03898         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03899         assert(d.display_datacount == 1);
03900         assert(d.display_throughput == 1);
03901         assert(d.display_time == 1);
03902         assert(d.display_percent == 1);
03903         assert(d.display_bar == 1);
03904         assert(d.display_summary == 1);
03905         assert(d.display_ansi == 0);
03906         assert(d.twiddle_fg_color == 0);
03907         assert(d.twiddle_bg_color == 0);
03908         assert(d.twiddle_fg_bold == 0);
03909         assert(d.datacount_fg_color == 0);
03910         assert(d.datacount_bg_color == 0);
03911         assert(d.datacount_fg_bold == 0);
03912         assert(d.throughput_label_fg_color == 0);
03913         assert(d.throughput_label_bg_color == 0);
03914         assert(d.throughput_label_fg_bold == 0);
03915         assert(d.throughput_fg_color == 0);
03916         assert(d.throughput_bg_color == 0);
03917         assert(d.throughput_fg_bold == 0);
03918         assert(d.time_label_fg_color == 0);
03919         assert(d.time_label_bg_color == 0);
03920         assert(d.time_label_fg_bold == 0);
03921         assert(d.percent_fg_color == 0);
03922         assert(d.percent_bg_color == 0);
03923         assert(d.percent_fg_bold == 0);
03924         assert(d.barbrace_fg_color == 0);
03925         assert(d.barbrace_bg_color == 0);
03926         assert(d.barbrace_fg_bold == 0);
03927         assert(d.bar_fg_color == 0);
03928         assert(d.bar_bg_color == 0);
03929         assert(d.bar_fg_bold == 0);
03930         assert(io.in == 0);
03931         assert(io.out == 1);
03932         assert(io.in_ready == 0);
03933         assert(io.out_ready == 0);
03934         assert(io.eof_in == 0);
03935         assert(io.eof_out == 0);
03936         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
03937         /* assert(io.cbuf == 0x0); */
03938         assert(io.last_read == 0);
03939         assert(io.last_write == 0);
03940         assert(io.total_read == 0);
03941         assert(io.total_write == 0);
03942         assert(io.total_size == 0);
03943         assert(io.total_size_known == 0);
03944         assert(io.timeout == 250000);
03945 }
03946 
03947 void test30(FILE* out)
03948 {
03949         int argc = 0;
03950         char *argv[256] = { 0 };
03951 
03952         argv[argc++] = "ProgramName";
03953         argv[argc++] = "-sw";
03954 
03955         displayInit();
03956         ioInit();
03957 
03958 #ifdef PRINT_DEBUG
03959         print();
03960 #endif
03961         assert(d.start_time == 0);
03962         assert(d.total_time == 0);
03963         assert(d.current_time == 0);
03964         assert(d.elapsed_time == 0);
03965         assert(d.percent_complete == 0);
03966         assert(d.display_interval == 1);
03967         assert(d.overtime_flag == 0);
03968         assert(d.k == 1024);
03969         assert(d.twiddle == '-');
03970         assert(d.manual_width == 0);
03971         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
03972         assert(d.display_datacount == 1);
03973         assert(d.display_throughput == 1);
03974         assert(d.display_time == 1);
03975         assert(d.display_percent == 1);
03976         assert(d.display_bar == 1);
03977         assert(d.display_summary == 1);
03978         assert(d.display_ansi == 0);
03979         assert(d.twiddle_fg_color == 0);
03980         assert(d.twiddle_bg_color == 0);
03981         assert(d.twiddle_fg_bold == 0);
03982         assert(d.datacount_fg_color == 0);
03983         assert(d.datacount_bg_color == 0);
03984         assert(d.datacount_fg_bold == 0);
03985         assert(d.throughput_label_fg_color == 0);
03986         assert(d.throughput_label_bg_color == 0);
03987         assert(d.throughput_label_fg_bold == 0);
03988         assert(d.throughput_fg_color == 0);
03989         assert(d.throughput_bg_color == 0);
03990         assert(d.throughput_fg_bold == 0);
03991         assert(d.time_label_fg_color == 0);
03992         assert(d.time_label_bg_color == 0);
03993         assert(d.time_label_fg_bold == 0);
03994         assert(d.percent_fg_color == 0);
03995         assert(d.percent_bg_color == 0);
03996         assert(d.percent_fg_bold == 0);
03997         assert(d.barbrace_fg_color == 0);
03998         assert(d.barbrace_bg_color == 0);
03999         assert(d.barbrace_fg_bold == 0);
04000         assert(d.bar_fg_color == 0);
04001         assert(d.bar_bg_color == 0);
04002         assert(d.bar_fg_bold == 0);
04003         assert(io.in == 0);
04004         assert(io.out == 1);
04005         assert(io.in_ready == 0);
04006         assert(io.out_ready == 0);
04007         assert(io.eof_in == 0);
04008         assert(io.eof_out == 0);
04009         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04010         /* assert(io.cbuf == 0x0); */
04011         assert(io.last_read == 0);
04012         assert(io.last_write == 0);
04013         assert(io.total_read == 0);
04014         assert(io.total_write == 0);
04015         assert(io.total_size == 0);
04016         assert(io.total_size_known == 0);
04017         assert(io.timeout == 250000);
04018 
04019         assert(parse_args(out, argc, argv) == 1);
04020 
04021 #ifdef PRINT_DEBUG
04022         print();
04023 #endif
04024         assert(d.start_time == 0);
04025         assert(d.total_time == 0);
04026         assert(d.current_time == 0);
04027         assert(d.elapsed_time == 0);
04028         assert(d.percent_complete == 0);
04029         assert(d.display_interval == 1);
04030         assert(d.overtime_flag == 0);
04031         assert(d.k == 1024);
04032         assert(d.twiddle == '-');
04033         assert(d.manual_width == 0);
04034         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04035         assert(d.display_datacount == 1);
04036         assert(d.display_throughput == 1);
04037         assert(d.display_time == 1);
04038         assert(d.display_percent == 1);
04039         assert(d.display_bar == 1);
04040         assert(d.display_summary == 1);
04041         assert(d.display_ansi == 0);
04042         assert(d.twiddle_fg_color == 0);
04043         assert(d.twiddle_bg_color == 0);
04044         assert(d.twiddle_fg_bold == 0);
04045         assert(d.datacount_fg_color == 0);
04046         assert(d.datacount_bg_color == 0);
04047         assert(d.datacount_fg_bold == 0);
04048         assert(d.throughput_label_fg_color == 0);
04049         assert(d.throughput_label_bg_color == 0);
04050         assert(d.throughput_label_fg_bold == 0);
04051         assert(d.throughput_fg_color == 0);
04052         assert(d.throughput_bg_color == 0);
04053         assert(d.throughput_fg_bold == 0);
04054         assert(d.time_label_fg_color == 0);
04055         assert(d.time_label_bg_color == 0);
04056         assert(d.time_label_fg_bold == 0);
04057         assert(d.percent_fg_color == 0);
04058         assert(d.percent_bg_color == 0);
04059         assert(d.percent_fg_bold == 0);
04060         assert(d.barbrace_fg_color == 0);
04061         assert(d.barbrace_bg_color == 0);
04062         assert(d.barbrace_fg_bold == 0);
04063         assert(d.bar_fg_color == 0);
04064         assert(d.bar_bg_color == 0);
04065         assert(d.bar_fg_bold == 0);
04066         assert(io.in == 0);
04067         assert(io.out == 1);
04068         assert(io.in_ready == 0);
04069         assert(io.out_ready == 0);
04070         assert(io.eof_in == 0);
04071         assert(io.eof_out == 0);
04072         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04073         /* assert(io.cbuf == 0x0); */
04074         assert(io.last_read == 0);
04075         assert(io.last_write == 0);
04076         assert(io.total_read == 0);
04077         assert(io.total_write == 0);
04078         assert(io.total_size == 0);
04079         assert(io.total_size_known == 0);
04080         assert(io.timeout == 250000);
04081 }
04082 
04083 void test31(FILE* out)
04084 {
04085         int argc = 0;
04086         char *argv[256] = { 0 };
04087 
04088         argv[argc++] = "ProgramName";
04089         argv[argc++] = "-sw";
04090         argv[argc++] = "0";
04091 
04092         displayInit();
04093         ioInit();
04094 
04095 #ifdef PRINT_DEBUG
04096         print();
04097 #endif
04098         assert(d.start_time == 0);
04099         assert(d.total_time == 0);
04100         assert(d.current_time == 0);
04101         assert(d.elapsed_time == 0);
04102         assert(d.percent_complete == 0);
04103         assert(d.display_interval == 1);
04104         assert(d.overtime_flag == 0);
04105         assert(d.k == 1024);
04106         assert(d.twiddle == '-');
04107         assert(d.manual_width == 0);
04108         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04109         assert(d.display_datacount == 1);
04110         assert(d.display_throughput == 1);
04111         assert(d.display_time == 1);
04112         assert(d.display_percent == 1);
04113         assert(d.display_bar == 1);
04114         assert(d.display_summary == 1);
04115         assert(d.display_ansi == 0);
04116         assert(d.twiddle_fg_color == 0);
04117         assert(d.twiddle_bg_color == 0);
04118         assert(d.twiddle_fg_bold == 0);
04119         assert(d.datacount_fg_color == 0);
04120         assert(d.datacount_bg_color == 0);
04121         assert(d.datacount_fg_bold == 0);
04122         assert(d.throughput_label_fg_color == 0);
04123         assert(d.throughput_label_bg_color == 0);
04124         assert(d.throughput_label_fg_bold == 0);
04125         assert(d.throughput_fg_color == 0);
04126         assert(d.throughput_bg_color == 0);
04127         assert(d.throughput_fg_bold == 0);
04128         assert(d.time_label_fg_color == 0);
04129         assert(d.time_label_bg_color == 0);
04130         assert(d.time_label_fg_bold == 0);
04131         assert(d.percent_fg_color == 0);
04132         assert(d.percent_bg_color == 0);
04133         assert(d.percent_fg_bold == 0);
04134         assert(d.barbrace_fg_color == 0);
04135         assert(d.barbrace_bg_color == 0);
04136         assert(d.barbrace_fg_bold == 0);
04137         assert(d.bar_fg_color == 0);
04138         assert(d.bar_bg_color == 0);
04139         assert(d.bar_fg_bold == 0);
04140         assert(io.in == 0);
04141         assert(io.out == 1);
04142         assert(io.in_ready == 0);
04143         assert(io.out_ready == 0);
04144         assert(io.eof_in == 0);
04145         assert(io.eof_out == 0);
04146         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04147         /* assert(io.cbuf == 0x0); */
04148         assert(io.last_read == 0);
04149         assert(io.last_write == 0);
04150         assert(io.total_read == 0);
04151         assert(io.total_write == 0);
04152         assert(io.total_size == 0);
04153         assert(io.total_size_known == 0);
04154         assert(io.timeout == 250000);
04155 
04156         assert(parse_args(out, argc, argv) == 1);
04157 
04158 #ifdef PRINT_DEBUG
04159         print();
04160 #endif
04161         assert(d.start_time == 0);
04162         assert(d.total_time == 0);
04163         assert(d.current_time == 0);
04164         assert(d.elapsed_time == 0);
04165         assert(d.percent_complete == 0);
04166         assert(d.display_interval == 1);
04167         assert(d.overtime_flag == 0);
04168         assert(d.k == 1024);
04169         assert(d.twiddle == '-');
04170         assert(d.manual_width == 0);
04171         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04172         assert(d.display_datacount == 1);
04173         assert(d.display_throughput == 1);
04174         assert(d.display_time == 1);
04175         assert(d.display_percent == 1);
04176         assert(d.display_bar == 1);
04177         assert(d.display_summary == 1);
04178         assert(d.display_ansi == 0);
04179         assert(d.twiddle_fg_color == 0);
04180         assert(d.twiddle_bg_color == 0);
04181         assert(d.twiddle_fg_bold == 0);
04182         assert(d.datacount_fg_color == 0);
04183         assert(d.datacount_bg_color == 0);
04184         assert(d.datacount_fg_bold == 0);
04185         assert(d.throughput_label_fg_color == 0);
04186         assert(d.throughput_label_bg_color == 0);
04187         assert(d.throughput_label_fg_bold == 0);
04188         assert(d.throughput_fg_color == 0);
04189         assert(d.throughput_bg_color == 0);
04190         assert(d.throughput_fg_bold == 0);
04191         assert(d.time_label_fg_color == 0);
04192         assert(d.time_label_bg_color == 0);
04193         assert(d.time_label_fg_bold == 0);
04194         assert(d.percent_fg_color == 0);
04195         assert(d.percent_bg_color == 0);
04196         assert(d.percent_fg_bold == 0);
04197         assert(d.barbrace_fg_color == 0);
04198         assert(d.barbrace_bg_color == 0);
04199         assert(d.barbrace_fg_bold == 0);
04200         assert(d.bar_fg_color == 0);
04201         assert(d.bar_bg_color == 0);
04202         assert(d.bar_fg_bold == 0);
04203         assert(io.in == 0);
04204         assert(io.out == 1);
04205         assert(io.in_ready == 0);
04206         assert(io.out_ready == 0);
04207         assert(io.eof_in == 0);
04208         assert(io.eof_out == 0);
04209         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04210         /* assert(io.cbuf == 0x0); */
04211         assert(io.last_read == 0);
04212         assert(io.last_write == 0);
04213         assert(io.total_read == 0);
04214         assert(io.total_write == 0);
04215         assert(io.total_size == 0);
04216         assert(io.total_size_known == 0);
04217         assert(io.timeout == 250000);
04218 }
04219 
04220 void test32(FILE* out)
04221 {
04222         int argc = 0;
04223         char *argv[256] = { 0 };
04224 
04225         argv[argc++] = "ProgramName";
04226         argv[argc++] = "-sw";
04227         argv[argc++] = "1";
04228 
04229         displayInit();
04230         ioInit();
04231 
04232 #ifdef PRINT_DEBUG
04233         print();
04234 #endif
04235         assert(d.start_time == 0);
04236         assert(d.total_time == 0);
04237         assert(d.current_time == 0);
04238         assert(d.elapsed_time == 0);
04239         assert(d.percent_complete == 0);
04240         assert(d.display_interval == 1);
04241         assert(d.overtime_flag == 0);
04242         assert(d.k == 1024);
04243         assert(d.twiddle == '-');
04244         assert(d.manual_width == 0);
04245         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04246         assert(d.display_datacount == 1);
04247         assert(d.display_throughput == 1);
04248         assert(d.display_time == 1);
04249         assert(d.display_percent == 1);
04250         assert(d.display_bar == 1);
04251         assert(d.display_summary == 1);
04252         assert(d.display_ansi == 0);
04253         assert(d.twiddle_fg_color == 0);
04254         assert(d.twiddle_bg_color == 0);
04255         assert(d.twiddle_fg_bold == 0);
04256         assert(d.datacount_fg_color == 0);
04257         assert(d.datacount_bg_color == 0);
04258         assert(d.datacount_fg_bold == 0);
04259         assert(d.throughput_label_fg_color == 0);
04260         assert(d.throughput_label_bg_color == 0);
04261         assert(d.throughput_label_fg_bold == 0);
04262         assert(d.throughput_fg_color == 0);
04263         assert(d.throughput_bg_color == 0);
04264         assert(d.throughput_fg_bold == 0);
04265         assert(d.time_label_fg_color == 0);
04266         assert(d.time_label_bg_color == 0);
04267         assert(d.time_label_fg_bold == 0);
04268         assert(d.percent_fg_color == 0);
04269         assert(d.percent_bg_color == 0);
04270         assert(d.percent_fg_bold == 0);
04271         assert(d.barbrace_fg_color == 0);
04272         assert(d.barbrace_bg_color == 0);
04273         assert(d.barbrace_fg_bold == 0);
04274         assert(d.bar_fg_color == 0);
04275         assert(d.bar_bg_color == 0);
04276         assert(d.bar_fg_bold == 0);
04277         assert(io.in == 0);
04278         assert(io.out == 1);
04279         assert(io.in_ready == 0);
04280         assert(io.out_ready == 0);
04281         assert(io.eof_in == 0);
04282         assert(io.eof_out == 0);
04283         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04284         /* assert(io.cbuf == 0x0); */
04285         assert(io.last_read == 0);
04286         assert(io.last_write == 0);
04287         assert(io.total_read == 0);
04288         assert(io.total_write == 0);
04289         assert(io.total_size == 0);
04290         assert(io.total_size_known == 0);
04291         assert(io.timeout == 250000);
04292 
04293         assert(parse_args(out, argc, argv) == 0);
04294 
04295 #ifdef PRINT_DEBUG
04296         print();
04297 #endif
04298         assert(d.start_time == 0);
04299         assert(d.total_time == 0);
04300         assert(d.current_time == 0);
04301         assert(d.elapsed_time == 0);
04302         assert(d.percent_complete == 0);
04303         assert(d.display_interval == 1);
04304         assert(d.overtime_flag == 0);
04305         assert(d.k == 1024);
04306         assert(d.twiddle == '-');
04307         assert(d.screen_width == 1);
04308         assert(d.manual_width == 1);
04309         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04310         assert(d.display_datacount == 1);
04311         assert(d.display_throughput == 1);
04312         assert(d.display_time == 1);
04313         assert(d.display_percent == 1);
04314         assert(d.display_bar == 1);
04315         assert(d.display_summary == 1);
04316         assert(d.display_ansi == 0);
04317         assert(d.twiddle_fg_color == 0);
04318         assert(d.twiddle_bg_color == 0);
04319         assert(d.twiddle_fg_bold == 0);
04320         assert(d.datacount_fg_color == 0);
04321         assert(d.datacount_bg_color == 0);
04322         assert(d.datacount_fg_bold == 0);
04323         assert(d.throughput_label_fg_color == 0);
04324         assert(d.throughput_label_bg_color == 0);
04325         assert(d.throughput_label_fg_bold == 0);
04326         assert(d.throughput_fg_color == 0);
04327         assert(d.throughput_bg_color == 0);
04328         assert(d.throughput_fg_bold == 0);
04329         assert(d.time_label_fg_color == 0);
04330         assert(d.time_label_bg_color == 0);
04331         assert(d.time_label_fg_bold == 0);
04332         assert(d.percent_fg_color == 0);
04333         assert(d.percent_bg_color == 0);
04334         assert(d.percent_fg_bold == 0);
04335         assert(d.barbrace_fg_color == 0);
04336         assert(d.barbrace_bg_color == 0);
04337         assert(d.barbrace_fg_bold == 0);
04338         assert(d.bar_fg_color == 0);
04339         assert(d.bar_bg_color == 0);
04340         assert(d.bar_fg_bold == 0);
04341         assert(io.in == 0);
04342         assert(io.out == 1);
04343         assert(io.in_ready == 0);
04344         assert(io.out_ready == 0);
04345         assert(io.eof_in == 0);
04346         assert(io.eof_out == 0);
04347         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04348         /* assert(io.cbuf == 0x0); */
04349         assert(io.last_read == 0);
04350         assert(io.last_write == 0);
04351         assert(io.total_read == 0);
04352         assert(io.total_write == 0);
04353         assert(io.total_size == 0);
04354         assert(io.total_size_known == 0);
04355         assert(io.timeout == 250000);
04356 }
04357 
04358 void test33(FILE* out)
04359 {
04360         int argc = 0;
04361         char *argv[256] = { 0 };
04362 
04363         argv[argc++] = "ProgramName";
04364         argv[argc++] = "-dtw";
04365 
04366         displayInit();
04367         ioInit();
04368 
04369 #ifdef PRINT_DEBUG
04370         print();
04371 #endif
04372         assert(d.start_time == 0);
04373         assert(d.total_time == 0);
04374         assert(d.current_time == 0);
04375         assert(d.elapsed_time == 0);
04376         assert(d.percent_complete == 0);
04377         assert(d.display_interval == 1);
04378         assert(d.overtime_flag == 0);
04379         assert(d.k == 1024);
04380         assert(d.twiddle == '-');
04381         assert(d.manual_width == 0);
04382         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04383         assert(d.display_datacount == 1);
04384         assert(d.display_throughput == 1);
04385         assert(d.display_time == 1);
04386         assert(d.display_percent == 1);
04387         assert(d.display_bar == 1);
04388         assert(d.display_summary == 1);
04389         assert(d.display_ansi == 0);
04390         assert(d.twiddle_fg_color == 0);
04391         assert(d.twiddle_bg_color == 0);
04392         assert(d.twiddle_fg_bold == 0);
04393         assert(d.datacount_fg_color == 0);
04394         assert(d.datacount_bg_color == 0);
04395         assert(d.datacount_fg_bold == 0);
04396         assert(d.throughput_label_fg_color == 0);
04397         assert(d.throughput_label_bg_color == 0);
04398         assert(d.throughput_label_fg_bold == 0);
04399         assert(d.throughput_fg_color == 0);
04400         assert(d.throughput_bg_color == 0);
04401         assert(d.throughput_fg_bold == 0);
04402         assert(d.time_label_fg_color == 0);
04403         assert(d.time_label_bg_color == 0);
04404         assert(d.time_label_fg_bold == 0);
04405         assert(d.percent_fg_color == 0);
04406         assert(d.percent_bg_color == 0);
04407         assert(d.percent_fg_bold == 0);
04408         assert(d.barbrace_fg_color == 0);
04409         assert(d.barbrace_bg_color == 0);
04410         assert(d.barbrace_fg_bold == 0);
04411         assert(d.bar_fg_color == 0);
04412         assert(d.bar_bg_color == 0);
04413         assert(d.bar_fg_bold == 0);
04414         assert(io.in == 0);
04415         assert(io.out == 1);
04416         assert(io.in_ready == 0);
04417         assert(io.out_ready == 0);
04418         assert(io.eof_in == 0);
04419         assert(io.eof_out == 0);
04420         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04421         /* assert(io.cbuf == 0x0); */
04422         assert(io.last_read == 0);
04423         assert(io.last_write == 0);
04424         assert(io.total_read == 0);
04425         assert(io.total_write == 0);
04426         assert(io.total_size == 0);
04427         assert(io.total_size_known == 0);
04428         assert(io.timeout == 250000);
04429 
04430         d.display_twiddle = 0;
04431         assert(parse_args(out, argc, argv) == 0);
04432 
04433 #ifdef PRINT_DEBUG
04434         print();
04435 #endif
04436         assert(d.start_time == 0);
04437         assert(d.total_time == 0);
04438         assert(d.current_time == 0);
04439         assert(d.elapsed_time == 0);
04440         assert(d.percent_complete == 0);
04441         assert(d.display_interval == 1);
04442         assert(d.overtime_flag == 0);
04443         assert(d.k == 1024);
04444         assert(d.twiddle == '-');
04445         assert(d.manual_width == 0); 
04446         assert(d.display_twiddle == 1);
04447         assert(d.display_datacount == 1);
04448         assert(d.display_throughput == 1);
04449         assert(d.display_time == 1);
04450         assert(d.display_percent == 1);
04451         assert(d.display_bar == 1);
04452         assert(d.display_summary == 1);
04453         assert(d.display_ansi == 0);
04454         assert(d.twiddle_fg_color == 0);
04455         assert(d.twiddle_bg_color == 0);
04456         assert(d.twiddle_fg_bold == 0);
04457         assert(d.datacount_fg_color == 0);
04458         assert(d.datacount_bg_color == 0);
04459         assert(d.datacount_fg_bold == 0);
04460         assert(d.throughput_label_fg_color == 0);
04461         assert(d.throughput_label_bg_color == 0);
04462         assert(d.throughput_label_fg_bold == 0);
04463         assert(d.throughput_fg_color == 0);
04464         assert(d.throughput_bg_color == 0);
04465         assert(d.throughput_fg_bold == 0);
04466         assert(d.time_label_fg_color == 0);
04467         assert(d.time_label_bg_color == 0);
04468         assert(d.time_label_fg_bold == 0);
04469         assert(d.percent_fg_color == 0);
04470         assert(d.percent_bg_color == 0);
04471         assert(d.percent_fg_bold == 0);
04472         assert(d.barbrace_fg_color == 0);
04473         assert(d.barbrace_bg_color == 0);
04474         assert(d.barbrace_fg_bold == 0);
04475         assert(d.bar_fg_color == 0);
04476         assert(d.bar_bg_color == 0);
04477         assert(d.bar_fg_bold == 0);
04478         assert(io.in == 0);
04479         assert(io.out == 1);
04480         assert(io.in_ready == 0);
04481         assert(io.out_ready == 0);
04482         assert(io.eof_in == 0);
04483         assert(io.eof_out == 0);
04484         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04485         /* assert(io.cbuf == 0x0); */
04486         assert(io.last_read == 0);
04487         assert(io.last_write == 0);
04488         assert(io.total_read == 0);
04489         assert(io.total_write == 0);
04490         assert(io.total_size == 0);
04491         assert(io.total_size_known == 0);
04492         assert(io.timeout == 250000);
04493 }
04494 
04495 void test34(FILE* out)
04496 {
04497         int argc = 0;
04498         char *argv[256] = { 0 };
04499 
04500         argv[argc++] = "ProgramName";
04501         argv[argc++] = "-ntw";
04502 
04503         displayInit();
04504         ioInit();
04505 
04506 #ifdef PRINT_DEBUG
04507         print();
04508 #endif
04509         assert(d.start_time == 0);
04510         assert(d.total_time == 0);
04511         assert(d.current_time == 0);
04512         assert(d.elapsed_time == 0);
04513         assert(d.percent_complete == 0);
04514         assert(d.display_interval == 1);
04515         assert(d.overtime_flag == 0);
04516         assert(d.k == 1024);
04517         assert(d.twiddle == '-');
04518         assert(d.manual_width == 0);
04519         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04520         assert(d.display_datacount == 1);
04521         assert(d.display_throughput == 1);
04522         assert(d.display_time == 1);
04523         assert(d.display_percent == 1);
04524         assert(d.display_bar == 1);
04525         assert(d.display_summary == 1);
04526         assert(d.display_ansi == 0);
04527         assert(d.twiddle_fg_color == 0);
04528         assert(d.twiddle_bg_color == 0);
04529         assert(d.twiddle_fg_bold == 0);
04530         assert(d.datacount_fg_color == 0);
04531         assert(d.datacount_bg_color == 0);
04532         assert(d.datacount_fg_bold == 0);
04533         assert(d.throughput_label_fg_color == 0);
04534         assert(d.throughput_label_bg_color == 0);
04535         assert(d.throughput_label_fg_bold == 0);
04536         assert(d.throughput_fg_color == 0);
04537         assert(d.throughput_bg_color == 0);
04538         assert(d.throughput_fg_bold == 0);
04539         assert(d.time_label_fg_color == 0);
04540         assert(d.time_label_bg_color == 0);
04541         assert(d.time_label_fg_bold == 0);
04542         assert(d.percent_fg_color == 0);
04543         assert(d.percent_bg_color == 0);
04544         assert(d.percent_fg_bold == 0);
04545         assert(d.barbrace_fg_color == 0);
04546         assert(d.barbrace_bg_color == 0);
04547         assert(d.barbrace_fg_bold == 0);
04548         assert(d.bar_fg_color == 0);
04549         assert(d.bar_bg_color == 0);
04550         assert(d.bar_fg_bold == 0);
04551         assert(io.in == 0);
04552         assert(io.out == 1);
04553         assert(io.in_ready == 0);
04554         assert(io.out_ready == 0);
04555         assert(io.eof_in == 0);
04556         assert(io.eof_out == 0);
04557         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04558         /* assert(io.cbuf == 0x0); */
04559         assert(io.last_read == 0);
04560         assert(io.last_write == 0);
04561         assert(io.total_read == 0);
04562         assert(io.total_write == 0);
04563         assert(io.total_size == 0);
04564         assert(io.total_size_known == 0);
04565         assert(io.timeout == 250000);
04566 
04567         assert(parse_args(out, argc, argv) == 0);
04568 
04569 #ifdef PRINT_DEBUG
04570         print();
04571 #endif
04572         assert(d.start_time == 0);
04573         assert(d.total_time == 0);
04574         assert(d.current_time == 0);
04575         assert(d.elapsed_time == 0);
04576         assert(d.percent_complete == 0);
04577         assert(d.display_interval == 1);
04578         assert(d.overtime_flag == 0);
04579         assert(d.k == 1024);
04580         assert(d.twiddle == '-');
04581         assert(d.manual_width == 0); 
04582         assert(d.display_twiddle == 0);
04583         assert(d.display_datacount == 1);
04584         assert(d.display_throughput == 1);
04585         assert(d.display_time == 1);
04586         assert(d.display_percent == 1);
04587         assert(d.display_bar == 1);
04588         assert(d.display_summary == 1);
04589         assert(d.display_ansi == 0);
04590         assert(d.twiddle_fg_color == 0);
04591         assert(d.twiddle_bg_color == 0);
04592         assert(d.twiddle_fg_bold == 0);
04593         assert(d.datacount_fg_color == 0);
04594         assert(d.datacount_bg_color == 0);
04595         assert(d.datacount_fg_bold == 0);
04596         assert(d.throughput_label_fg_color == 0);
04597         assert(d.throughput_label_bg_color == 0);
04598         assert(d.throughput_label_fg_bold == 0);
04599         assert(d.throughput_fg_color == 0);
04600         assert(d.throughput_bg_color == 0);
04601         assert(d.throughput_fg_bold == 0);
04602         assert(d.time_label_fg_color == 0);
04603         assert(d.time_label_bg_color == 0);
04604         assert(d.time_label_fg_bold == 0);
04605         assert(d.percent_fg_color == 0);
04606         assert(d.percent_bg_color == 0);
04607         assert(d.percent_fg_bold == 0);
04608         assert(d.barbrace_fg_color == 0);
04609         assert(d.barbrace_bg_color == 0);
04610         assert(d.barbrace_fg_bold == 0);
04611         assert(d.bar_fg_color == 0);
04612         assert(d.bar_bg_color == 0);
04613         assert(d.bar_fg_bold == 0);
04614         assert(io.in == 0);
04615         assert(io.out == 1);
04616         assert(io.in_ready == 0);
04617         assert(io.out_ready == 0);
04618         assert(io.eof_in == 0);
04619         assert(io.eof_out == 0);
04620         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04621         /* assert(io.cbuf == 0x0); */
04622         assert(io.last_read == 0);
04623         assert(io.last_write == 0);
04624         assert(io.total_read == 0);
04625         assert(io.total_write == 0);
04626         assert(io.total_size == 0);
04627         assert(io.total_size_known == 0);
04628         assert(io.timeout == 250000);
04629 }
04630 
04631 void test35(FILE* out)
04632 {
04633         int argc = 0;
04634         char *argv[256] = { 0 };
04635 
04636         argv[argc++] = "ProgramName";
04637         argv[argc++] = "-dc";
04638 
04639         displayInit();
04640         ioInit();
04641 
04642 #ifdef PRINT_DEBUG
04643         print();
04644 #endif
04645         assert(d.start_time == 0);
04646         assert(d.total_time == 0);
04647         assert(d.current_time == 0);
04648         assert(d.elapsed_time == 0);
04649         assert(d.percent_complete == 0);
04650         assert(d.display_interval == 1);
04651         assert(d.overtime_flag == 0);
04652         assert(d.k == 1024);
04653         assert(d.twiddle == '-');
04654         assert(d.manual_width == 0);
04655         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04656         assert(d.display_datacount == 1);
04657         assert(d.display_throughput == 1);
04658         assert(d.display_time == 1);
04659         assert(d.display_percent == 1);
04660         assert(d.display_bar == 1);
04661         assert(d.display_summary == 1);
04662         assert(d.display_ansi == 0);
04663         assert(d.twiddle_fg_color == 0);
04664         assert(d.twiddle_bg_color == 0);
04665         assert(d.twiddle_fg_bold == 0);
04666         assert(d.datacount_fg_color == 0);
04667         assert(d.datacount_bg_color == 0);
04668         assert(d.datacount_fg_bold == 0);
04669         assert(d.throughput_label_fg_color == 0);
04670         assert(d.throughput_label_bg_color == 0);
04671         assert(d.throughput_label_fg_bold == 0);
04672         assert(d.throughput_fg_color == 0);
04673         assert(d.throughput_bg_color == 0);
04674         assert(d.throughput_fg_bold == 0);
04675         assert(d.time_label_fg_color == 0);
04676         assert(d.time_label_bg_color == 0);
04677         assert(d.time_label_fg_bold == 0);
04678         assert(d.percent_fg_color == 0);
04679         assert(d.percent_bg_color == 0);
04680         assert(d.percent_fg_bold == 0);
04681         assert(d.barbrace_fg_color == 0);
04682         assert(d.barbrace_bg_color == 0);
04683         assert(d.barbrace_fg_bold == 0);
04684         assert(d.bar_fg_color == 0);
04685         assert(d.bar_bg_color == 0);
04686         assert(d.bar_fg_bold == 0);
04687         assert(io.in == 0);
04688         assert(io.out == 1);
04689         assert(io.in_ready == 0);
04690         assert(io.out_ready == 0);
04691         assert(io.eof_in == 0);
04692         assert(io.eof_out == 0);
04693         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04694         /* assert(io.cbuf == 0x0); */
04695         assert(io.last_read == 0);
04696         assert(io.last_write == 0);
04697         assert(io.total_read == 0);
04698         assert(io.total_write == 0);
04699         assert(io.total_size == 0);
04700         assert(io.total_size_known == 0);
04701         assert(io.timeout == 250000);
04702 
04703         d.display_datacount = 0;
04704         assert(parse_args(out, argc, argv) == 0);
04705 
04706 #ifdef PRINT_DEBUG
04707         print();
04708 #endif
04709         assert(d.start_time == 0);
04710         assert(d.total_time == 0);
04711         assert(d.current_time == 0);
04712         assert(d.elapsed_time == 0);
04713         assert(d.percent_complete == 0);
04714         assert(d.display_interval == 1);
04715         assert(d.overtime_flag == 0);
04716         assert(d.k == 1024);
04717         assert(d.twiddle == '-');
04718         assert(d.manual_width == 0); 
04719         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04720         assert(d.display_datacount == 1);
04721         assert(d.display_throughput == 1);
04722         assert(d.display_time == 1);
04723         assert(d.display_percent == 1);
04724         assert(d.display_bar == 1);
04725         assert(d.display_summary == 1);
04726         assert(d.display_ansi == 0);
04727         assert(d.twiddle_fg_color == 0);
04728         assert(d.twiddle_bg_color == 0);
04729         assert(d.twiddle_fg_bold == 0);
04730         assert(d.datacount_fg_color == 0);
04731         assert(d.datacount_bg_color == 0);
04732         assert(d.datacount_fg_bold == 0);
04733         assert(d.throughput_label_fg_color == 0);
04734         assert(d.throughput_label_bg_color == 0);
04735         assert(d.throughput_label_fg_bold == 0);
04736         assert(d.throughput_fg_color == 0);
04737         assert(d.throughput_bg_color == 0);
04738         assert(d.throughput_fg_bold == 0);
04739         assert(d.time_label_fg_color == 0);
04740         assert(d.time_label_bg_color == 0);
04741         assert(d.time_label_fg_bold == 0);
04742         assert(d.percent_fg_color == 0);
04743         assert(d.percent_bg_color == 0);
04744         assert(d.percent_fg_bold == 0);
04745         assert(d.barbrace_fg_color == 0);
04746         assert(d.barbrace_bg_color == 0);
04747         assert(d.barbrace_fg_bold == 0);
04748         assert(d.bar_fg_color == 0);
04749         assert(d.bar_bg_color == 0);
04750         assert(d.bar_fg_bold == 0);
04751         assert(io.in == 0);
04752         assert(io.out == 1);
04753         assert(io.in_ready == 0);
04754         assert(io.out_ready == 0);
04755         assert(io.eof_in == 0);
04756         assert(io.eof_out == 0);
04757         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04758         /* assert(io.cbuf == 0x0); */
04759         assert(io.last_read == 0);
04760         assert(io.last_write == 0);
04761         assert(io.total_read == 0);
04762         assert(io.total_write == 0);
04763         assert(io.total_size == 0);
04764         assert(io.total_size_known == 0);
04765         assert(io.timeout == 250000);
04766 }
04767 
04768 void test36(FILE* out)
04769 {
04770         int argc = 0;
04771         char *argv[256] = { 0 };
04772 
04773         argv[argc++] = "ProgramName";
04774         argv[argc++] = "-nc";
04775 
04776         displayInit();
04777         ioInit();
04778 
04779 #ifdef PRINT_DEBUG
04780         print();
04781 #endif
04782         assert(d.start_time == 0);
04783         assert(d.total_time == 0);
04784         assert(d.current_time == 0);
04785         assert(d.elapsed_time == 0);
04786         assert(d.percent_complete == 0);
04787         assert(d.display_interval == 1);
04788         assert(d.overtime_flag == 0);
04789         assert(d.k == 1024);
04790         assert(d.twiddle == '-');
04791         assert(d.manual_width == 0);
04792         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04793         assert(d.display_datacount == 1);
04794         assert(d.display_throughput == 1);
04795         assert(d.display_time == 1);
04796         assert(d.display_percent == 1);
04797         assert(d.display_bar == 1);
04798         assert(d.display_summary == 1);
04799         assert(d.display_ansi == 0);
04800         assert(d.twiddle_fg_color == 0);
04801         assert(d.twiddle_bg_color == 0);
04802         assert(d.twiddle_fg_bold == 0);
04803         assert(d.datacount_fg_color == 0);
04804         assert(d.datacount_bg_color == 0);
04805         assert(d.datacount_fg_bold == 0);
04806         assert(d.throughput_label_fg_color == 0);
04807         assert(d.throughput_label_bg_color == 0);
04808         assert(d.throughput_label_fg_bold == 0);
04809         assert(d.throughput_fg_color == 0);
04810         assert(d.throughput_bg_color == 0);
04811         assert(d.throughput_fg_bold == 0);
04812         assert(d.time_label_fg_color == 0);
04813         assert(d.time_label_bg_color == 0);
04814         assert(d.time_label_fg_bold == 0);
04815         assert(d.percent_fg_color == 0);
04816         assert(d.percent_bg_color == 0);
04817         assert(d.percent_fg_bold == 0);
04818         assert(d.barbrace_fg_color == 0);
04819         assert(d.barbrace_bg_color == 0);
04820         assert(d.barbrace_fg_bold == 0);
04821         assert(d.bar_fg_color == 0);
04822         assert(d.bar_bg_color == 0);
04823         assert(d.bar_fg_bold == 0);
04824         assert(io.in == 0);
04825         assert(io.out == 1);
04826         assert(io.in_ready == 0);
04827         assert(io.out_ready == 0);
04828         assert(io.eof_in == 0);
04829         assert(io.eof_out == 0);
04830         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04831         /* assert(io.cbuf == 0x0); */
04832         assert(io.last_read == 0);
04833         assert(io.last_write == 0);
04834         assert(io.total_read == 0);
04835         assert(io.total_write == 0);
04836         assert(io.total_size == 0);
04837         assert(io.total_size_known == 0);
04838         assert(io.timeout == 250000);
04839 
04840         assert(parse_args(out, argc, argv) == 0);
04841 
04842 #ifdef PRINT_DEBUG
04843         print();
04844 #endif
04845         assert(d.start_time == 0);
04846         assert(d.total_time == 0);
04847         assert(d.current_time == 0);
04848         assert(d.elapsed_time == 0);
04849         assert(d.percent_complete == 0);
04850         assert(d.display_interval == 1);
04851         assert(d.overtime_flag == 0);
04852         assert(d.k == 1024);
04853         assert(d.twiddle == '-');
04854         assert(d.manual_width == 0); 
04855         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04856         assert(d.display_datacount == 0);
04857         assert(d.display_throughput == 1);
04858         assert(d.display_time == 1);
04859         assert(d.display_percent == 1);
04860         assert(d.display_bar == 1);
04861         assert(d.display_summary == 1);
04862         assert(d.display_ansi == 0);
04863         assert(d.twiddle_fg_color == 0);
04864         assert(d.twiddle_bg_color == 0);
04865         assert(d.twiddle_fg_bold == 0);
04866         assert(d.datacount_fg_color == 0);
04867         assert(d.datacount_bg_color == 0);
04868         assert(d.datacount_fg_bold == 0);
04869         assert(d.throughput_label_fg_color == 0);
04870         assert(d.throughput_label_bg_color == 0);
04871         assert(d.throughput_label_fg_bold == 0);
04872         assert(d.throughput_fg_color == 0);
04873         assert(d.throughput_bg_color == 0);
04874         assert(d.throughput_fg_bold == 0);
04875         assert(d.time_label_fg_color == 0);
04876         assert(d.time_label_bg_color == 0);
04877         assert(d.time_label_fg_bold == 0);
04878         assert(d.percent_fg_color == 0);
04879         assert(d.percent_bg_color == 0);
04880         assert(d.percent_fg_bold == 0);
04881         assert(d.barbrace_fg_color == 0);
04882         assert(d.barbrace_bg_color == 0);
04883         assert(d.barbrace_fg_bold == 0);
04884         assert(d.bar_fg_color == 0);
04885         assert(d.bar_bg_color == 0);
04886         assert(d.bar_fg_bold == 0);
04887         assert(io.in == 0);
04888         assert(io.out == 1);
04889         assert(io.in_ready == 0);
04890         assert(io.out_ready == 0);
04891         assert(io.eof_in == 0);
04892         assert(io.eof_out == 0);
04893         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04894         /* assert(io.cbuf == 0x0); */
04895         assert(io.last_read == 0);
04896         assert(io.last_write == 0);
04897         assert(io.total_read == 0);
04898         assert(io.total_write == 0);
04899         assert(io.total_size == 0);
04900         assert(io.total_size_known == 0);
04901         assert(io.timeout == 250000);
04902 }
04903 
04904 void test37(FILE* out)
04905 {
04906         int argc = 0;
04907         char *argv[256] = { 0 };
04908 
04909         argv[argc++] = "ProgramName";
04910         argv[argc++] = "-dth";
04911 
04912         displayInit();
04913         ioInit();
04914 
04915 #ifdef PRINT_DEBUG
04916         print();
04917 #endif
04918         assert(d.start_time == 0);
04919         assert(d.total_time == 0);
04920         assert(d.current_time == 0);
04921         assert(d.elapsed_time == 0);
04922         assert(d.percent_complete == 0);
04923         assert(d.display_interval == 1);
04924         assert(d.overtime_flag == 0);
04925         assert(d.k == 1024);
04926         assert(d.twiddle == '-');
04927         assert(d.manual_width == 0);
04928         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04929         assert(d.display_datacount == 1);
04930         assert(d.display_throughput == 1);
04931         assert(d.display_time == 1);
04932         assert(d.display_percent == 1);
04933         assert(d.display_bar == 1);
04934         assert(d.display_summary == 1);
04935         assert(d.display_ansi == 0);
04936         assert(d.twiddle_fg_color == 0);
04937         assert(d.twiddle_bg_color == 0);
04938         assert(d.twiddle_fg_bold == 0);
04939         assert(d.datacount_fg_color == 0);
04940         assert(d.datacount_bg_color == 0);
04941         assert(d.datacount_fg_bold == 0);
04942         assert(d.throughput_label_fg_color == 0);
04943         assert(d.throughput_label_bg_color == 0);
04944         assert(d.throughput_label_fg_bold == 0);
04945         assert(d.throughput_fg_color == 0);
04946         assert(d.throughput_bg_color == 0);
04947         assert(d.throughput_fg_bold == 0);
04948         assert(d.time_label_fg_color == 0);
04949         assert(d.time_label_bg_color == 0);
04950         assert(d.time_label_fg_bold == 0);
04951         assert(d.percent_fg_color == 0);
04952         assert(d.percent_bg_color == 0);
04953         assert(d.percent_fg_bold == 0);
04954         assert(d.barbrace_fg_color == 0);
04955         assert(d.barbrace_bg_color == 0);
04956         assert(d.barbrace_fg_bold == 0);
04957         assert(d.bar_fg_color == 0);
04958         assert(d.bar_bg_color == 0);
04959         assert(d.bar_fg_bold == 0);
04960         assert(io.in == 0);
04961         assert(io.out == 1);
04962         assert(io.in_ready == 0);
04963         assert(io.out_ready == 0);
04964         assert(io.eof_in == 0);
04965         assert(io.eof_out == 0);
04966         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
04967         /* assert(io.cbuf == 0x0); */
04968         assert(io.last_read == 0);
04969         assert(io.last_write == 0);
04970         assert(io.total_read == 0);
04971         assert(io.total_write == 0);
04972         assert(io.total_size == 0);
04973         assert(io.total_size_known == 0);
04974         assert(io.timeout == 250000);
04975 
04976         d.display_throughput = 0;
04977         assert(parse_args(out, argc, argv) == 0);
04978 
04979 #ifdef PRINT_DEBUG
04980         print();
04981 #endif
04982         assert(d.start_time == 0);
04983         assert(d.total_time == 0);
04984         assert(d.current_time == 0);
04985         assert(d.elapsed_time == 0);
04986         assert(d.percent_complete == 0);
04987         assert(d.display_interval == 1);
04988         assert(d.overtime_flag == 0);
04989         assert(d.k == 1024);
04990         assert(d.twiddle == '-');
04991         assert(d.manual_width == 0); 
04992         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
04993         assert(d.display_datacount == 1);
04994         assert(d.display_throughput == 1);
04995         assert(d.display_time == 1);
04996         assert(d.display_percent == 1);
04997         assert(d.display_bar == 1);
04998         assert(d.display_summary == 1);
04999         assert(d.display_ansi == 0);
05000         assert(d.twiddle_fg_color == 0);
05001         assert(d.twiddle_bg_color == 0);
05002         assert(d.twiddle_fg_bold == 0);
05003         assert(d.datacount_fg_color == 0);
05004         assert(d.datacount_bg_color == 0);
05005         assert(d.datacount_fg_bold == 0);
05006         assert(d.throughput_label_fg_color == 0);
05007         assert(d.throughput_label_bg_color == 0);
05008         assert(d.throughput_label_fg_bold == 0);
05009         assert(d.throughput_fg_color == 0);
05010         assert(d.throughput_bg_color == 0);
05011         assert(d.throughput_fg_bold == 0);
05012         assert(d.time_label_fg_color == 0);
05013         assert(d.time_label_bg_color == 0);
05014         assert(d.time_label_fg_bold == 0);
05015         assert(d.percent_fg_color == 0);
05016         assert(d.percent_bg_color == 0);
05017         assert(d.percent_fg_bold == 0);
05018         assert(d.barbrace_fg_color == 0);
05019         assert(d.barbrace_bg_color == 0);
05020         assert(d.barbrace_fg_bold == 0);
05021         assert(d.bar_fg_color == 0);
05022         assert(d.bar_bg_color == 0);
05023         assert(d.bar_fg_bold == 0);
05024         assert(io.in == 0);
05025         assert(io.out == 1);
05026         assert(io.in_ready == 0);
05027         assert(io.out_ready == 0);
05028         assert(io.eof_in == 0);
05029         assert(io.eof_out == 0);
05030         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
05031         /* assert(io.cbuf == 0x0); */
05032         assert(io.last_read == 0);
05033         assert(io.last_write == 0);
05034         assert(io.total_read == 0);
05035         assert(io.total_write == 0);
05036         assert(io.total_size == 0);
05037         assert(io.total_size_known == 0);
05038         assert(io.timeout == 250000);
05039 }
05040 
05041 void test38(FILE* out)
05042 {
05043         int argc = 0;
05044         char *argv[256] = { 0 };
05045 
05046         argv[argc++] = "ProgramName";
05047         argv[argc++] = "-nth";
05048 
05049         displayInit();
05050         ioInit();
05051 
05052 #ifdef PRINT_DEBUG
05053         print();
05054 #endif
05055         assert(d.start_time == 0);
05056         assert(d.total_time == 0);
05057         assert(d.current_time == 0);
05058         assert(d.elapsed_time == 0);
05059         assert(d.percent_complete == 0);
05060         assert(d.display_interval == 1);
05061         assert(d.overtime_flag == 0);
05062         assert(d.k == 1024);
05063         assert(d.twiddle == '-');
05064         assert(d.manual_width == 0);
05065         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
05066         assert(d.display_datacount == 1);
05067         assert(d.display_throughput == 1);
05068         assert(d.display_time == 1);
05069         assert(d.display_percent == 1);
05070         assert(d.display_bar == 1);
05071         assert(d.display_summary == 1);
05072         assert(d.display_ansi == 0);
05073         assert(d.twiddle_fg_color == 0);
05074         assert(d.twiddle_bg_color == 0);
05075         assert(d.twiddle_fg_bold == 0);
05076         assert(d.datacount_fg_color == 0);
05077         assert(d.datacount_bg_color == 0);
05078         assert(d.datacount_fg_bold == 0);
05079         assert(d.throughput_label_fg_color == 0);
05080         assert(d.throughput_label_bg_color == 0);
05081         assert(d.throughput_label_fg_bold == 0);
05082         assert(d.throughput_fg_color == 0);
05083         assert(d.throughput_bg_color == 0);
05084         assert(d.throughput_fg_bold == 0);
05085         assert(d.time_label_fg_color == 0);
05086         assert(d.time_label_bg_color == 0);
05087         assert(d.time_label_fg_bold == 0);
05088         assert(d.percent_fg_color == 0);
05089         assert(d.percent_bg_color == 0);
05090         assert(d.percent_fg_bold == 0);
05091         assert(d.barbrace_fg_color == 0);
05092         assert(d.barbrace_bg_color == 0);
05093         assert(d.barbrace_fg_bold == 0);
05094         assert(d.bar_fg_color == 0);
05095         assert(d.bar_bg_color == 0);
05096         assert(d.bar_fg_bold == 0);
05097         assert(io.in == 0);
05098         assert(io.out == 1);
05099         assert(io.in_ready == 0);
05100         assert(io.out_ready == 0);
05101         assert(io.eof_in == 0);
05102         assert(io.eof_out == 0);
05103         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
05104         /* assert(io.cbuf == 0x0); */
05105         assert(io.last_read == 0);
05106         assert(io.last_write == 0);
05107         assert(io.total_read == 0);
05108         assert(io.total_write == 0);
05109         assert(io.total_size == 0);
05110         assert(io.total_size_known == 0);
05111         assert(io.timeout == 250000);
05112 
05113         assert(parse_args(out, argc, argv) == 0);
05114 
05115 #ifdef PRINT_DEBUG
05116         print();
05117 #endif
05118         assert(d.start_time == 0);
05119         assert(d.total_time == 0);
05120         assert(d.current_time == 0);
05121         assert(d.elapsed_time == 0);
05122         assert(d.percent_complete == 0);
05123         assert(d.display_interval == 1);
05124         assert(d.overtime_flag == 0);
05125         assert(d.k == 1024);
05126         assert(d.twiddle == '-');
05127         assert(d.manual_width == 0); 
05128         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
05129         assert(d.display_datacount == 1);
05130         assert(d.display_throughput == 0);
05131         assert(d.display_time == 1);
05132         assert(d.display_percent == 1);
05133         assert(d.display_bar == 1);
05134         assert(d.display_summary == 1);
05135         assert(d.display_ansi == 0);
05136         assert(d.twiddle_fg_color == 0);
05137         assert(d.twiddle_bg_color == 0);
05138         assert(d.twiddle_fg_bold == 0);
05139         assert(d.datacount_fg_color == 0);
05140         assert(d.datacount_bg_color == 0);
05141         assert(d.datacount_fg_bold == 0);
05142         assert(d.throughput_label_fg_color == 0);
05143         assert(d.throughput_label_bg_color == 0);
05144         assert(d.throughput_label_fg_bold == 0);
05145         assert(d.throughput_fg_color == 0);
05146         assert(d.throughput_bg_color == 0);
05147         assert(d.throughput_fg_bold == 0);
05148         assert(d.time_label_fg_color == 0);
05149         assert(d.time_label_bg_color == 0);
05150         assert(d.time_label_fg_bold == 0);
05151         assert(d.percent_fg_color == 0);
05152         assert(d.percent_bg_color == 0);
05153         assert(d.percent_fg_bold == 0);
05154         assert(d.barbrace_fg_color == 0);
05155         assert(d.barbrace_bg_color == 0);
05156         assert(d.barbrace_fg_bold == 0);
05157         assert(d.bar_fg_color == 0);
05158         assert(d.bar_bg_color == 0);
05159         assert(d.bar_fg_bold == 0);
05160         assert(io.in == 0);
05161         assert(io.out == 1);
05162         assert(io.in_ready == 0);
05163         assert(io.out_ready == 0);
05164         assert(io.eof_in == 0);
05165         assert(io.eof_out == 0);
05166         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
05167         /* assert(io.cbuf == 0x0); */
05168         assert(io.last_read == 0);
05169         assert(io.last_write == 0);
05170         assert(io.total_read == 0);
05171         assert(io.total_write == 0);
05172         assert(io.total_size == 0);
05173         assert(io.total_size_known == 0);
05174         assert(io.timeout == 250000);
05175 }
05176 
05177 void test39(FILE* out)
05178 {
05179         int argc = 0;
05180         char *argv[256] = { 0 };
05181 
05182         argv[argc++] = "ProgramName";
05183         argv[argc++] = "-dt";
05184 
05185         displayInit();
05186         ioInit();
05187 
05188 #ifdef PRINT_DEBUG
05189         print();
05190 #endif
05191         assert(d.start_time == 0);
05192         assert(d.total_time == 0);
05193         assert(d.current_time == 0);
05194         assert(d.elapsed_time == 0);
05195         assert(d.percent_complete == 0);
05196         assert(d.display_interval == 1);
05197         assert(d.overtime_flag == 0);
05198         assert(d.k == 1024);
05199         assert(d.twiddle == '-');
05200         assert(d.manual_width == 0);
05201         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
05202         assert(d.display_datacount == 1);
05203         assert(d.display_throughput == 1);
05204         assert(d.display_time == 1);
05205         assert(d.display_percent == 1);
05206         assert(d.display_bar == 1);
05207         assert(d.display_summary == 1);
05208         assert(d.display_ansi == 0);
05209         assert(d.twiddle_fg_color == 0);
05210         assert(d.twiddle_bg_color == 0);
05211         assert(d.twiddle_fg_bold == 0);
05212         assert(d.datacount_fg_color == 0);
05213         assert(d.datacount_bg_color == 0);
05214         assert(d.datacount_fg_bold == 0);
05215         assert(d.throughput_label_fg_color == 0);
05216         assert(d.throughput_label_bg_color == 0);
05217         assert(d.throughput_label_fg_bold == 0);
05218         assert(d.throughput_fg_color == 0);
05219         assert(d.throughput_bg_color == 0);
05220         assert(d.throughput_fg_bold == 0);
05221         assert(d.time_label_fg_color == 0);
05222         assert(d.time_label_bg_color == 0);
05223         assert(d.time_label_fg_bold == 0);
05224         assert(d.percent_fg_color == 0);
05225         assert(d.percent_bg_color == 0);
05226         assert(d.percent_fg_bold == 0);
05227         assert(d.barbrace_fg_color == 0);
05228         assert(d.barbrace_bg_color == 0);
05229         assert(d.barbrace_fg_bold == 0);
05230         assert(d.bar_fg_color == 0);
05231         assert(d.bar_bg_color == 0);
05232         assert(d.bar_fg_bold == 0);
05233         assert(io.in == 0);
05234         assert(io.out == 1);
05235         assert(io.in_ready == 0);
05236         assert(io.out_ready == 0);
05237         assert(io.eof_in == 0);
05238         assert(io.eof_out == 0);
05239         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
05240         /* assert(io.cbuf == 0x0); */
05241         assert(io.last_read == 0);
05242         assert(io.last_write == 0);
05243         assert(io.total_read == 0);
05244         assert(io.total_write == 0);
05245         assert(io.total_size == 0);
05246         assert(io.total_size_known == 0);
05247         assert(io.timeout == 250000);
05248 
05249         d.display_time = 0;
05250         assert(parse_args(out, argc, argv) == 0);
05251 
05252 #ifdef PRINT_DEBUG
05253         print();
05254 #endif
05255         assert(d.start_time == 0);
05256         assert(d.total_time == 0);
05257         assert(d.current_time == 0);
05258         assert(d.elapsed_time == 0);
05259         assert(d.percent_complete == 0);
05260         assert(d.display_interval == 1);
05261         assert(d.overtime_flag == 0);
05262         assert(d.k == 1024);
05263         assert(d.twiddle == '-');
05264         assert(d.manual_width == 0); 
05265         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
05266         assert(d.display_datacount == 1);
05267         assert(d.display_throughput == 1);
05268         assert(d.display_time == 1);
05269         assert(d.display_percent == 1);
05270         assert(d.display_bar == 1);
05271         assert(d.display_summary == 1);
05272         assert(d.display_ansi == 0);
05273         assert(d.twiddle_fg_color == 0);
05274         assert(d.twiddle_bg_color == 0);
05275         assert(d.twiddle_fg_bold == 0);
05276         assert(d.datacount_fg_color == 0);
05277         assert(d.datacount_bg_color == 0);
05278         assert(d.datacount_fg_bold == 0);
05279         assert(d.throughput_label_fg_color == 0);
05280         assert(d.throughput_label_bg_color == 0);
05281         assert(d.throughput_label_fg_bold == 0);
05282         assert(d.throughput_fg_color == 0);
05283         assert(d.throughput_bg_color == 0);
05284         assert(d.throughput_fg_bold == 0);
05285         assert(d.time_label_fg_color == 0);
05286         assert(d.time_label_bg_color == 0);
05287         assert(d.time_label_fg_bold == 0);
05288         assert(d.percent_fg_color == 0);
05289         assert(d.percent_bg_color == 0);
05290         assert(d.percent_fg_bold == 0);
05291         assert(d.barbrace_fg_color == 0);
05292         assert(d.barbrace_bg_color == 0);
05293         assert(d.barbrace_fg_bold == 0);
05294         assert(d.bar_fg_color == 0);
05295         assert(d.bar_bg_color == 0);
05296         assert(d.bar_fg_bold == 0);
05297         assert(io.in == 0);
05298         assert(io.out == 1);
05299         assert(io.in_ready == 0);
05300         assert(io.out_ready == 0);
05301         assert(io.eof_in == 0);
05302         assert(io.eof_out == 0);
05303         assert(io.buffer_size == DEFAULT_BUFFER_SIZE);
05304         /* assert(io.cbuf == 0x0); */
05305         assert(io.last_read == 0);
05306         assert(io.last_write == 0);
05307         assert(io.total_read == 0);
05308         assert(io.total_write == 0);
05309         assert(io.total_size == 0);
05310         assert(io.total_size_known == 0);
05311         assert(io.timeout == 250000);
05312 }
05313 
05314 void test40(FILE* out)
05315 {
05316         int argc = 0;
05317         char *argv[256] = { 0 };
05318 
05319         argv[argc++] = "ProgramName";
05320         argv[argc++] = "-nt";
05321 
05322         displayInit();
05323         ioInit();
05324 
05325 #ifdef PRINT_DEBUG
05326         print();
05327 #endif
05328         assert(d.start_time == 0);
05329         assert(d.total_time == 0);
05330         assert(d.current_time == 0);
05331         assert(d.elapsed_time == 0);
05332         assert(d.percent_complete == 0);
05333         assert(d.display_interval == 1);
05334         assert(d.overtime_flag == 0);
05335         assert(d.k == 1024);
05336         assert(d.twiddle == '-');
05337         assert(d.manual_width == 0);
05338         assert(d.display_twiddle == DEFAULT_DISPLAY_TWIDDLE);
05339         assert(d.display_datacount == 1);
05340         assert(d.display_throughput == 1);
05341         assert(d.display_time == 1);
05342         assert(d.display_percent == 1);
05343         assert(d.display_bar == 1);
05344         assert(d.display_summary == 1);
05345         assert(d.display_ansi == 0);
05346         assert(d.twiddle_fg_color == 0);
05347         assert(d.twiddle_bg_color == 0);
05348         assert(d.twiddle_fg_bold == 0);
05349         assert(d.datacount_fg_color == 0);
05350         assert(d.datacount_bg_color == 0);
05351         assert(d.datacount_fg_bold == 0);
05352         assert(d.throughput_label_fg_color == 0);
05353         assert(d.throughput_label_bg_color == 0);
05354         assert(d.throughput_label_fg_bold == 0);
05355         assert(d.throughput_fg_color == 0);
05356         assert(d.throughput_bg_color == 0);
05357         assert(d.throughput_fg_bold == 0);
05358         assert(d.time_label_fg_color == 0);
05359         assert(d.time_label_bg_color == 0);
05360         assert(d.time_label_fg_bold == 0);
05361         assert(d.percent_fg_color == 0);
05362         assert(d.percent_bg_color == 0);
05363         assert(d.percent_fg_bold == 0);
05364         assert(d.barbrace_fg_color == 0);
05365         assert(d.barbrace_bg_color == 0);
05366         assert(d.barbrace_fg_bold == 0);
05367         assert(d.bar_fg_color == 0);
05368         assert(d.bar_bg_color == 0);
05369         assert(d.bar_fg_bold == 0);
05370         assert(io.in == 0);
05371         assert(io.out == 1);
05372         assert(io.in_ready == 0);
05373         assert(io.