Commit 78eda58b authored by urbant's avatar urbant
Browse files

STF 521: New XSD tests (base on ETSI ES 201 873-9 V4.7.1)

parent ee59ba90
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 9:5.2.2, Conversion of module names
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
// The following requirements are tested:
// Rule a: Target namespace values used in XSD schema documents shall be ordered
// alphabetically, independently from the above components (after conversion they are
// merely used as TTCN-3 module names). The string value of the target namespace values
// shall be used, i.e. without un-escaping or removing trailing “/” SOLIDUS characters
// of the authority part or any other changes to the character string.
// Rule e:
// "_" (LOW LINE) characters occurring at the beginning or at the end of the name shall
// be removed, except trailing "_" (LOW LINE) characters resulted from converting target
// namespace values (to be used as TTCN-3 module names);
module Pos_050202_name_conversion_rules_024 {
import from schema_Pos_050202_name_conversion_rules_024 language "XSD" all;
import from schema_Pos_050202_name_conversion_rules_024_ language "XSD" all;
template schema_Pos_050202_name_conversion_rules_024_.Test m_msg := "abc";
//#TC
}
<?xml version="1.0" encoding="utf-8"?>
<ns:Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="schema:Pos_050202_name_conversion_rules_024/">abc</ns:Test>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="schema:Pos_050202_name_conversion_rules_024"
xmlns:ns="schema:Pos_050202_name_conversion_rules_024">
<element name="Test" type="integer" />
</schema>
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="schema:Pos_050202_name_conversion_rules_024/"
xmlns:ns="schema:Pos_050202_name_conversion_rules_024/">
<element name="Test" type="string" />
</schema>
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 9:5.2.2, Resolving name conflict in module names (not ending with underline)
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
// The following requirements are tested:
// Rule a: If the name being generated is the name of a TTCN-3 module and the character
// string generated by items a) to e) above is identical to an another, previously
// generated TTCN-3 module name, then a postfix shall be appended to the character
// string: the postfix shall consist of a "_" (LOW LINE) followed by the canonical
// lexical representation (see W3C XML Schema Part 2 [9], clause 2.3.1) of an integer,
// unless the name already finishes with a "_" (LOW LINE) character, in which case the
// postfix is an integer only. This integer shall be the least positive integer such
// that the new name is different from all previously generated TTCN 3 modules names
// and clashing definition name.
module Pos_050202_name_conversion_rules_025 {
import from schema_Pos_050202_name_conversion_rules_025 language "XSD" all;
import from schema_Pos_050202_name_conversion_rules_025_1 language "XSD" all;
template schema_Pos_050202_name_conversion_rules_025_1.Test m_msg := "abc";
//#TC
}
<?xml version="1.0" encoding="utf-8"?>
<ns:Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="schema:Pos-050202-name-conversion-rules-025">abc</ns:Test>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="schema:Pos_050202_name_conversion_rules_025"
xmlns:ns="schema:Pos_050202_name_conversion_rules_025">
<element name="Test" type="integer" />
</schema>
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="schema:Pos-050202-name-conversion-rules-025"
xmlns:ns="schema:Pos-050202-name-conversion-rules-025">
<element name="Test" type="string" />
</schema>
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 9:6.1.2, Verify that correct constraint is generated for the minLength facet
** @verdict pass reject
***************************************************/
module Neg_060102_minlength_001 {
import from schema_Neg_060102_minlength_001 language "XSD" all;
template Test m_msg := "a"; // minLength is 3 -> the string "a" shall be rejected
//#TC_Neg
}
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="schema:Neg_060102_minlength_001"
xmlns:ns="schema:Neg_060102_minlength_001">
<element name="test">
<simpleType>
<restriction base="string">
<minLength value="3"/>
</restriction>
</simpleType>
</element>
</schema>
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 9:6.1.2, Verify mapping of the minLength facet
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
module Pos_060102_minlength_001 {
import from schema_Pos_060102_minlength_001 language "XSD" all;
template Test m_msg := "abc";
//#TC
}
<?xml version="1.0" encoding="UTF-8"?>
<ns:test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns="schema:Pos_060102_minlength_001">abc</ns:test>
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="schema:Pos_060102_minlength_001"
xmlns:ns="schema:Pos_060102_minlength_001">
<element name="test">
<simpleType>
<restriction base="string">
<minLength value="3"/>
</restriction>
</simpleType>
</element>
</schema>
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 9:6.1.3, Verify that correct constraint is generated for the maxLength facet
** @verdict pass reject
***************************************************/
module Neg_060103_maxlength_001 {
import from schema_Neg_060103_maxlength_001 language "XSD" all;
template Test m_msg := "abcd"; // maxLength is 3 -> the string "abcd" shall be rejected
//#TC_Neg
}
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="schema:Neg_060103_maxlength_001"
xmlns:ns="schema:Neg_060103_maxlength_001">
<element name="test">
<simpleType>
<restriction base="string">
<maxLength value="3"/>
</restriction>
</simpleType>
</element>
</schema>
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 9:6.1.3, Verify mapping of the maxLength facet
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
module Pos_060103_maxlength_001 {
import from schema_Pos_060103_maxlength_001 language "XSD" all;
template Test m_msg := "abc";
//#TC
}
<?xml version="1.0" encoding="UTF-8"?>
<ns:test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns="schema:Pos_060103_maxlength_001">abc</ns:test>
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="schema:Pos_060103_maxlength_001"
xmlns:ns="schema:Pos_060103_maxlength_001">
<element name="test">
<simpleType>
<restriction base="string">
<maxLength value="3"/>
</restriction>
</simpleType>
</element>
</schema>
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 9:6.1.4, Verify that correct constraint is generated for the pattern facet
** @verdict pass reject
***************************************************/
module Neg_060104_pattern_001 {
import from schema_Neg_060104_pattern_001 language "XSD" all;
template Test m_msg := "aUser@iNstitute"; // should fail as the pattern doesn't allow capital N
//#TC_Neg
}
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="schema:Neg_060104_pattern_001"
xmlns:ns="schema:Neg_060104_pattern_001">
<element name="test">
<simpleType>
<restriction base="string">
<pattern value="(aUser|anotherUser)@(i|I)nstitute"/>
</restriction>
</simpleType>
</element>
</schema>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment