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

Last change on this file since 4253 was 4253, checked in by sam, 5 years ago

Fix copyright information and remove Id tag everywhere.

  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#!/bin/sh
2#
3#  check-md5 - check that zzuf properly computes md5 checksums
4#  Copyright (c) 2008-2010 Sam Hocevar <sam@hocevar.net>
5#                All Rights Reserved
6#
7#  This program is free software. It comes without any warranty, to
8#  the extent permitted by applicable law. You can redistribute it
9#  and/or modify it under the terms of the Do What The Fuck You Want
10#  To Public License, Version 2, as published by Sam Hocevar. See
11#  http://sam.zoy.org/wtfpl/COPYING for more details.
12#
13
14. "$(dirname "$0")/functions.inc"
15
16checkmd5()
17{
18    CMD="$1"
19    REFMD5="$2"
20    printf " $(echo "$CMD .............................." | cut -b1-30) "
21    MD5="$(eval "$CMD | $ZZUF -m -r0" 2>/dev/null | cut -f2 -d' ')"
22    if [ "$MD5" != "$REFMD5" ]; then
23        fail_test "$MD5 FAILED"
24    else
25        pass_test 'ok'
26    fi
27}
28
29start_test "zzuf MD5 test"
30
31checkmd5 "printf ''" d41d8cd98f00b204e9800998ecf8427e
32checkmd5 echo 68b329da9893e34099c7d8ad5cb9c940
33checkmd5 "printf 'hello world'" 5eb63bbbe01eeed093cb22bb8f5acdc3
34
35stop_test
36
Note: See TracBrowser for help on using the repository browser.