1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#!/bin/bash -eu
RRED=../diffindex-rred
RC=0
for t in [0-9]*.in ; do
n=${t%.in}
echo -n Test $n:
if ! $RRED $n.diff* < $t > $n.out ; then
echo FAILED
RC=1
elif ! cmp $n.wanted $n.out 2> /dev/null; then
echo FAILED "(unexpexted output)"
RC=1
else
echo PASS
rm $n.out
fi
done
for t in F*.in ; do
n=${t%.in}
echo -n Test $n:
if $RRED $n.diff* < $t > $n.out 2> $n.stderr; then
echo FAILED "(returned 0 but should have exited with error)"
RC=1
elif [ ! -s $n.stderr ]; then
echo FAILED "(should have given some error message)"
RC=1
else
echo PASS
rm $n.out $n.stderr
fi
done
# do some more tests aplying two diffs at the same time
for i1 in {01,02,03,07,08}.in ; do
for i2 in {01,02,03,07,08}.in ; do
for i3 in {01,02,03,07,08}.in ; do
n1=${i1%.in}
n2=${i2%.in}
n3=${i3%.in}
echo -n Test "$n1->$n2->$n3:"
diff --ed $i1 $i2 > $n1.$n2.1.tmp || true
diff --ed $i2 $i3 > $n2.$n3.2.tmp || true
if ! $RRED $n1.$n2.1.tmp $n2.$n3.2.tmp < $i1 > $n1.$n2.$n3.out ; then
echo FAILED
RC=1
elif ! cmp $n1.$n2.$n3.out $i3 2> /dev/null ; then
echo FAILED "(unexpexted output)"
RC=1
else
echo PASS
rm $n1.$n2.$n3.out $n1.$n2.1.tmp $n2.$n3.2.tmp
fi
done
done
done
exit $RC
|