#!/bin/sh
#
#echo "*****************************************************"
#echo "Ez egy masik 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 hibatipus benne van-e a hibauzenetben. 


echo "Checking ASN.1 compiler error messages 1"
echo "*****************************************************"

function_compiler()
{
echo "Checking '$1' (expecting '$2')"
if
  $TTCN3_COMPILER ${ABS_SRC}/${1}.asn  2> ERROR_file
    then Verdict="fail : Code generated for erroneous input"
    else
      if  
        $GREP -q error ./ERROR_file
          then
             if $GREP -q -E "$2" ./ERROR_file
	        then Verdict="pass"
                else  Verdict="inconc : Check error message manually:"
                cat ./ERROR_file
             fi
          else  Verdict="fail : no Error message for erroneous input"   
      fi
fi

rm ./ERROR_file
echo "ASN1:$1 = Verdict: $Verdict"
#echo "$1 = $Verdict" >> error_Verdict_file
}
function_compiler Test11 "INTEGER value was expected"
function_compiler Test12 "There is no assignment or imported symbol with name"
function_compiler Test13 "There is no assignment or imported symbol with name"
function_compiler Test14 "There is no assignment or imported symbol with name"
function_compiler Test15 "Circular reference"
function_compiler Test16 "Circular reference"
function_compiler Test17 "Circular reference"
function_compiler Test18 "Duplicate assignment with identifier"
function_compiler Test19_1 "A non-negative INTEGER value was expected for named bit"
function_compiler Test19_2 "syntax error, +unexpected"
function_compiler Test20 "is already assigned to"
function_compiler Test21 "is already assigned to"
function_compiler Test22 "Duplicate identifier: \`firstvalue'"
function_compiler Test24 "Duplicate ENUMERATED identifier: \`a'"
function_compiler Test26 "in CHOICE has non-distinct tag"
function_compiler Test28 "must have canonically greater tag than all previously added extension alternatives"
function_compiler Test32 "is not allowed in this context of SEQUENCE type"
function_compiler Test33 "is not allowed in this context of SEQUENCE type"
function_compiler Test34 "is not allowed in this context of SEQUENCE type"
function_compiler Test39 "Integer value in range 0..2147483647 was expected instead of"
function_compiler Test40 "Integer value in range 0..2147483647 was expected instead of"
function_compiler Test41 "Integer value in range 0..2147483647 was expected instead of"
function_compiler Test42 "There is no assignment or imported symbol with name"
function_compiler Test43 "Circular reference"
function_compiler Test44 "Duplicate assignment with identifier"
function_compiler Test45 "Duplicate assignment with identifier"
function_compiler Test47 "NULL value was expected"
function_compiler Test50 "syntax error, +unexpected "
function_compiler Test67 "There is no assignment or imported symbol with name"
function_compiler Test69 "INTEGER value was expected"
function_compiler Test70 "Reference to non-existent alternative"

function_compiler Test72 "No alternative with name"
function_compiler Test73 "INTEGER value was expected"

function_compiler Test79 "Unexpected component"
function_compiler Test82 "Duplicate SEQUENCE component"
function_compiler Test84 "is missing from SET value"
function_compiler Test85 "Duplicate SET component"
