#! /bin/bash
ok=false

read answerRow

if [ "$answerRow" == "NO ANSWER SET FOUND" ]; then
	echo "WARN"
        echo "Instances with no solution should not be checked with this checker" >&2
        exit 1
else
	if [ "$answerRow" == "UNKNOWN" ]; then
	echo "WARN"
        echo "Results with UNKNOWN output should not be checked with this checker" >& 2
        exit 1
	else
		systemResult=$(echo "$answerRow" | ./dl.bin -silent constraint.asp --)
		if [[ $? -ne 0 ]]
		then
    			echo "WARN"
    			echo "Unrecognized input stream or general checker failure." >&2
    			exit 1
		fi

		if [ "$systemResult" == "" ]; then
			ok=false
		else
			ok=true
		fi
	fi
fi
if $ok; then
	echo "OK"
else
	echo "FAIL"
fi 
