Changeset 1548 for zzuf/trunk/test


Ignore:
Timestamp:
Jan 3, 2007, 10:51:11 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • Added a stupid PRNG to streamcat and fdcat.
  • Do not use sed in the testsuite, because of OS X.
Location:
zzuf/trunk/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/test/fdcat.c

    r1543 r1548  
    2525#include <string.h>
    2626
     27static inline int myrand(void)
     28{
     29    static int seed = 1;
     30    int x, y;
     31    x = (seed + 0x12345678) << 11;
     32    y = (seed + 0xfedcba98) >> 21;
     33    seed = x * 1010101 + y * 343434;
     34    return seed;
     35}
     36
    2737int main(int argc, char *argv[])
    2838{
     
    3040    unsigned char *data;
    3141    int i, j, fd;
    32 
    33     srand(0);
    3442
    3543    if(argc != 2)
     
    5260    for(i = 0; i < 128; i++)
    5361    {
    54         lseek(fd, rand() % pos, SEEK_SET);
     62        lseek(fd, myrand() % pos, SEEK_SET);
    5563        for(j = 0; j < 16; j++)
    56             read(fd, data + lseek(fd, 0, SEEK_CUR), rand() % 4096);
     64            read(fd, data + lseek(fd, 0, SEEK_CUR), myrand() % 4096);
    5765#ifdef HAVE_LSEEK64
    58         lseek64(fd, rand() % pos, SEEK_SET);
     66        lseek64(fd, myrand() % pos, SEEK_SET);
    5967        for(j = 0; j < 16; j++)
    60             read(fd, data + lseek(fd, 0, SEEK_CUR), rand() % 4096);
     68            read(fd, data + lseek(fd, 0, SEEK_CUR), myrand() % 4096);
    6169#endif
    6270    }
  • zzuf/trunk/test/streamcat.c

    r1521 r1548  
    1919#include <string.h>
    2020
     21static inline int myrand(void)
     22{
     23    static int seed = 1;
     24    int x, y;
     25    x = (seed + 0x12345678) << 11;
     26    y = (seed + 0xfedcba98) >> 21;
     27    seed = x * 1010101 + y * 343434;
     28    return seed;
     29}
     30
    2131int main(int argc, char *argv[])
    2232{
     
    2535    int i, j;
    2636    FILE *stream;
    27 
    28     srand(0);
    2937
    3038    if(argc != 2)
     
    4957    {
    5058        long int now;
    51         fseek(stream, rand() % pos, SEEK_SET);
     59        fseek(stream, myrand() % pos, SEEK_SET);
    5260        for(j = 0; j < 16; j++)
    53             fread(data + ftell(stream), rand() % 4096, 1, stream);
    54         fseek(stream, rand() % pos, SEEK_SET);
     61            fread(data + ftell(stream), myrand() % 4096, 1, stream);
     62        fseek(stream, myrand() % pos, SEEK_SET);
    5563        now = ftell(stream);
    5664        for(j = 0; j < 16; j++)
  • zzuf/trunk/test/testsuite.sh

    r1545 r1548  
    7070        # at the end of its input if it was not there initially.
    7171        #check $seed $r "grep -- -a \\'\\' $file" "grep -a"
    72         check $seed $r "-- sed -e n $file" "sed n"
     72        # We don't include sed in the testsuite because on OS X in also
     73        # puts a newline. Crap.
     74        #check $seed $r "-- sed -e n $file" "sed n"
    7375        check $seed $r "dd bs=65536 if=$file" "dd(bs=65536)"
    7476        check $seed $r "dd bs=1111 if=$file" "dd(bs=1111)"
Note: See TracChangeset for help on using the changeset viewer.