#!/bin/sh

. ${srcdir=.}/t.frame

INP="$TMPDIR/test.inp"
REF="$TMPDIR"/test.ref
OUT="$TMPDIR/test.out"
CORRECT="$SYSTEST/outputs/multiple.wordlists.ref"

cat <<EOF > "$INP"
aaa 
bbb ccc
ddd eee fff
EOF

cat <<EOF > "$REF"
::: 1 :::
aaa
bbb
ccc
ddd
eee
fff
::: 2 :::
aaa
bbb
aaa*bbb
ccc
bbb*ccc
ddd
ccc*ddd
eee
ddd*eee
fff
eee*fff
::: 3 :::
aaa
bbb
aaa*bbb
ccc
bbb*ccc
aaa*bbb*ccc
ddd
ccc*ddd
bbb*ccc*ddd
eee
ddd*eee
ccc*ddd*eee
fff
eee*fff
ddd*eee*fff
::: 4 :::
aaa
bbb
aaa*bbb
ccc
bbb*ccc
aaa*bbb*ccc
ddd
ccc*ddd
bbb*ccc*ddd
aaa*bbb*ccc*ddd
eee
ddd*eee
ccc*ddd*eee
bbb*ccc*ddd*eee
fff
eee*fff
ddd*eee*fff
ccc*ddd*eee*fff
::: 5 :::
aaa
bbb
aaa*bbb
ccc
bbb*ccc
aaa*bbb*ccc
ddd
ccc*ddd
bbb*ccc*ddd
aaa*bbb*ccc*ddd
eee
ddd*eee
ccc*ddd*eee
bbb*ccc*ddd*eee
aaa*bbb*ccc*ddd*eee
fff
eee*fff
ddd*eee*fff
ccc*ddd*eee*fff
bbb*ccc*ddd*eee*fff
EOF

for COUNT in 1 2 3 4 5 ; do
    echo "::: $COUNT :::" >> $OUT
    $BOGOLEXER -C -H -p --multi-token-count $COUNT < "$INP" >> "$OUT"
done

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