Skip to content
Snippets Groups Projects
Commit 262ba2c7 authored by Adrien Kirjak's avatar Adrien Kirjak
Browse files

Added xml tests


Signed-off-by: default avatarAdrien Kirjak <adrien.kirjak@ericsson.com>
parent 228a8cef
No related branches found
No related tags found
1 merge request!95Added xml tests
Showing
with 587 additions and 378 deletions
......@@ -4678,6 +4678,290 @@ error: `omit' value is not allowed in this context
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h2. Neg_070502_derivation_by_list_001 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify length constraint imposed on type derived by list >
<COMPILE>
<MODULE TTCN Neg_070502_derivation_by_list_001 Neg_070502_derivation_by_list_001.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 9:7.5.2, Verify length constraint imposed on type derived by list
** @verdict pass reject
***************************************************/
// The following requirements are tested:
// When using any of the supported XSD facets (length, maxLength, minLength) the
// translation shall follow the mapping for built-in list types, with the difference
// that the base type shall be determined by an anonymous inner list item type.
module Neg_070502_derivation_by_list_001 {
import from schema_Neg_070502_derivation_by_list_001 language "XSD" all;
template MyType m_msg := { "abcd", "efgh" };
external function enc_MyType(in MyType pdu) return octetstring
with { extension "prototype (convert) encode(XER:XER_EXTENDED)" }
external function dec_MyType(in octetstring stream) return MyType
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_070502_derivation_by_list_001() 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_070502_derivation_by_list_001(), PX_TC_EXECUTION_TIMEOUT);
}
}
<END_MODULE>
<MODULE TTCN schema_Neg_070502_derivation_by_list_001 schema_Neg_070502_derivation_by_list_001.ttcn >
/*******************************************************************************
* Copyright (c) 2000-2016 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator version: CRL 113 200/6 R1A
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
//
// File: schema_Neg_070502_derivation_by_list_001.ttcn
// Description:
// References:
// Rev:
// Prodnr:
// Updated: Fri Oct 21 09:53:22 2016
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
// Generated from file(s):
// - Neg_070502_derivation_by_list_001.xsd
// /* xml version = "1.0" encoding = "UTF-8" */
// /* targetnamespace = "schema:Neg_070502_derivation_by_list_001" */
////////////////////////////////////////////////////////////////////////////////
// Modification header(s):
//-----------------------------------------------------------------------------
// Modified by:
// Modification date:
// Description:
// Modification contact:
//------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
module schema_Neg_070502_derivation_by_list_001 {
import from XSD all;
type record length(3) of XSD.String Test length(4)
with {
variant "name as uncapitalized";
variant "list";
};
type Test MyType
with {
variant "element";
};
}
with {
encode "XML";
variant "namespace as 'schema:Neg_070502_derivation_by_list_001' prefix 'ns'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
}
<END_MODULE>
<MODULE TTCN XSD XSD.ttcn >
xsd_tmp_keyword
<END_MODULE>
<MODULE TTCN UsefulTtcn3Types UsefulTtcn3Types.ttcn >
usefultypes_tmp_keyword
<END_MODULE>
<RESULT COUNT>
error: At least 3 elements must be present in the list
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h2. Neg_070502_derivation_by_list_002 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify constraint imposed on inner type defined inside XSD list >
<COMPILE>
<MODULE TTCN Neg_070502_derivation_by_list_002 Neg_070502_derivation_by_list_002.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 9:7.5.2, Verify constraint imposed on inner type defined inside XSD list
** @verdict pass reject
***************************************************/
// The following requirements are tested:
// The other XSD facets shall be mapped accordingly (refer to respective 6.1 clauses).
// If no itemType is given, the mapping has to be implemented using the given inner
// type (see clause 7.5.3).
module Neg_070502_derivation_by_list_002 {
import from schema_Neg_070502_derivation_by_list_002 language "XSD" all;
template MyType m_msg := { "abcd", "efgh", "ij" }; // "ij" contains only two characters
external function enc_MyType(in MyType pdu) return octetstring
with { extension "prototype (convert) encode(XER:XER_EXTENDED)" }
external function dec_MyType(in octetstring stream) return MyType
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_070502_derivation_by_list_002() 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_070502_derivation_by_list_002(), PX_TC_EXECUTION_TIMEOUT);
}
}
<END_MODULE>
<MODULE TTCN schema_Neg_070502_derivation_by_list_001 schema_Neg_070502_derivation_by_list_001.ttcn >
/*******************************************************************************
* Copyright (c) 2000-2016 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator version: CRL 113 200/6 R1A
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
//
// File: schema_Neg_070502_derivation_by_list_002.ttcn
// Description:
// References:
// Rev:
// Prodnr:
// Updated: Fri Oct 21 10:05:18 2016
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
// Generated from file(s):
// - Neg_070502_derivation_by_list_002.xsd
// /* xml version = "1.0" encoding = "UTF-8" */
// /* targetnamespace = "schema:Neg_070502_derivation_by_list_002" */
////////////////////////////////////////////////////////////////////////////////
// Modification header(s):
//-----------------------------------------------------------------------------
// Modified by:
// Modification date:
// Description:
// Modification contact:
//------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
module schema_Neg_070502_derivation_by_list_002 {
import from XSD all;
type record length(3) of XSD.String Test length(4)
with {
variant "name as uncapitalized";
variant "list";
};
type Test MyType
with {
variant "element";
};
}
with {
encode "XML";
variant "namespace as 'schema:Neg_070502_derivation_by_list_002' prefix 'ns'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
}
<END_MODULE>
<MODULE TTCN XSD XSD.ttcn >
xsd_tmp_keyword
<END_MODULE>
<MODULE TTCN UsefulTtcn3Types UsefulTtcn3Types.ttcn >
usefultypes_tmp_keyword
<END_MODULE>
<RESULT COUNT>
error: "ij" is not a valid value for type `universal charstring' which has subtype \(length\(4\) intersection from\("\\t".."\\n","\\r"," "..char\(0, 0, 215, 255\),char\(0, 0, 224, 0\)..char\(0, 0, 255, 253\),char\(0, 1, 0, 0\)..char\(0, 16, 255, 253\)\)\)
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h2. Neg_07060102_restricting_simple_content_001 negative test
.*---------------------------------------------------------------------*
......
......@@ -43,7 +43,7 @@ module Pos_060112_fraction_digits_001 {
testcase TC_Pos_060112_fraction_digits_001() runs on C system C {
var Raw v_rcv;
var Raw v_Raw:="<ns068:actualTemp xmlns:ns068='schema:Pos_060112_fraction_digits_001'>99.900000</ns068:actualTemp>\n";
var Raw v_Raw:="<ns068:actualTemp xmlns:ns068='schema:Pos_060112_fraction_digits_001'>99.9</ns068:actualTemp>\n";
connect(self:p, self:p1);
......
......@@ -43,7 +43,7 @@ module Pos_060112_fraction_digits_002 {
testcase TC_Pos_060112_fraction_digits_002() runs on C system C {
var Raw v_rcv;
var Raw v_Raw:="<ns069:actualTemp xmlns:ns069='schema:Pos_060112_fraction_digits_002'>0.999900</ns069:actualTemp>\n";
var Raw v_Raw:="<ns069:actualTemp xmlns:ns069='schema:Pos_060112_fraction_digits_002'>0.9</ns069:actualTemp>\n";
connect(self:p, self:p1);
......@@ -55,8 +55,8 @@ module Pos_060112_fraction_digits_002 {
log("XML message ", v_rcv);
if (match(v_rcv, v_Raw) ) {
alt {
[] p1.receive(Raw:?) {
if(match(dec_MyType(unichar2oct(v_rcv)),m_msg)) {
[] p1.receive(Raw:?) { // titan prints extra 0s during decoding
if(match(dec_MyType(unichar2oct(v_rcv)),0.900000)) {
setverdict(pass, "Decoded value matches encoded template and reference XML");
}
else
......
/*******************************************************************************
* Copyright (c) 2000-2016 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator version: CRL 113 200/5 R5A
* XSD to TTCN-3 Translator version: CRL 113 200/6 R1A
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -14,7 +14,7 @@
// References:
// Rev:
// Prodnr:
// Updated: Mon Jul 11 10:05:40 2016
// Updated: Fri Oct 21 09:53:22 2016
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
......@@ -39,7 +39,7 @@ module schema_Neg_070502_derivation_by_list_001 {
import from XSD all;
type record of XSD.String Test length(3)
type record length(3) of XSD.String Test length(4)
with {
variant "name as uncapitalized";
variant "list";
......
/*******************************************************************************
* Copyright (c) 2000-2016 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator version: CRL 113 200/5 R5A
* XSD to TTCN-3 Translator version: CRL 113 200/6 R1A
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -14,7 +14,7 @@
// References:
// Rev:
// Prodnr:
// Updated: Mon Jul 11 10:05:40 2016
// Updated: Fri Oct 21 10:05:18 2016
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
......@@ -39,7 +39,7 @@ module schema_Neg_070502_derivation_by_list_002 {
import from XSD all;
type record of XSD.String Test length(3)
type record length(3) of XSD.String Test length(4)
with {
variant "name as uncapitalized";
variant "list";
......
/*******************************************************************************
* Copyright (c) 2000-2016 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator version: CRL 113 200/5 R5A
* XSD to TTCN-3 Translator version: CRL 113 200/6 R1A
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -14,7 +14,7 @@
// References:
// Rev:
// Prodnr:
// Updated: Thu Jul 7 13:20:59 2016
// Updated: Tue Oct 25 10:13:30 2016
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
......@@ -42,6 +42,7 @@ import from XSD all;
type XSD.Decimal CelsiusBodyTemp (-9999.0 .. 9999.0)
with {
variant "name as uncapitalized";
variant "fractionDigits 1";
};
......
/*******************************************************************************
* Copyright (c) 2000-2016 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator version: CRL 113 200/5 R5A
* XSD to TTCN-3 Translator version: CRL 113 200/6 R1A
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -14,7 +14,7 @@
// References:
// Rev:
// Prodnr:
// Updated: Thu Jul 7 13:20:59 2016
// Updated: Tue Oct 25 13:22:25 2016
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
......@@ -42,6 +42,7 @@ import from XSD all;
type XSD.Decimal CelsiusBodyTemp (-9999.0 .. 9999.0)
with {
variant "name as uncapitalized";
variant "fractionDigits 1";
};
......
/*******************************************************************************
* Copyright (c) 2000-2016 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator version: CRL 113 200/5 R5A
* XSD to TTCN-3 Translator version: CRL 113 200/6 R1A
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -14,7 +14,7 @@
// References:
// Rev:
// Prodnr:
// Updated: Mon Jul 11 10:05:40 2016
// Updated: Fri Oct 21 10:12:12 2016
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
......@@ -39,7 +39,7 @@ module schema_Pos_070502_derivation_by_list_003 {
import from XSD all;
type record of XSD.String Test length(3)
type record length(3) of XSD.String Test length(4)
with {
variant "name as uncapitalized";
variant "list";
......
......@@ -76,6 +76,8 @@ Pos_060111_total_digits_002.control
Pos_060111_total_digits_003.control
Pos_060111_total_digits_004.control
Pos_060111_total_digits_005.control
Pos_060112_fraction_digits_001.control
Pos_060112_fraction_digits_002.control
Pos_060201_string_001.control
Pos_060204_name_001.control
Pos_060212_any_uri_001.control
......@@ -197,6 +199,7 @@ Pos_07060604_sequence_with_nested_sequence_001.control
Pos_07060604_sequence_with_nested_sequence_002.control
Pos_07060605_sequence_with_nested_any_content_001.control
Pos_07060606_effect_of_minoccurs_and_maxoccurs_001.control
Pos_07060606_effect_of_minoccurs_and_maxoccurs_002.control
Pos_07060606_effect_of_minoccurs_and_maxoccurs_003.control
Pos_07060606_effect_of_minoccurs_and_maxoccurs_004.control
Pos_070607_attribute_definitions_attribute_and_attributegroup_references_001.control
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment