Commit fd54cda3 authored by urbant's avatar urbant
Browse files

Trunk version of recently created test cases (automatically generated from the preATS version)

parent a760b8ab
Loading
Loading
Loading
Loading
+85 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 475
 ** @version  0.0.1
 ** @purpose  9:T.O.D.O
 ** @purpose  9:6.4.2, Verify conversion of XSD float type
 ** @verdict  pass accept, ttcn3verdict:pass
***************************************************/
module Pos_070102_ref_001 {
// The following requirements are tested:
// The float type shall be translated to TTCN-3 as an IEEE754float as defined in
// clause D.2.1.4 of ES 201 873-1 [1]

    import from schema_Pos_070102_ref_001 language "XSD" all;
module Pos_060402_float_001 {

    //template E1 m_msg := {};
   import from schema_Pos_060402_float_001 language "XSD" all;

   template MyType m_msg := 3.14;



	/**
	 * @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 universal charstring XsdFile;
    type record of XsdFile XsdFileList;

    type universal charstring File;
    type record of File FileList;

    type port P message {
        inout all;
@@ -22,20 +33,35 @@ module Pos_070102_ref_001 {
        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;
	/**
	 * @desc lexical compare the charstring p_textToMatch with the contents of the reference XML file and returns true if they represent the same XML structure
	 * @param p_textToMatch text to be compared with the UTF-8 contents of the XML file
	 * @param p_referenceXmlFile the XML file
	 * @param p_xsdFileList the list of XSD files
	 * @param p_matchError the error result in case it did not match
	 * @param p_referenceTTCN3File the file of the TTCN-3 test module. This path is used to find the reference XML file relative to this path, by keeping the TTCN-3 code file system independent.
	 * @return true if p_textToMatch and the contents of p_referenceXmlFile represent the same XML structure
	 */
 	external function matchFile(Raw p_textToMatch, File p_referenceXmlFile, FileList p_xsdFileList, out universal charstring p_matchError, File p_referenceTTCN3File := __FILE__) return boolean;

    testcase TC_Pos_070102_ref_001() runs on C system C {
    testcase TC_Pos_060402_float_001() runs on C system C {
        var Raw v_rcv;
        var charstring v_matchError;
        var universal charstring v_matchError;

        map(self:p, system:p);

		// encode the message
        p.send(m_msg);

        alt {
        	// compare the encoded message with the reference XML file
            []	p.check(receive(Raw:?) -> value v_rcv) {
                if (matchFile(v_rcv, "Pos_070102_ref_001.xml", { "Pos_070102_ref_001.xsd" }, v_matchError)) {
            	log("XML message ", v_rcv);
                if (matchFile(v_rcv, "Pos_060402_float_001.xml", { "Pos_060402_float_001.xsd" }, v_matchError)) {
                    alt {
                    	// match decoded value to pass test
                        [] p.receive(m_msg) {
                            setverdict(pass);
                        	setverdict(pass, "Decoded value matches encoded template and reference XML");
                        }
                        [] p.receive {
                            setverdict(fail, "XML decoding failure");
@@ -52,7 +78,8 @@ module Pos_070102_ref_001 {
    }

    control {
        execute(TC_Pos_070102_ref_001(), 5.0);
        execute(TC_Pos_060402_float_001(), PX_TC_EXECUTION_TIMEOUT);
    }


}
+2 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<ns:MyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="schema:Pos_060402_float_001">3.14</ns:MyType>
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
  targetNamespace="schema:Pos_060402_float_001"
  xmlns:ns="schema:Pos_060402_float_001">
  <element name="MyType" type="float" />
</schema>
+86 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 475
 ** @version  0.0.1
 ** @purpose  9:6.8, Verify conversion of anySimpleType
 ** @verdict  pass accept, ttcn3verdict:pass
***************************************************/
// The following requirements are tested:
// The XSD anySimpleType can be considered as the base type of all primitive 
// data types. The anySimpleType shall be translated as an XML compatible 
// restricted subtype of the universal charstring.

module Pos_0608_anytype_and_anysimpletype_types_001 {

   import from schema_Pos_0608_anytype_and_anysimpletype_types_001 language "XSD" all;

   template MyType m_msg := "test";



	/**
	 * @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 universal charstring File;
    type record of File FileList;

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

	/**
	 * @desc lexical compare the charstring p_textToMatch with the contents of the reference XML file and returns true if they represent the same XML structure
	 * @param p_textToMatch text to be compared with the UTF-8 contents of the XML file
	 * @param p_referenceXmlFile the XML file
	 * @param p_xsdFileList the list of XSD files
	 * @param p_matchError the error result in case it did not match
	 * @param p_referenceTTCN3File the file of the TTCN-3 test module. This path is used to find the reference XML file relative to this path, by keeping the TTCN-3 code file system independent.
	 * @return true if p_textToMatch and the contents of p_referenceXmlFile represent the same XML structure
	 */
 	external function matchFile(Raw p_textToMatch, File p_referenceXmlFile, FileList p_xsdFileList, out universal charstring p_matchError, File p_referenceTTCN3File := __FILE__) return boolean;

    testcase TC_Pos_0608_anytype_and_anysimpletype_types_001() runs on C system C {
        var Raw v_rcv;
        var universal charstring v_matchError;

        map(self:p, system:p);

		// encode the message
        p.send(m_msg);

        alt {
        	// compare the encoded message with the reference XML file
            []	p.check(receive(Raw:?) -> value v_rcv) {
            	log("XML message ", v_rcv);
                if (matchFile(v_rcv, "Pos_0608_anytype_and_anysimpletype_types_001.xml", { "Pos_0608_anytype_and_anysimpletype_types_001.xsd" }, v_matchError)) {
                    alt {
                    	// match decoded value to pass test
                        [] p.receive(m_msg) {
                        	setverdict(pass, "Decoded value matches encoded template and reference XML");
                        }
                        [] p.receive {
                            setverdict(fail, "XML decoding failure");
                        }
                    }
                } else {
                    setverdict(fail, v_matchError);
                }
            }
            [] p.receive {
                setverdict(fail, "Raw decoding failure");
            }
        }
    }

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


}
+2 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<ns:MyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="schema:Pos_0608_anytype_and_anysimpletype_types_001">test</ns:MyType>
 No newline at end of file
Loading