/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.3.4, encoding parameter of @decoded redirect parameter assignment applied to incorrect type
 ** @verdict  pass reject
 *****************************************************************/

// The following requirements are tested:
// In case the referenced field is not a universal charstring, the optional
// parameter shall not be present.

module NegSem_220202_ReceiveOperation_012 {
	signature S(out octetstring p_par);

	type port P procedure {
		inout S;
	}

    type component GeneralComp {
		port P p;
	}

    function f_server() runs on GeneralComp {
        var charstring v_src := "abc";
        var octetstring v_os := bit2oct(encvalue(v_src));
        p.getcall(S:?);
        p.reply(S:{ p_par := v_os });
    }

    testcase TC_NegSem_220304_getreply_operation_012() runs on GeneralComp system GeneralComp {
        var charstring v_res;
        var GeneralComp v_ptc := GeneralComp.create("PTC");
        connect(self:p, v_ptc:p);
        v_ptc.start(f_server());
        p.call(S:{ p_par := - }) {
            [] p.getreply(S:?) -> param (v_res := @decoded("UTF-8") p_par) {
                setverdict(pass);
            }
            [] p.getreply { setverdict(pass); }
        }

    }

    control {
        execute(TC_NegSem_220304_getreply_operation_012(), 5.0);
    }
}