#!/bin/sh
#
#echo "*****************************************************"
#echo "Ez egy sokadik tok primitiv automatizalt teszter V0.0" 
#echo "ami leellenorzi a hibas ASN.1 filekre kapott hibauzenetet"
#echo "Megnezi , hogy a standard errorban van-e "Error" szo; es
#echo "megnezi , hogy a tobbi kifejezes ugyszinten szerepel-e. 

#echo "*****************************************************"

function_compiler()
{
    $TTCN3_COMPILER ${ABS_SRC}/${1}.asn  2> ERROR_file
    if $GREP -q error ./ERROR_file
    then
	if $GREP -q "$2" ./ERROR_file
	then
	    if $GREP -q "$3" ./ERROR_file
	    then
		if $GREP -q "$4" ./ERROR_file
		then Verdict="pass"
		else Verdict="fail: no detailed log" 
		fi
	    else Verdict="fail: no modulename in error message" 
	    fi
	else  Verdict="fail: no filename in error message"
	fi
    else  Verdict="fail: no error detected"
    fi
    if [ "$Verdict" != "pass" ]
    then cat ./ERROR_file
    fi

    rm ./ERROR_file
    echo "ASN1:$1 = Verdict: $Verdict"
    #echo "$1 = $Verdict" >> error2_Verdict_file
}

function_compiler Test10 "Test10.asn" "Test10.asn" "\`field4' is missing from SEQUENCE value"
