/******************************************************************************
 * Copyright (c) ETSI 2017.
 *
 * This file is subject to copyrights owned by ETSI. Non-exclusive permission
 * is hereby granted, free of charge, to copy, reproduce and amend this file
 * under the following conditions: It is provided "as is", without warranty of any
 * kind, expressed or implied.
 * 
 * ETSI shall never be liable for any claim, damages, or other liability arising
 * from its use or inability of use.This permission does not apply to any documentation
 * associated with this file for which ETSI keeps all rights reserved. The present
 * copyright notice shall be included in all copies of whole or part of this
 * file and shall not imply any sub-license right.
 *
 * Modified by: Adrien Kirjak
 *
 ** @version  0.0.1
 ** @purpose  9:7.1.4, A restricted length list [5, 10] should not allow more than 10 elements
 ** @verdict  pass reject
 ***************************************************/
module Neg_070104_minoccurs_and_maxoccurs_003 {

    import from schema_Neg_070104_minoccurs_and_maxoccurs_003 language "XSD" all;

    template ElemE15c m_msg := {foo_list := {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, bar := 3.0}

	external function enc_MyType(in ElemE15c pdu) return octetstring
  	 with { extension "prototype (convert) encode(XER:XER_EXTENDED)" }
  
  	external function dec_MyType(in octetstring stream) return ElemE15c
  	 with { extension "prototype (convert) decode(XER:XER_EXTENDED)" }

    /**
     * @desc The timeout given in seconds after which the test case will be stopped.
     */
    modulepar float PX_TC_EXECUTION_TIMEOUT := 5.0;

    type universal charstring Raw;

    type port P message {
        inout Raw;
    } with {extension "internal"}

    type component C {
        port P p;
		port P p1;
    }

    testcase TC_Neg_070104_minoccurs_and_maxoccurs_003() runs on C system C {
        connect(self:p, self:p1);

		p.send(oct2unichar(enc_MyType(valueof(m_msg))));
        log("template should either be rejected by compiler or by runtime latest while encoding");

        setverdict(fail, "Invalid template should not be encoded");
    }

    control {
        execute(TC_Neg_070104_minoccurs_and_maxoccurs_003(), PX_TC_EXECUTION_TIMEOUT);
    }

}
