#!/bin/sh

. ${srcdir=.}/t.frame

CFG="$TMPDIR/test.cf"
OUT="$TMPDIR"/test.out
CORRECT="$SYSTEST/outputs/queue_id.ref"

cat <<EOF > "$CFG"
# include queue ID
# suppress timestamps & version info in output
header_format=%h: %c, queue_id=%Q
EOF

# build wordlists
$BOGOFILTER -n -v -D -c "$CFG" -M -B "${srcdir}"/inputs/good.mbx > /dev/null
$BOGOFILTER -s -v -D -c "$CFG" -M -B "${srcdir}"/inputs/spam.mbx > /dev/null

$BOGOFILTER -v -D -c "$CFG" -M -B "${srcdir}"/inputs/good.mbx \
    ${srcdir}/inputs/spam.mbx \
| sed 's}.*/inputs/}inputs/}' > "$OUT"

# compare test output to reference output

if  [ $verbose -eq 0 ]; then
    cmp "$CORRECT" "$OUT"
else
    diff $DIFF_BRIEF "$CORRECT" "$OUT"
fi
