* Better, more complete testsuite program.

This commit is contained in:
Sam Hocevar 2006-12-17 22:12:11 +00:00 committed by sam
parent 690f129147
commit 9e73ecf297

View File

@ -1,12 +1,25 @@
#!/bin/sh
check()
{
RATIO="$1"
CMD="$2"
$ZZUF -r $RATIO $CMD 2>/dev/null | md5sum
}
ZZUF="$(dirname "$0")/../src/zzuf"
echo "Testing zzuf on itself:"
MD5_CAT=$($ZZUF cat $ZZUF | md5sum)
echo " - cat: $MD5_CAT"
MD5_DD_1=$($ZZUF dd if=$ZZUF bs=1 2>/dev/null | md5sum)
echo " - dd(bs=1): $MD5_DD_1"
MD5_DD_1024=$($ZZUF dd if=$ZZUF bs=1024 2>/dev/null | md5sum)
echo " - dd(bs=1024): $MD5_DD_1024"
for file in /etc/passwd $ZZUF; do
for r in 0.0 0.001 0.01 0.1 1; do
echo "Testing zzuf on $file, ratio $r:"
echo "- cat $(check $r "cat $file")"
# don't do grep, it adds a newline at EOF!
# echo "- grep -a '' $(check $r "grep -- -a \\'\\' $file")"
echo "- sed n $(check $r "sed n $file")"
echo "- dd(bs=1) $(check $r "dd bs=1 if=$file")"
echo "- dd(bs=1024) $(check $r "dd bs=1024 if=$file")"
echo "- dd(bs=1111) $(check $r "dd bs=1111 if=$file")"
echo "- dd(bs=65536) $(check $r "dd bs=65536 if=$file")"
done
done