Commit ac27e989 authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

fixed and default attribute and constant fixes (Bug 517042)



Change-Id: I6d3ee896b181e7d87ba14c9518365ab7d5939b00
Signed-off-by: default avatarBenceJanosSzabo <bence.janos.szabo@ericsson.com>
parent bd5ca92a
/*******************************************************************************
* Copyright (c) 2000-2017 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator
* XSD to TTCN-3 Translator
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
......@@ -73,31 +73,70 @@ const XSD.Boolean c_defaultForEmpty_9 := true;
const XSD.Boolean c_defaultForEmpty_10 := false;
const MyString_1 c_defaultForEmpty_11 := "fix";
const XSD.AnySimpleType c_defaultForEmpty_11 := "1.0.0";
const MyString2_1 c_defaultForEmpty_12 := "fix";
const MyString_1 c_defaultForEmpty_12 := "fix";
const EnumString c_defaultForEmpty_13 := a;
const MyString2_1 c_defaultForEmpty_13 := "fix";
const EnumDate c_defaultForEmpty_14 := x1888_01_01;
const EnumString c_defaultForEmpty_14 := a;
const EnumFloat c_defaultForEmpty_15 := infinity;
const EnumDate c_defaultForEmpty_15 := x1888_01_01;
const EnumFloat c_defaultForEmpty_16 := not_a_number;
const EnumFloat c_defaultForEmpty_16 := infinity;
const EnumFloat c_defaultForEmpty_17 := 1.0;
const EnumFloat c_defaultForEmpty_17 := not_a_number;
const EnumInteger c_defaultForEmpty_18 := int3;
const EnumFloat c_defaultForEmpty_18 := 1.0;
const EnumInteger c_defaultForEmpty_19 := int_3;
const EnumInteger c_defaultForEmpty_19 := int3;
const EnumInteger c_defaultForEmpty_20 := int_3;
const LocalEnumAttributeDefault1 c_defaultForEmpty_21 := false_;
const LocalEnumAttributeFixed1 c_defaultForEmpty_22 := false_;
const LocalEnumAttributeDefault2 c_defaultForEmpty_23 := false_;
const LocalEnumAttributeFixed2 c_defaultForEmpty_24 := false_;
const LocalEnumElementDefault1 c_defaultForEmpty_25 := false_;
const LocalEnumElementFixed1 c_defaultForEmpty_26 := false_;
const LocalEnumElementDefault2 c_defaultForEmpty_27 := false_;
const LocalEnumElementFixed2 c_defaultForEmpty_28 := false_;
const Element.sequence_list[-].localEnumElementDefault1 c_defaultForEmpty_29 := false_;
const Element.sequence_list[-].localEnumElementDefault2 c_defaultForEmpty_30 := false_;
const Element.progress_notes_requested c_defaultForEmpty_31 := false_;
const Element.progress_notes_requested2 c_defaultForEmpty_32 := false_;
/* Basic defaultForEmpty */
......@@ -269,6 +308,59 @@ with {
};
type XSD.AnySimpleType AnySimpleTypeDefault
with {
variant "defaultForEmpty as c_defaultForEmpty_11";
variant "element";
};
type XSD.AnySimpleType AnySimpleTypeFixed (c_defaultForEmpty_11)
with {
variant "defaultForEmpty as c_defaultForEmpty_11";
variant "element";
};
/* Unsupported anytype and QName */
type XSD.AnyType AnyTypeDefault
with {
variant "element";
};
type XSD.AnyType AnyTypeFixed
with {
variant "element";
};
type XSD.AnyType AnyTypeDefault2
with {
variant "element";
};
type XSD.AnyType AnyTypeFixed2
with {
variant "element";
};
type XSD.QName QNameDefault
with {
variant "element";
};
type XSD.QName QNameFixed
with {
variant "element";
};
/* Check if the name conversion follows to the constants too */
......@@ -299,9 +391,9 @@ with {
};
type MyString_1 MyStringFixed (c_defaultForEmpty_11)
type MyString_1 MyStringFixed (c_defaultForEmpty_12)
with {
variant "defaultForEmpty as c_defaultForEmpty_11";
variant "defaultForEmpty as c_defaultForEmpty_12";
variant "element";
};
......@@ -312,16 +404,16 @@ with {
};
type MyString2_1 MyStringFixed2 (c_defaultForEmpty_12)
type MyString2_1 MyStringFixed2 (c_defaultForEmpty_13)
with {
variant "defaultForEmpty as c_defaultForEmpty_12";
variant "defaultForEmpty as c_defaultForEmpty_13";
variant "element";
};
type MyString_1 AttrfixedMyString3_1 (c_defaultForEmpty_11)
type MyString_1 AttrfixedMyString3_1 (c_defaultForEmpty_12)
with {
variant "defaultForEmpty as c_defaultForEmpty_11";
variant "defaultForEmpty as c_defaultForEmpty_12";
variant "name as 'AttrfixedMyString3'";
variant "attribute";
};
......@@ -330,25 +422,25 @@ with {
type record Complex
{
XSD.Integer attrfixedInteger (c_defaultForEmpty_4) optional,
MyString2_1 attrfixedMyString2 (c_defaultForEmpty_12) optional,
MyString2_1 attrfixedMyString2 (c_defaultForEmpty_13) optional,
AttrfixedMyString3_1 attrfixedMyString3 optional,
MyString_1 birthPlaceAttrGroup optional,
MyString_1 myStringFixed (c_defaultForEmpty_11),
MyString2_1 myStringFixed2 (c_defaultForEmpty_12)
MyString_1 myStringFixed (c_defaultForEmpty_12),
MyString2_1 myStringFixed2 (c_defaultForEmpty_13)
}
with {
variant (attrfixedInteger) "defaultForEmpty as c_defaultForEmpty_4";
variant (attrfixedInteger) "name as capitalized";
variant (attrfixedInteger) "attribute";
variant (attrfixedMyString2) "defaultForEmpty as c_defaultForEmpty_12";
variant (attrfixedMyString2) "defaultForEmpty as c_defaultForEmpty_13";
variant (attrfixedMyString2) "name as capitalized";
variant (attrfixedMyString2) "attribute";
variant (attrfixedMyString3) "name as capitalized";
variant (attrfixedMyString3) "attribute";
variant (birthPlaceAttrGroup) "attribute";
variant (myStringFixed) "defaultForEmpty as c_defaultForEmpty_11";
variant (myStringFixed) "defaultForEmpty as c_defaultForEmpty_12";
variant (myStringFixed) "name as capitalized";
variant (myStringFixed2) "defaultForEmpty as c_defaultForEmpty_12";
variant (myStringFixed2) "defaultForEmpty as c_defaultForEmpty_13";
variant (myStringFixed2) "name as capitalized";
};
......@@ -356,9 +448,9 @@ with {
/* Enumerations */
type EnumString EnumStringFixed (c_defaultForEmpty_13)
type EnumString EnumStringFixed (c_defaultForEmpty_14)
with {
variant "defaultForEmpty as c_defaultForEmpty_13";
variant "defaultForEmpty as c_defaultForEmpty_14";
variant "element";
};
......@@ -374,9 +466,9 @@ with {
};
type EnumDate EnumDateFixed (c_defaultForEmpty_14)
type EnumDate EnumDateFixed (c_defaultForEmpty_15)
with {
variant "defaultForEmpty as c_defaultForEmpty_14";
variant "defaultForEmpty as c_defaultForEmpty_15";
variant "element";
};
......@@ -392,30 +484,30 @@ with {
};
type EnumFloat EnumFloatFixed (c_defaultForEmpty_15)
type EnumFloat EnumFloatFixed (c_defaultForEmpty_16)
with {
variant "defaultForEmpty as c_defaultForEmpty_15";
variant "defaultForEmpty as c_defaultForEmpty_16";
variant "element";
};
type EnumFloat EnumFloatFixed2 (c_defaultForEmpty_16)
type EnumFloat EnumFloatFixed2 (c_defaultForEmpty_17)
with {
variant "defaultForEmpty as c_defaultForEmpty_16";
variant "defaultForEmpty as c_defaultForEmpty_17";
variant "element";
};
type EnumFloat EnumFloatFixed3 (c_defaultForEmpty_17)
type EnumFloat EnumFloatFixed3 (c_defaultForEmpty_18)
with {
variant "defaultForEmpty as c_defaultForEmpty_17";
variant "defaultForEmpty as c_defaultForEmpty_18";
variant "element";
};
type EnumFloat EnumFloatFixed4 (c_defaultForEmpty_17)
type EnumFloat EnumFloatFixed4 (c_defaultForEmpty_18)
with {
variant "defaultForEmpty as c_defaultForEmpty_17";
variant "defaultForEmpty as c_defaultForEmpty_18";
variant "element";
};
......@@ -423,16 +515,16 @@ with {
type XSD.Float EnumFloat (1.0, infinity, not_a_number);
type EnumInteger EnumIntegerFixed (c_defaultForEmpty_18)
type EnumInteger EnumIntegerFixed (c_defaultForEmpty_19)
with {
variant "defaultForEmpty as c_defaultForEmpty_18";
variant "defaultForEmpty as c_defaultForEmpty_19";
variant "element";
};
type EnumInteger EnumIntegerFixed2 (c_defaultForEmpty_19)
type EnumInteger EnumIntegerFixed2 (c_defaultForEmpty_20)
with {
variant "defaultForEmpty as c_defaultForEmpty_19";
variant "defaultForEmpty as c_defaultForEmpty_20";
variant "element";
};
......@@ -447,6 +539,162 @@ with {
};
type enumerated LocalEnumAttributeDefault1
{
false_,
true_
}
with {
variant "text 'false_' as 'false'";
variant "text 'true_' as 'true'";
variant "defaultForEmpty as c_defaultForEmpty_21";
variant "attribute";
};
type enumerated LocalEnumAttributeFixed1
{
false_,
true_
}
with {
variant "text 'false_' as 'false'";
variant "text 'true_' as 'true'";
variant "defaultForEmpty as c_defaultForEmpty_22";
variant "attribute";
};
type XSD.String Mystring
with {
variant "name as uncapitalized";
};
type enumerated LocalEnumAttributeDefault2
{
false_,
true_
}
with {
variant "text 'false_' as 'false'";
variant "text 'true_' as 'true'";
variant "defaultForEmpty as c_defaultForEmpty_23";
variant "attribute";
};
type enumerated LocalEnumAttributeFixed2
{
false_,
true_
}
with {
variant "text 'false_' as 'false'";
variant "text 'true_' as 'true'";
variant "defaultForEmpty as c_defaultForEmpty_24";
variant "attribute";
};
type enumerated LocalEnumElementDefault1
{
false_,
true_
}
with {
variant "text 'false_' as 'false'";
variant "text 'true_' as 'true'";
variant "defaultForEmpty as c_defaultForEmpty_25";
variant "attribute";
};
type enumerated LocalEnumElementFixed1
{
false_,
true_
}
with {
variant "text 'false_' as 'false'";
variant "text 'true_' as 'true'";
variant "defaultForEmpty as c_defaultForEmpty_26";
variant "attribute";
};
type enumerated LocalEnumElementDefault2
{
false_,
true_
}
with {
variant "text 'false_' as 'false'";
variant "text 'true_' as 'true'";
variant "defaultForEmpty as c_defaultForEmpty_27";
variant "attribute";
};
type enumerated LocalEnumElementFixed2
{
false_,
true_
}
with {
variant "text 'false_' as 'false'";
variant "text 'true_' as 'true'";
variant "defaultForEmpty as c_defaultForEmpty_28";
variant "attribute";
};
type record Element
{
enumerated {
false_,
true_
} progress_notes_requested optional,
enumerated {
false_,
true_
} progress_notes_requested2 optional,
record length(1 .. 5) of record {
enumerated {
true_,
false_
} localEnumElementDefault1,
enumerated {
true_,
false_
} localEnumElementDefault2
} sequence_list
}
with {
variant "element";
variant (progress_notes_requested) "text 'false_' as 'false'";
variant (progress_notes_requested) "text 'true_' as 'true'";
variant (progress_notes_requested) "defaultForEmpty as c_defaultForEmpty_31";
variant (progress_notes_requested) "name as 'progress-notes-requested'";
variant (progress_notes_requested) "attribute";
variant (progress_notes_requested2) "text 'false_' as 'false'";
variant (progress_notes_requested2) "text 'true_' as 'true'";
variant (progress_notes_requested2) "defaultForEmpty as c_defaultForEmpty_32";
variant (progress_notes_requested2) "name as 'progress-notes-requested2'";
variant (progress_notes_requested2) "attribute";
variant (sequence_list) "untagged";
variant (sequence_list[-]) "untagged";
variant (sequence_list[-].localEnumElementDefault1) "defaultForEmpty as c_defaultForEmpty_29";
variant (sequence_list[-].localEnumElementDefault1) "name as capitalized";
variant (sequence_list[-].localEnumElementDefault1) "text 'false_' as 'false'";
variant (sequence_list[-].localEnumElementDefault1) "text 'true_' as 'true'";
variant (sequence_list[-].localEnumElementDefault2) "defaultForEmpty as c_defaultForEmpty_30";
variant (sequence_list[-].localEnumElementDefault2) "name as capitalized";
variant (sequence_list[-].localEnumElementDefault2) "text 'false_' as 'false'";
variant (sequence_list[-].localEnumElementDefault2) "text 'true_' as 'true'";
};
}
with {
encode "XML";
......
......@@ -2413,7 +2413,7 @@ group Elements{
testcase tc_defaultforempty() runs on xmlTest_CT {
f_shellCommandWithVerdict(xsd2ttcn_command & " defaultforempty.xsd","",c_shell_successWithoutWarningAndError)
f_shellCommandWithVerdict(xsd2ttcn_command & " defaultforempty.xsd","",c_shell_successWithWarning)
if(getverdict==pass) {
f_compareFiles(
......
......@@ -49,7 +49,22 @@
<xs:element name="BooleanFixed3" type="xs:boolean" fixed="0"/>
<xs:element name='AnySimpleTypeDefault' type="xs:anySimpleType" default='1.0.0'/>
<xs:element name='AnySimpleTypeFixed' type="xs:anySimpleType" fixed='1.0.0'/>
<!-- Unsupported anytype and QName -->
<xs:element name='AnyTypeDefault' default='1.0.0'/>
<xs:element name='AnyTypeFixed' fixed='1.0.0'/>
<xs:element name='AnyTypeDefault2' type="xs:anyType" default='1.0.0'/>
<xs:element name='AnyTypeFixed2' type="xs:anyType" fixed='1.0.0'/>
<xs:element name='QNameDefault' type="xs:QName" default='Name'/>
<xs:element name='QNameFixed' type="xs:QName" fixed='Name'/>
<!-- Check if the name conversion follows to the constants too -->
<xs:element name="AttrfixedMyString3_"/>
......@@ -136,5 +151,122 @@
</xs:restriction>
</xs:simpleType>
<xs:attribute name="LocalEnumAttributeDefault1" default='false'>
<xs:simpleType>
<xs:restriction base='xs:string'>
<xs:enumeration value='true'/>
<xs:enumeration value='false'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="LocalEnumAttributeFixed1" fixed='false'>
<xs:simpleType>
<xs:restriction base='xs:string'>
<xs:enumeration value='true'/>
<xs:enumeration value='false'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:simpleType name="mystring">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute name="LocalEnumAttributeDefault2" default='false'>
<xs:simpleType>
<xs:restriction base='dfe:mystring'>
<xs:enumeration value='true'/>
<xs:enumeration value='false'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="LocalEnumAttributeFixed2" fixed='false'>
<xs:simpleType>
<xs:restriction base='dfe:mystring'>
<xs:enumeration value='true'/>
<xs:enumeration value='false'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="LocalEnumElementDefault1" default='false'>
<xs:simpleType>
<xs:restriction base='xs:string'>
<xs:enumeration value='true'/>
<xs:enumeration value='false'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="LocalEnumElementFixed1" fixed='false'>
<xs:simpleType>
<xs:restriction base='xs:string'>
<xs:enumeration value='true'/>
<xs:enumeration value='false'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="LocalEnumElementDefault2" default='false'>
<xs:simpleType>
<xs:restriction base='dfe:mystring'>
<xs:enumeration value='true'/>
<xs:enumeration value='false'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="LocalEnumElementFixed2" fixed='false'>
<xs:simpleType>
<xs:restriction base='dfe:mystring'>
<xs:enumeration value='true'/>
<xs:enumeration value='false'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:element name='Element'>
<xs:complexType>
<xs:sequence maxOccurs="5">
<xs:element name='LocalEnumElementDefault1' default='false'>
<xs:simpleType>
<xs:restriction base='xs:string'>
<xs:enumeration value='true'/>
<xs:enumeration value='false'/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name='LocalEnumElementDefault2' default='false'>
<xs:simpleType>
<xs:restriction base='dfe:mystring'>
<xs:enumeration value='true'/>
<xs:enumeration value='false'/>
<