#.IGNORE	# uncomment to ignore all failures and see all of the results

# OBJ_DIR must be set correctly
# OBJ_DIR=../Obj.$(OSTYPE)

all_tests : general_tests pp_tests ehrhart_tests
	-@\rm -f xyz
	@echo "----------------------------------------------------"
	@echo "All tests successful"
	@echo "----------------------------------------------------"

# these tests work with the 64 bits version only.
64_tests::
	@echo "----------------------------------------------------"
	@echo "Begin 64 bits tests"
	@echo "----------------------------------------------------"
64_tests:: isnm isnm2
	-@\rm -f xyz
	@echo "----------------------------------------------------"
	@echo "64 bits tests successful"
	@echo "----------------------------------------------------"

#=====================================================================
general_tests : general_greeting libtest convex1 convex2 simpl1 simpl2 \
		simpl3 simpl4 simpl5 simpl6 test1 herve
	@echo "general tests successful"

general_greeting :
	@echo "----------------------------------------------------"
	@echo "Begin general tests"
	@echo "----------------------------------------------------"

libtest:
	$(OBJ_DIR)/testlib <test.in >xyz
	diff xyz test.out

convex1:
	$(OBJ_DIR)/polytest <convex1.in >xyz
	diff xyz convex1.out

convex2:
	$(OBJ_DIR)/polytest <convex2.in >xyz
	diff xyz convex2.out

simpl1:
	$(OBJ_DIR)/polytest <simpl1.in >xyz
	diff xyz simpl1.out

simpl2:
	$(OBJ_DIR)/polytest <simpl2.in >xyz
	diff xyz simpl2.out

simpl3:
	$(OBJ_DIR)/polytest <simpl3.in >xyz
	diff xyz simpl3.out

simpl4:
	$(OBJ_DIR)/polytest <simpl4.in >xyz
	diff xyz simpl4.out

simpl5:
	$(OBJ_DIR)/polytest <simpl5.in >xyz
	diff xyz simpl5.out

simpl6:
	$(OBJ_DIR)/polytest <simpl6.in >xyz
	diff xyz simpl6.out

test1:
	$(OBJ_DIR)/polytest <test1.in >xyz
	diff xyz test1.out

herve:
	$(OBJ_DIR)/polytest <herve.in >xyz
	diff xyz herve.out

#=====================================================================
ehrhart_tests : ehrhart_greeting t1 t2 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 e10 e11 \
		e12 e13 e14 e15
# isnm isnm2  # These two don't work in 32 bits, but in 64 bits at least.
	@echo "'ehrhart' tests successful"

ehrhart_greeting :
	@echo "----------------------------------------------------"
	@echo "Begin 'ehrhart' tests"
	@echo "----------------------------------------------------"

t1:
	$(OBJ_DIR)/ehrhart <t1.in >xyz
	diff xyz t1.out

t2:
	$(OBJ_DIR)/ehrhart <t2.in >xyz
	diff xyz t2.out

e0:
	$(OBJ_DIR)/ehrhart <e0.in >xyz
	diff xyz e0.out

e1:
	$(OBJ_DIR)/ehrhart <e1.in >xyz
	diff xyz e1.out

e2:
	$(OBJ_DIR)/ehrhart <e2.in >xyz
	diff xyz e2.out

e3:
	$(OBJ_DIR)/ehrhart <e3.in >xyz
	diff xyz e3.out

e4:
	$(OBJ_DIR)/ehrhart <e4.in >xyz
	diff xyz e4.out

e5:
	$(OBJ_DIR)/ehrhart <e5.in >xyz
	diff xyz e5.out

e6:
	$(OBJ_DIR)/ehrhart <e6.in >xyz
	diff xyz e6.out

e7:
	$(OBJ_DIR)/ehrhart <e7.in >xyz
	diff xyz e7.out

e8:
	$(OBJ_DIR)/ehrhart <e8.in >xyz
	diff xyz e8.out

e9:
	$(OBJ_DIR)/ehrhart <e9.in >xyz
	diff xyz e9.out

e10:
	$(OBJ_DIR)/ehrhart <e10.in >xyz
	diff xyz e10.out

e11:
	$(OBJ_DIR)/ehrhart <e11.in >xyz
	diff xyz e11.out

e12:
	$(OBJ_DIR)/ehrhart <e12.in >xyz
	diff xyz e12.out

e13:
	$(OBJ_DIR)/ehrhart <e13.in >xyz
	diff xyz e13.out

e14:
	$(OBJ_DIR)/ehrhart <e14.in >xyz
	diff xyz e14.out

e15:
	$(OBJ_DIR)/ehrhart <e15.in >xyz
	diff xyz e15.out

isnm:
	$(OBJ_DIR)/ehrhart <isnm.in >xyz
	diff xyz isnm.out

isnm2:
	$(OBJ_DIR)/ehrhart <isnm2.in >xyz
	diff xyz isnm2.out

#=====================================================================
pp_tests : pp_greeting c3 c4 e1b
	@echo "'pp' tests successful"

pp_greeting :
	@echo "----------------------------------------------------"
	@echo "Begin 'pp' tests"
	@echo "----------------------------------------------------"

c3:
	$(OBJ_DIR)/pp <c3.in >xyz
	diff xyz c3.out

c4:
	$(OBJ_DIR)/pp <c4.in >xyz
	diff xyz c4.out

# c6 and c7 are (very) slow...
c6:
	$(OBJ_DIR)/pp <c6.in >xyz
	diff xyz c6.out

c7:
	$(OBJ_DIR)/pp <c7.in >xyz
	diff xyz c7.out


e1b:
	$(OBJ_DIR)/pp <e1.in >xyz
	diff xyz e1.out2

