source: zzuf/trunk/test/check-memory @ 2548

Last change on this file since 2548 was 2548, checked in by Sam Hocevar, 12 years ago
  • Add a unit test for MD5 hashes.
  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/bin/sh
2
3set -e
4
5DIR="$(dirname "$0")"
6ZZUF="$DIR/../src/zzuf"
7PROGRAM="$DIR/bug-memory"
8if [ ! -f "$PROGRAM" ]; then
9  echo "error: test/bug-memory is missing"
10  exit 1
11fi
12FAILED=0
13TESTED=0
14
15if [ -z "$1" ]; then
16  seed=$(date | $ZZUF -m 2>/dev/null | cut -f2 -d' ' | tr -d abcdef | cut -b1-8)
17else
18  seed="$1"
19fi
20
21echo "*** running zzuf buffer memory test with seed $seed ***"
22
23echo "*** bug-memory < /file-00"
24if ! $PROGRAM < "$DIR/file-00"; then
25    echo " unexpected exit status $?"
26    FAILED="$(($FAILED + 1))"
27else
28    echo " OK"
29fi
30TESTED="$(($TESTED + 1))"
31
32echo "*** zzuf -qi -r0 bug-memory < /file-00"
33if ! "$ZZUF" -r0 -qi "$PROGRAM" < "$DIR/file-00"; then
34    echo " unexpected exit status $?"
35    FAILED="$(($FAILED + 1))"
36else
37    echo " OK"
38fi
39TESTED="$(($TESTED + 1))"
40
41echo "*** zzuf -qi bug-memory < file-00"
42if "$ZZUF" -M 256 -qi "$PROGRAM" < "$DIR/file-00"; then
43    echo " unexpected exit status $?"
44    FAILED="$(($FAILED + 1))"
45else
46    echo " OK"
47fi
48TESTED="$(($TESTED + 1))"
49
50if [ "$FAILED" != 0 ]; then
51    echo "*** $FAILED tests failed out of $TESTED ***"
52    exit 1
53fi
54echo "*** all $TESTED tests OK ***"
55
56exit 0
57
Note: See TracBrowser for help on using the repository browser.