############################ -*- Mode: Makefile -*- ###########################
## Imakefile -- 
## ITIID           : $ITI$ $Header $__Header$
## Author          : Ulrich Pfeifer
## Created On      : Fri Feb 25 13:30:41 1994
## Last Modified By: Ulrich Pfeifer
## Last Modified On: Fri May 27 14:03:32 1994
## Update Count    : 86
## Status          : Unknown, Use with caution!
###############################################################################

#include "../Install.tmpl"
        WAISINDEX = ../ir/waisindex
            WAISQ = ../ui/waisq
       WAISSEARCH = ../ui/waissearch
            SWAIS = ../ui/swais
             SRCG = TEST TEST.german
              SRC = TEST
         RESFILES = \
                test.cat \
                test.doc \
                test.doc \
                test.fn \
                test.hl \
                test.inv \
                test.src \
                test.dct \
                test_field_au.inv \
                test_field_ck.inv \
                test_field_jt.inv \
                test_field_names.inv \
                test_field_py.inv \
                test_field_ti.inv \
                test_field_au.dct \
                test_field_ck.dct \
                test_field_py.dct \
                test_field_ti.dct \
                test_field_jt.dct \
                testg.cat \
                testg.doc \
                testg.doc \
                testg.fn \
                testg.hl \
                testg.inv \
                testg.src \
                testg.dct \
                testg_field_au.inv \
                testg_field_ck.inv \
                testg_field_jt.inv \
                testg_field_names.inv \
                testg_field_py.inv \
                testg_field_ti.inv \
                testg_field_au.dct \
                testg_field_ck.dct \
                testg_field_py.dct \
                testg_field_ti.dct \
                testg_field_jt.dct

        HELPFILES = \
                test.index.lock \
                test.query.lock \
                test.update.lock \
                testg.index.lock \
                testg.query.lock \
                testg.update.lock

all:: $(WAISINDEX) testg.doc test.doc test

test.doc: $(SRC) $(WAISINDEX)
	$(WAISINDEX) -t fields -d test $(SRC) 

testg.doc: $(SRCG) $(WAISINDEX)
	$(WAISINDEX) -t fields -d testg $(SRCG) 

clean::
	$(RM) $(HELPFILES) 

veryclean:: clean
	$(RM) $(RESFILES) 
itest:
	$(SWAIS) -S . -s test.src

$(SWAIS):
	cd ../ui; $(MAKE) $(SWAIS) 

$(WAISINDEX):
	cd ../ir; $(MAKE) $(WAISINDEX) 

DependTarget()


/* Tests */

#define TestQuery(testname, words)                                      @@\
test:: testname								@@\
									@@\
testname: Concat(DATABASE,.doc)                                         @@\
	@(echo q;echo q) | $(WAISSEARCH) -d DATABASE words > \
		 Concat(testname,.is) 2>&1				@@\
	@if $(DIFF) Concat(testname,.is) Concat(testname,.should) \
		> /dev/null ; then \
	   echo Test testname is ok; \
	else \
	   echo Test testname failed; \
	fi;								@@\
									@@\
init:: Concat(init-,testname)						@@\
									@@\
Concat(init-,testname):	 Concat(DATABASE,.doc)                          @@\
	(echo q;echo q) | $(WAISSEARCH) -d DATABASE words > \
		Concat(testname,.should) 2>&1	  @@\
									@@\
clean::									@@\
	$(RM) Concat(testname,.is)					@@\
/*
veryclean::								@@\
	$(RM) Concat(testname,.should)
*/

#undef BOOLEAN
#undef LITERAL


#define DATABASE test
TestQuery(PLAIN,Signature File)
TestQuery(BOOLEAN,peter schauble or retrieval and Xin)
TestQuery(FIELD,au=schauble)
TestQuery(NUMERIC,py==1993)
TestQuery(COMPLEX,"py==1993 and ti=(signature and files) or au=schauble")
TestQuery(PARTIAL,'Schaub*')
TestQuery(LITERAL,"'Schauble, Peter'")
#undef  DATABASE
#define DATABASE testg
TestQuery(GERMAN,"Schuble")