/***************************************************
 ** @author   STF 409
 ** @version  0.0.1
 ** @purpose  1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C)
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/
module Sem_160102_predefined_functions_004 {

    type component GeneralComp {
    }

    testcase TC_Sem_160102_predefined_functions_004 () runs on GeneralComp {
        var charstring v_example:="example text string";

        if( match(regexp(v_example,charstring:"?+(text)?+",0), "text") and   //inline templates in this function are allowed by BNF 165.
            match(regexp(v_example,charstring:"(?+)(text)(?+)",2), " string") and
            match(regexp(v_example,charstring:"((?+)(text)(?+))",0), "example text string") and
            match(substr('00100110'B,3,4), '0011'B) and
            match(substr('ABCDEF'H,2,3), 'CDE'H) and
            match(substr('01AB23CD'O,1,2), 'AB23'O) and
            match(replace('00000110'B,1,3,'111'B), '01110110'B) and
            match(replace('ABCDEF'H,0,2,'123'H), '123CDEF'H) and
            match(replace('01AB23CD'O,2,1,'FF96'O), '01ABFF96CD'O) and
            match(replace(v_example,0,7,"my"), "my text string")
        ) {
            setverdict(pass);
        }
        else {
            setverdict(fail);
        }
    }

    control{
        execute(TC_Sem_160102_predefined_functions_004());
    }
}
