37 lines
992 B
Bash
Executable File
37 lines
992 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# check-zzuf-m-md5 - test "zzuf -m" flag (md5 checksums)
|
|
#
|
|
# Copyright © 2002—2015 Sam Hocevar <sam@hocevar.net>
|
|
#
|
|
# This program is free software. It comes without any warranty, to
|
|
# the extent permitted by applicable law. You can redistribute it
|
|
# and/or modify it under the terms of the Do What the Fuck You Want
|
|
# to Public License, Version 2, as published by the WTFPL Task Force.
|
|
# See http://www.wtfpl.net/ for more details.
|
|
#
|
|
|
|
. "$(dirname "$0")/functions.inc"
|
|
|
|
checkmd5()
|
|
{
|
|
CMD="$1"
|
|
REFMD5="$2"
|
|
printf " $(echo "$CMD .............................." | cut -b1-30) "
|
|
MD5="$(eval "$CMD | $ZZUF -m -r0" 2>/dev/null | cut -f2 -d' ')"
|
|
if [ "$MD5" != "$REFMD5" ]; then
|
|
fail_test "$MD5 FAILED"
|
|
else
|
|
pass_test 'ok'
|
|
fi
|
|
}
|
|
|
|
start_test "zzuf -m test"
|
|
|
|
checkmd5 "printf ''" d41d8cd98f00b204e9800998ecf8427e
|
|
checkmd5 echo 68b329da9893e34099c7d8ad5cb9c940
|
|
checkmd5 "printf 'hello world'" 5eb63bbbe01eeed093cb22bb8f5acdc3
|
|
|
|
stop_test
|
|
|