/***************************************************
 ** @author   STF 475
 ** @version  0.0.1
 ** @purpose  9:5.1.2, Test inclusion of a schema with the same namespace
 ** @verdict  pass accept, ttcn3verdict:pass
***************************************************/
// The following requirements are tested:
// XSD include element information items shall be ignored if the included schema element has the same target 
// namespace as the including one (implying the absence of the target namespace). 

module Pos_050102_includes_001 {

   import from schema_Pos_050102_includes_001 language "XSD" all;

   template MyType m_msg := 1;



    type universal charstring Raw;
    type universal charstring XsdFile;
    type record of XsdFile XsdFileList;

    type port P message {
        inout all;
    }
    type component C {
        port P p;
    }

	external function matchFile(Raw p_textToMatch, XsdFile p_referenceXmlFile, XsdFileList p_xsdFileList, out universal charstring p_matchError) return boolean;
//    external function matchFile(Raw p_textToMatch, charstring p_filePath, out charstring p_matchError) return boolean;

    testcase TC_Pos_050102_includes_001() runs on C system C {
        var Raw v_rcv;
        var charstring v_matchError;
        map(self:p, system:p);
        p.send(m_msg);
        alt {
            []	p.check(receive(Raw:?) -> value v_rcv) {
                if (matchFile(v_rcv, "Pos_050102_includes_001.xml", { "Pos_050102_includes_001.xsd", "Pos_050102_includes_001_1.xsd" }, v_matchError)) {
                    alt {
                        [] p.receive(m_msg) {
                            setverdict(pass);
                        }
                        [] p.receive {
                            setverdict(fail, "XML decoding failure");
                        }
                    }
                } else {
                    setverdict(fail, v_matchError);
                }
            }
            [] p.receive {
                setverdict(fail, "Raw decoding failure");
            }
        }
    }

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


}
