#!/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"
a b2 cc3
aa3 bbb4 cc3 ddd4 ee3 fff4
EOF

cat <<EOF > "$REF"
::: 1 2 :::
a
b2
a*b2
cc3
b2*cc3
aa3
cc3*aa3
bbb4
aa3*bbb4
cc3
bbb4*cc3
ddd4
cc3*ddd4
ee3
ddd4*ee3
fff4
ee3*fff4
::: 1 3 :::
a
b2
a*b2
cc3
b2*cc3
a*b2*cc3
aa3
cc3*aa3
b2*cc3*aa3
bbb4
aa3*bbb4
cc3*aa3*bbb4
cc3
bbb4*cc3
aa3*bbb4*cc3
ddd4
cc3*ddd4
bbb4*cc3*ddd4
ee3
ddd4*ee3
cc3*ddd4*ee3
fff4
ee3*fff4
ddd4*ee3*fff4
::: 2 2 :::
b2
cc3
b2*cc3
aa3
cc3*aa3
bbb4
aa3*bbb4
cc3
bbb4*cc3
ddd4
cc3*ddd4
ee3
ddd4*ee3
fff4
ee3*fff4
::: 2 3 :::
b2
cc3
b2*cc3
aa3
cc3*aa3
b2*cc3*aa3
bbb4
aa3*bbb4
cc3*aa3*bbb4
cc3
bbb4*cc3
aa3*bbb4*cc3
ddd4
cc3*ddd4
bbb4*cc3*ddd4
ee3
ddd4*ee3
cc3*ddd4*ee3
fff4
ee3*fff4
ddd4*ee3*fff4
EOF

for MIN in 1 2 ; do
    for MUL in 2 3 ; do
	echo "::: $MIN $MUL :::" >> "$OUT"
	$BOGOLEXER -C -H -p --min-token-len $MIN --multi-token-count $MUL < "$INP" >> "$OUT"
    done
done

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