Changeset 2563 for zzuf/trunk/test


Ignore:
Timestamp:
Jul 18, 2008, 11:28:06 AM (12 years ago)
Author:
Sam Hocevar
Message:
  • Add slightly more complex modes to zzcat.
Location:
zzuf/trunk/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/test/check-utils

    r2561 r2563  
    2121            check "$ZZOPTS" "< $file" "zzuf"
    2222        fi
    23         for n in 0 10 11 12 20 21 22; do
     23        for n in 0 20 21 22 30 31 40 41 42; do
    2424            check "$ZZOPTS" "$ZZCAT $n $file" "zzcat $n"
    2525        done
  • zzuf/trunk/test/zzcat.c

    r2561 r2563  
    7676    switch(atoi(argv[1]))
    7777    {
     78    /* 0x: simple fd calls
     79     * 1x: complex fd calls */
    7880    case 0: /* only read() calls */
    7981        fd = open(name, O_RDONLY);
     
    8486        close(fd);
    8587        break;
    86     case 10: /* only fread() calls */
     88    /* 2x: simple stdio calls
     89     * 3x: complex stdio calls */
     90    case 20: /* only fread() calls */
    8791        stream = fopen(name, "r");
    8892        if(!stream)
     
    9296        fclose(stream);
    9397        break;
    94     case 11: /* only getc() calls */
     98    case 21: /* only getc() calls */
    9599        stream = fopen(name, "r");
    96100        if(!stream)
     
    100104        fclose(stream);
    101105        break;
    102     case 12: /* only fgetc() calls */
     106    case 22: /* only fgetc() calls */
    103107        stream = fopen(name, "r");
    104108        if(!stream)
     
    108112        fclose(stream);
    109113        break;
    110     case 20: /* socket seeks and reads */
     114    case 30: /* one fread(), then only getc() calls */
     115        stream = fopen(name, "r");
     116        if(!stream)
     117            return EXIT_FAILURE;
     118        fread(data, 1, 10, stream);
     119        for(i = 10; i < len; i++)
     120            data[i] = getc(stream);
     121        fclose(stream);
     122        break;
     123    case 31: /* one fread(), then only fgetc() calls */
     124        stream = fopen(name, "r");
     125        if(!stream)
     126            return EXIT_FAILURE;
     127        fread(data, 1, 10, stream);
     128        for(i = 10; i < len; i++)
     129            data[i] = fgetc(stream);
     130        fclose(stream);
     131        break;
     132    /* 4x: complex, random stuff */
     133    case 40: /* socket seeks and reads */
    111134        fd = open(name, O_RDONLY);
    112135        if(fd < 0)
     
    125148        close(fd);
    126149        break;
    127     case 21: /* std streams seeks and reads */
     150    case 41: /* std streams seeks and reads */
    128151        stream = fopen(name, "r");
    129152        if(!stream)
     
    146169        fclose(stream);
    147170        break;
    148     case 22: /* mmap() */
     171    case 42: /* mmap() */
    149172        fd = open(name, O_RDONLY);
    150173        if(fd < 0)
Note: See TracChangeset for help on using the changeset viewer.