Ignore:
Timestamp:
Jul 20, 2008, 11:57:58 AM (12 years ago)
Author:
Sam Hocevar
Message:
  • Factored the test suite to avoid excessive code duplication.
File:
1 edited

Legend:

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

    r2549 r2573  
    11#!/bin/sh
    22
    3 set -e
     3. "$(dirname "$0")/functions.inc"
    44
    55checkmd5()
     
    99    printf " $(echo "$CMD .............................." | cut -b1-30) "
    1010    MD5="$(eval "$CMD | $ZZUF -m -r0" 2>/dev/null | cut -f2 -d' ')"
    11     TESTED=$(($TESTED + 1))
    1211    if [ "$MD5" != "$REFMD5" ]; then
    13         FAILED=$(($FAILED + 1))
    14         echo "$MD5 FAILED"
     12        fail_test "$MD5 FAILED"
    1513    else
    16         echo 'ok'
     14        pass_test 'ok'
    1715    fi
    1816}
    1917
    20 DIR="$(dirname "$0")"
    21 ZZUF="$DIR/../src/zzuf"
    22 FAILED=0
    23 TESTED=0
    24 
    25 echo "*** running zzuf MD5 test ***"
     18start_test "zzuf MD5 test"
    2619
    2720checkmd5 "printf ''" d41d8cd98f00b204e9800998ecf8427e
     
    2922checkmd5 "printf 'hello world'" 5eb63bbbe01eeed093cb22bb8f5acdc3
    3023
    31 if [ "$FAILED" != 0 ]; then
    32     echo "*** $FAILED tests failed out of $TESTED ***"
    33     exit 1
    34 fi
    35 echo "*** all $TESTED tests OK ***"
     24stop_test
    3625
    37 exit 0
    38 
Note: See TracChangeset for help on using the changeset viewer.