#! /bin/sh

LQTEXTDIR=`pwd`
export LQTEXTDIR

PATH=../../lqtext:../../filters:../../bin:$PATH
export PATH

CMDNAME=$0
export CMDNAME

echo "@@@@ ${CMDNAME}: start: `date`"
echo "@@@@ ${CMDNAME}: making files"

./mkfiles || {
    echo "@@@@ FAIL ${CMDNAME} at mkfiles, `date`"
    exit 1
}

echo y | lqclean

for i in "-w100" "-w1000" "-w5000" ""
do
    echo "@@@@ ${CMDNAME}: making index, options: $i"

    lqaddfile -t2 $i `ls files` || {
	echo "@@@@ FAIL ${CMDNAME} at lqaddfile $i, `date`"
	exit 1
    }

    echo "@@@@ ${CMDNAME}: testing index built with options: $i"

    lqword -A > /dev/null || {
	echo "@@@@ FAIL ${CMDNAME} at lqword, `date`"
	exit 1
    }

    echo y | lqclean -f

    echo "@@@@ ${CMDNAME}: PASS"


done

echo "@@@@ ${CMDNAME}: end: `date` -- all tests passed"
exit 0
