Added regression tests for the latest IDC and xs:decimal bugs.

* test/schemas/decimal* test/schemas/bug322411*: Added
  regression tests for the latest IDC and xs:decimal bugs.
This commit is contained in:
Kasimier T. Buchcik 2005-11-30 11:24:18 +00:00
parent f39e8d1f05
commit bf442eb243
11 changed files with 309 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Wed Nov 30 12:22:23 CET 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* test/schemas/decimal* test/schemas/bug322411*: Added
regression tests for the latest IDC and xs:decimal bugs.
Wed Nov 30 11:57:35 CET 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xmlschemas.c: Fixed bubbling of duplicate IDC nodes: the

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<ELEMENTS>
<ELEMENT>
<items>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<!-- Some dupls. -->
<item>dupl1</item>
<item>dupl2</item>
<item>dupl3</item>
<item>dupl4</item>
<item>dupl5</item>
<item>dupl6</item>
<item>dupl7</item>
<item>dupl8</item>
<item>dupl9</item>
<item>dupl10</item>
<item>dupl11</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<items>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<!-- Some dupls. -->
<item>dupl1</item>
<item>dupl2</item>
<item>dupl3</item>
<item>dupl4</item>
<item>dupl5</item>
<item>dupl6</item>
<item>dupl7</item>
<item>dupl8</item>
<item>dupl9</item>
<item>dupl10</item>
<item>dupl11</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
<item>21</item>
</items>
<items>
<item>22</item>
<item>23</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
<item>31</item>
<item>32</item>
<item>33</item>
<item>34</item>
<item>35</item>
<item>36</item>
<item>37</item>
<item>38</item>
<item>39</item>
<item>40</item>
<item>41</item>
<!-- Some dupls. -->
<item>dupl1</item>
<item>dupl2</item>
<item>dupl3</item>
<item>dupl4</item>
<item>dupl5</item>
<item>dupl6</item>
<item>dupl7</item>
<item>dupl8</item>
<item>dupl9</item>
<item>dupl10</item>
<item>dupl11</item>
</items>
</items>
<!-- Keyrefs. -->
<ref>41</ref>
</ELEMENT>
</ELEMENTS>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="items">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item" maxOccurs="unbounded" type="xsd:string"/>
<xsd:element ref="items" minOccurs="0" maxOccurs="2"/>
</xsd:sequence>
</xsd:complexType>
<xsd:unique name="ItemUnique">
<xsd:selector xpath="item"/>
<xsd:field xpath="."/>
</xsd:unique>
</xsd:element>
<xsd:element name="ELEMENTS">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ELEMENT">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="items"/>
<xsd:element name="ref" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:keyref name="ItemRef" refer="ItemUnique">
<xsd:selector xpath="ref"/>
<xsd:field xpath="."/>
</xsd:keyref>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,37 @@
<?xml version="1.0"?>
<!-- test the values:
- BAD
+ BAD
1.
.1
0.
.0
- 1 BAD
+ 1 BAD
. BAD
000 !
-->
<foo
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="decimal-1.xsd">
<!-- The good ones. -->
<val> 0. </val>
<val> .0 </val>
<val> .10 </val>
<val> 01. </val>
<val> 000 </val>
<val>123456789012345678</val>
<val>-123456789012345678</val>
<val>0.123456789012345678</val>
<val>-0.123456789012345678</val>
<!-- The bad ones. -->
<val>.</val>
<val>-</val>
<val>+</val>
<val>*</val>
<val>- 1</val>
<val>+ 1</val>
<val>+ 0</val>
<val>- 0</val>
<!--ref>0.0</ref-->
</foo>

View File

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="myDecimal">
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="18"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="val" type="myDecimal" maxOccurs="unbounded"/>
<xsd:element name="ref" type="myDecimal" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!--xsd:key name="myKey">
<xsd:selector xpath="val"/>
<xsd:field xpath="."/>
</xsd:key>
<xsd:keyref name="myKeyRef" refer="myKey">
<xsd:selector xpath="ref"/>
<xsd:field xpath="."/>
</xsd:keyref-->
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<foo
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="decimal-1.xsd">
<!-- The good ones. -->
<val> 0. </val>
<val> .0 </val>
<val> .10 </val>
<val> 01. </val>
<val> 000 </val>
<val>123456789012345678</val>
<val>-123456789012345678</val>
<val>0.123456789012345678</val>
<val>-0.123456789012345678</val>
<!-- The bad ones. -->
<val>.</val>
<val>-</val>
<val>+</val>
<val>*</val>
<val>- 1</val>
<val>+ 1</val>
<val>+ 0</val>
<val>- 0</val>
</foo>

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="myDecimal">
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="18"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="val" type="myDecimal" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<foo
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="decimal-2.xsd">
<!-- The good ones. -->
<val>0.1</val>
<val>0.001</val>
<val>0.0</val>
<val>-0.0</val>
<val>1</val>
<!-- The bad ones. -->
<val>-0.1</val>
<val>-1</val>
</foo>

View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="myDecimal">
<xsd:restriction base="xsd:decimal">
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="val" type="myDecimal" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<foo
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="decimal-3.xsd">
<!-- The good ones. -->
<val>0.12</val>
<val>0.0</val>
<val>0.02</val>
<val>12</val>
<val>1.2</val>
<!-- The bad ones. -->
<val>0.123</val>
<val>0.023</val>
<val>123</val>
<val>12.3</val>
</foo>

View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="myDecimal">
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="2"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="val" type="myDecimal" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>