#!/bin/sh

dotest() {
	if ! [ -d "$1" ]; then echo $1 non esiste; exit; fi
	for i in $1/*.dp; do
		echo Testing $i
		if ! python ./main.py $i | grep -i 'Una soluzione' > /dev/null
		then
			echo ERRORE $i
			exit
		fi
	done
}

negdotest() 
{
	if ! [ -d "$1" ]; then echo $1 non esiste; exit; fi
	for i in $1/*.dp; do
		echo Testing $i
		if python ./main.py $i | grep -i 'Una soluzione' > /dev/null
		then
			echo ERRORE $i
			exit
		fi
	done
}

if [ "$1" == 1 ]; then dotest tests; fi
if [ "$1" == 2 ]; then dotest tests2; fi
if [ "$1" == 3 ]; then negdotest tests3; fi
echo ALL OK
