Changeset 1496 for zzuf/trunk/test


Ignore:
Timestamp:
Dec 17, 2006, 11:12:11 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • Better, more complete testsuite program.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/test/testsuite.sh

    r1495 r1496  
    11#!/bin/sh
     2
     3check()
     4{
     5    RATIO="$1"
     6    CMD="$2"
     7    $ZZUF -r $RATIO $CMD 2>/dev/null | md5sum
     8}
    29
    310ZZUF="$(dirname "$0")/../src/zzuf"
    411
    5 echo "Testing zzuf on itself:"
    6 MD5_CAT=$($ZZUF cat $ZZUF | md5sum)
    7 echo " - cat:          $MD5_CAT"
    8 MD5_DD_1=$($ZZUF dd if=$ZZUF bs=1 2>/dev/null | md5sum)
    9 echo " - dd(bs=1):     $MD5_DD_1"
    10 MD5_DD_1024=$($ZZUF dd if=$ZZUF bs=1024 2>/dev/null | md5sum)
    11 echo " - dd(bs=1024):  $MD5_DD_1024"
     12for file in /etc/passwd $ZZUF; do
     13    for r in 0.0 0.001 0.01 0.1 1; do
     14        echo "Testing zzuf on $file, ratio $r:"
     15        echo "-  cat          $(check $r "cat $file")"
     16# don't do grep, it adds a newline at EOF!
     17#        echo "-  grep -a ''   $(check $r "grep -- -a \\'\\' $file")"
     18        echo "-  sed n        $(check $r "sed n $file")"
     19        echo "-  dd(bs=1)     $(check $r "dd bs=1 if=$file")"
     20        echo "-  dd(bs=1024)  $(check $r "dd bs=1024 if=$file")"
     21        echo "-  dd(bs=1111)  $(check $r "dd bs=1111 if=$file")"
     22        echo "-  dd(bs=65536) $(check $r "dd bs=65536 if=$file")"
     23    done
     24done
    1225
Note: See TracChangeset for help on using the changeset viewer.