blob: fe343a05f9bccc355be6bf9aa39821e2c53a0c2a [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012-2013 Tresys Technology, LLC. All rights reserved.
Developed by: Tresys Technology, LLC
http://www.tresys.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
3. Neither the names of Tresys Technology, nor the names of its contributors
may be used to endorse or promote products derived from this Software
without specific prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
-->
<tdml:testSuite suiteName="ImplicitTests"
description="Section 12 - lengthKind=implicit" xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ct="http://w3.ibm.com/xmlns/dfdl/ctInfoset"
xmlns:ex="http://example.com">
<tdml:defineSchema name="implicit_tests_embedded">
<dfdl:format ref="ex:daffodilTest1" />
<xs:element name="timeImp" type="xs:time"
dfdl:lengthKind="implicit" dfdl:representation="text"/>
<xs:element name="data_01" type="xs:string"
dfdl:lengthKind="pattern" dfdl:lengthPattern="(a|b|c)" />
<xs:element name="data_02" type="xs:string"
dfdl:lengthKind="pattern" dfdl:lengthPattern="(1|2|3)" />
<!-- There are asserts on the element refs below. It would be better if
those were moved onto the data_01 and data_02 element declarations, but due
to bug DFDL-809, that doesn't work as of updating these tests to work with
the fix for DFDL-808. -->
<xs:element name="seq_01">
<xs:complexType>
<xs:sequence>
<xs:element ref="ex:data_02">
<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:assert testKind="pattern" testPattern="(1|2|3)" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element ref="ex:data_01">
<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:assert testKind="pattern" testPattern="(a|b|c)"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="seq_02" dfdl:lengthKind="implicit"
dfdl:initiator="?">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element ref="ex:seq_01" />
<xs:element ref="ex:data_01">
<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:assert testKind="pattern" testPattern="(a|b|c)" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="seq_03" dfdl:lengthKind="implicit"
dfdl:initiator="%WSP*;">
<xs:complexType>
<xs:sequence>
<xs:element ref="ex:seq_02" minOccurs="1"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="nested_seq" dfdl:lengthKind="implicit"
dfdl:terminator="$">
<xs:complexType>
<xs:sequence>
<xs:element ref="ex:seq_03" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="nested_seq_01" dfdl:lengthKind="implicit"
dfdl:terminator="$">
<xs:complexType>
<xs:sequence>
<xs:element ref="ex:seq_03" minOccurs="0"
maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="elem01" dfdl:lengthKind="implicit" dfdl:length="5" type="xs:int"/>
</tdml:defineSchema>
<!--
Test name: implicit_with_len
Schema: implicit_tests_embedded
Purpose: This test demonstrates SDE when lengthKind="implicit"
representation is text, and type is not string or hexbinary.
-->
<tdml:parserTestCase name="implicit_with_len" root="elem01"
model="implicit_tests_embedded" description="">
<tdml:document><![CDATA[1234]]></tdml:document>
<tdml:errors>
<tdml:error>Schema Definition Error</tdml:error>
<tdml:error>type</tdml:error>
<tdml:error>int</tdml:error>
<tdml:error>representation</tdml:error>
<tdml:error>text</tdml:error>
<tdml:error>lengthKind</tdml:error>
<tdml:error>implicit</tdml:error>
</tdml:errors>
</tdml:parserTestCase>
<tdml:parserTestCase name="nested_seq" root="nested_seq"
model="implicit_tests_embedded" description="lengthKind implicit on complex element - DFDL-12-055R">
<tdml:document><![CDATA[?a?2a?a?b?c?a?b$]]></tdml:document>
<tdml:infoset>
<tdml:dfdlInfoset>
<nested_seq>
<seq_03>
<seq_02>
<data_01>a</data_01>
</seq_02>
<seq_02>
<seq_01>
<data_02>2</data_02>
<data_01>a</data_01>
</seq_01>
</seq_02>
<seq_02>
<data_01>a</data_01>
</seq_02>
<seq_02>
<data_01>b</data_01>
</seq_02>
<seq_02>
<data_01>c</data_01>
</seq_02>
<seq_02>
<data_01>a</data_01>
</seq_02>
<seq_02>
<data_01>b</data_01>
</seq_02>
</seq_03>
</nested_seq>
</tdml:dfdlInfoset>
</tdml:infoset>
</tdml:parserTestCase>
<tdml:parserTestCase name="nested_seq_01" root="nested_seq_01"
model="implicit_tests_embedded" description="lengthKind implicit on complex element - DFDL-12-055R">
<tdml:document><![CDATA[?a?2a?a?b?c?a?b$]]></tdml:document>
<tdml:infoset>
<tdml:dfdlInfoset>
<nested_seq_01>
<seq_03>
<seq_02>
<data_01>a</data_01>
</seq_02>
<seq_02>
<seq_01>
<data_02>2</data_02>
<data_01>a</data_01>
</seq_01>
</seq_02>
<seq_02>
<data_01>a</data_01>
</seq_02>
<seq_02>
<data_01>b</data_01>
</seq_02>
<seq_02>
<data_01>c</data_01>
</seq_02>
<seq_02>
<data_01>a</data_01>
</seq_02>
<seq_02>
<data_01>b</data_01>
</seq_02>
</seq_03>
</nested_seq_01>
</tdml:dfdlInfoset>
</tdml:infoset>
</tdml:parserTestCase>
<!--
Test name: implicitLenTime
Schema: implicit_tests_embedded
Purpose: This test demonstrates that you can not have lengthKind="implicit" for a textual representation of a time element.
-->
<tdml:parserTestCase name="implicitLenTime" root="timeImp"
model="implicit_tests_embedded" description="Section 12 - Length Kind implicit - DFDL-12-067R">
<tdml:document><![CDATA[04:44:23.3000]]></tdml:document>
<tdml:errors>
<tdml:error>Schema Definition Error</tdml:error>
<tdml:error>time</tdml:error>
<tdml:error>lengthKind='implicit'</tdml:error>
<tdml:error></tdml:error>
<tdml:error>representation='text'</tdml:error>
</tdml:errors>
</tdml:parserTestCase>
</tdml:testSuite>