;########################### -*- 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: Wed Jan 31 15:36:56 1996
;# Update Count    : 137
;# Status          : Unknown, Use with caution!
;##############################################################################

Initialize(WAISSEARCH_ARGS,$waissearch_args)

             DIFF = cmp
        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 \
                test_field_ed.dct \
                test_field_ed.inv \
                testg_field_ed.dct \
                testg_field_ed.inv \
                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)

local_clean::
	$(RM) $(HELPFILES)

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

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

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

DependTarget()

#define Concat(A,B) A/**/B

/* Tests */

#define TestQuery(testname, words)                                      @!\
test:: testname								@@\
									@!\
testname: Concat(DATABASE,.doc)                                         @@\
	@(echo q;echo q) | \@@\
	$(WAISSEARCH) $(WAISSEARCH_ARGS) -d DATABASE words > \@@\
		 Concat(testname,.is) 2>&1 ;				@@\
	@-if $(DIFF) Concat(testname,.is) Concat(testname,.should) ; then \@@\
		> /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) $(WAISSEARCH_ARGS) -d DATABASE words > \@@\
		Concat(testname,.should) 2>&1	  @@\
									@!\
local_clean::                                                           @@\
	$(RM) Concat(testname,.is)					@@\
/*
veryclean::								@@\
	$(RM) Concat(testname,.should)
*/

#undef BOOLEAN
#undef LITERAL


#define DATABASE test
TestQuery(PLAIN,Probabilistic Indexing)
TestQuery(WEIGHT,'Probabilistic <* 3 Indexing')
TestQuery(BOOLEAN,"au=(pennekamp or fuhr) and processing")
TestQuery(FIELD,au=pfeifer)
TestQuery(NUMERIC,py==1995)
TestQuery(COMPLEX,"py==1995 and (ti=(Retrieval freeWAIS) or au=pfeifer)")
TestQuery(PARTIAL,'Pfeif*')
TestQuery(DATE,'ed>19930101')
TestQuery(LITERAL,"'Enhanced Retrieval'")
TestQuery(PROXIMITY,'(Searching w/2 Documents) or (Development pre/3 Linear)')
#undef DATABASE
#define DATABASE testg
TestQuery(GERMAN,"au=grojohann")
