Sem_160102_predefined_functions_026.ttcn 2.63 KB
Newer Older
kovacsa's avatar
kovacsa committed
/***************************************************
 ** @author   STF 487
 ** @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
 ***************************************************/

/* The following requirements are tested:
   This function converts an octetstring invalue to a universal charstring.
 * and
 * This function converts a universal charstring invalue to an octetstring.*/

/*NOTE: 
 * "UTF-16LE","UTF-16BE", "UTF-32LE" and "UTF-32BE" in not working with TestCast v.6.8.2.5 */


module Sem_160102_predefined_functions_026 {
	
    
    type component GeneralComp {
    }


    testcase TC_Sem_160102_predefined_functions_026 () runs on GeneralComp {
       
    // universal charstring:    
        var universal charstring v_0 := "ABC123abc";
        
    // predefined functions for universal charstring to octetstring conversion:     
        var octetstring v_1a := unichar2oct(v_0);        //string_encoding parameter is omitted, the default value "UTF-8"
        var octetstring v_1b := unichar2oct(v_0, "UTF-8");
        var octetstring v_1c := unichar2oct(v_0, "UTF-16");
        var octetstring v_1d := unichar2oct(v_0, "UTF-32");
        var octetstring v_1e := unichar2oct(v_0, "UTF-16LE");
        var octetstring v_1f := unichar2oct(v_0, "UTF-16BE");
        var octetstring v_1g := unichar2oct(v_0, "UTF-32LE");
        var octetstring v_1h := unichar2oct(v_0, "UTF-32BE");
   
   // predefined functions for octetstring to universal charstring conversion:  
        var universal charstring v_2a := oct2unichar(v_1a);
        var universal charstring v_2b := oct2unichar(v_1b, "UTF-8");
        var universal charstring v_2c := oct2unichar(v_1c, "UTF-16");
        var universal charstring v_2d := oct2unichar(v_1d, "UTF-32");
        var universal charstring v_2e := oct2unichar(v_1e, "UTF-16LE");
        var universal charstring v_2f := oct2unichar(v_1f, "UTF-16BE");
        var universal charstring v_2g := oct2unichar(v_1g, "UTF-32LE");
        var universal charstring v_2h := oct2unichar(v_1f, "UTF-32BE");

        if( match(v_0,v_2a) and
            match(v_0,v_2b) and
            match(v_0,v_2c) and
            match(v_0,v_2d) and
            match(v_0,v_2e) and
            match(v_0,v_2f) and
            match(v_0,v_2g) and
            match(v_0,v_2h)
        ) {
            setverdict(pass);
        }
        else {
            setverdict(fail);
        }
    }

    control{
        execute(TC_Sem_160102_predefined_functions_026());
    }
}