source: zzuf/trunk/test/check-md5 @ 2549

Last change on this file since 2549 was 2549, checked in by Sam Hocevar, 12 years ago
  • Oops, forgot to check in check-md5.
  • Property svn:executable set to *
File size: 776 bytes
Line 
1#!/bin/sh
2
3set -e
4
5checkmd5()
6{
7    CMD="$1"
8    REFMD5="$2"
9    printf " $(echo "$CMD .............................." | cut -b1-30) "
10    MD5="$(eval "$CMD | $ZZUF -m -r0" 2>/dev/null | cut -f2 -d' ')"
11    TESTED=$(($TESTED + 1))
12    if [ "$MD5" != "$REFMD5" ]; then
13        FAILED=$(($FAILED + 1))
14        echo "$MD5 FAILED"
15    else
16        echo 'ok'
17    fi
18}
19
20DIR="$(dirname "$0")"
21ZZUF="$DIR/../src/zzuf"
22FAILED=0
23TESTED=0
24
25echo "*** running zzuf MD5 test ***"
26
27checkmd5 "printf ''" d41d8cd98f00b204e9800998ecf8427e
28checkmd5 echo 68b329da9893e34099c7d8ad5cb9c940
29checkmd5 "printf 'hello world'" 5eb63bbbe01eeed093cb22bb8f5acdc3
30
31if [ "$FAILED" != 0 ]; then
32    echo "*** $FAILED tests failed out of $TESTED ***"
33    exit 1
34fi
35echo "*** all $TESTED tests OK ***"
36
37exit 0
38
Note: See TracBrowser for help on using the repository browser.