diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2005-07-31 16:49:51 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2005-07-31 16:49:51 +0000 |
commit | d541c8f8b460c7a82c1d2142706372f681293f75 (patch) | |
tree | 9413784499299883aff84cd20ff99f5a03479ddf /test/schematron | |
parent | 5fe95a8fd95bdc8de8c33fc87f190ae4764b2c64 (diff) | |
download | android_external_libxml2-d541c8f8b460c7a82c1d2142706372f681293f75.tar.gz android_external_libxml2-d541c8f8b460c7a82c1d2142706372f681293f75.tar.bz2 android_external_libxml2-d541c8f8b460c7a82c1d2142706372f681293f75.zip |
report improvement more tests Daniel
* schematron.c: report improvement
* test/schematron/zvon* result/schematron/zvon*: more tests
Daniel
Diffstat (limited to 'test/schematron')
42 files changed, 251 insertions, 0 deletions
diff --git a/test/schematron/zvon11.sct b/test/schematron/zvon11.sct new file mode 100644 index 00000000..79b01fdf --- /dev/null +++ b/test/schematron/zvon11.sct @@ -0,0 +1,8 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="Attributes present"> + <rule context="BBB"> + <assert test="not(@aaa) or (@aaa and @bbb)">The element must not have an isolated aaa attribute</assert> + <assert test="not(@bbb) or (@aaa and @bbb)">The element must not have an isolated bbb attribute</assert> + </rule> + </pattern> +</schema> diff --git a/test/schematron/zvon11_0.xml b/test/schematron/zvon11_0.xml new file mode 100644 index 00000000..f065eed2 --- /dev/null +++ b/test/schematron/zvon11_0.xml @@ -0,0 +1,3 @@ +<AAA> + <BBB aaa="A" bbb="B"/> +</AAA> diff --git a/test/schematron/zvon11_1.xml b/test/schematron/zvon11_1.xml new file mode 100644 index 00000000..c8899331 --- /dev/null +++ b/test/schematron/zvon11_1.xml @@ -0,0 +1,3 @@ +<AAA> + <BBB bbb="B"/> +</AAA> diff --git a/test/schematron/zvon11_2.xml b/test/schematron/zvon11_2.xml new file mode 100644 index 00000000..26e12213 --- /dev/null +++ b/test/schematron/zvon11_2.xml @@ -0,0 +1,3 @@ +<AAA> + <BBB aaa="A"/> +</AAA> diff --git a/test/schematron/zvon11_3.xml b/test/schematron/zvon11_3.xml new file mode 100644 index 00000000..d3ac3884 --- /dev/null +++ b/test/schematron/zvon11_3.xml @@ -0,0 +1,3 @@ +<AAA> + <BBB/> +</AAA> diff --git a/test/schematron/zvon12.sct b/test/schematron/zvon12.sct new file mode 100644 index 00000000..049b125e --- /dev/null +++ b/test/schematron/zvon12.sct @@ -0,0 +1,8 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="Number of characters in an abbreviation"> + <rule context="BBB"> + <report test="string-length(@bbb) < 2">There is not enough letters in the abbreviation</report> + <report test="string-length(@bbb) > 3">There is too much letters in the abbreviation</report> + </rule> + </pattern> +</schema> diff --git a/test/schematron/zvon12_0.xml b/test/schematron/zvon12_0.xml new file mode 100644 index 00000000..d5f28d53 --- /dev/null +++ b/test/schematron/zvon12_0.xml @@ -0,0 +1,3 @@ +<AAA> + <BBB bbb="C"/> +</AAA> diff --git a/test/schematron/zvon12_1.xml b/test/schematron/zvon12_1.xml new file mode 100644 index 00000000..3507f6b5 --- /dev/null +++ b/test/schematron/zvon12_1.xml @@ -0,0 +1,3 @@ +<AAA> + <BBB bbb="CZ"/> +</AAA> diff --git a/test/schematron/zvon12_2.xml b/test/schematron/zvon12_2.xml new file mode 100644 index 00000000..e0d81afa --- /dev/null +++ b/test/schematron/zvon12_2.xml @@ -0,0 +1,3 @@ +<AAA> + <BBB bbb="CZCZ"/> +</AAA> diff --git a/test/schematron/zvon13.sct b/test/schematron/zvon13.sct new file mode 100644 index 00000000..cd433e01 --- /dev/null +++ b/test/schematron/zvon13.sct @@ -0,0 +1,7 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="Sum equals 100%."> + <rule context="Total"> + <assert test="sum(//Percent) = 100">The values do not sum to 100%. </assert> + </rule> + </pattern> +</schema> diff --git a/test/schematron/zvon13_0.xml b/test/schematron/zvon13_0.xml new file mode 100644 index 00000000..52619c3b --- /dev/null +++ b/test/schematron/zvon13_0.xml @@ -0,0 +1,6 @@ +<Total> + <Percent>20</Percent> + <Percent>30</Percent> + <Percent>10</Percent> + <Percent>50</Percent> +</Total> diff --git a/test/schematron/zvon13_1.xml b/test/schematron/zvon13_1.xml new file mode 100644 index 00000000..8fb73683 --- /dev/null +++ b/test/schematron/zvon13_1.xml @@ -0,0 +1,5 @@ +<Total> + <Percent>20</Percent> + <Percent>10</Percent> + <Percent>50</Percent> +</Total> diff --git a/test/schematron/zvon13_2.xml b/test/schematron/zvon13_2.xml new file mode 100644 index 00000000..af4d76ad --- /dev/null +++ b/test/schematron/zvon13_2.xml @@ -0,0 +1,5 @@ +<Total> + <Percent>20</Percent> + <Percent>30</Percent> + <Percent>50</Percent> +</Total> diff --git a/test/schematron/zvon14.sct b/test/schematron/zvon14.sct new file mode 100644 index 00000000..f98b6d89 --- /dev/null +++ b/test/schematron/zvon14.sct @@ -0,0 +1,10 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="a child of selected elements"> + <rule context="CCC"> + <assert test="parent::*[name()='BBB' or name()='DDD']">Element CCC must not be a child of element + <name path="parent::*"/> + </assert> + </rule> + </pattern> +</schema> + diff --git a/test/schematron/zvon14_0.xml b/test/schematron/zvon14_0.xml new file mode 100644 index 00000000..b6270436 --- /dev/null +++ b/test/schematron/zvon14_0.xml @@ -0,0 +1,12 @@ +<AAA> + <BBB> + <CCC/> + </BBB> + <CCC/> + <DDD> + <CCC/> + <EEE> + <CCC/> + </EEE> + </DDD> +</AAA> diff --git a/test/schematron/zvon15.sct b/test/schematron/zvon15.sct new file mode 100644 index 00000000..7da5d868 --- /dev/null +++ b/test/schematron/zvon15.sct @@ -0,0 +1,11 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="id is the only permited attribute name"> + <rule context="*"> + <report test="@*[not(name()='id')]">Attribute + <name path="@*[not(name()='id')]"/> is forbidden in element + <name/> + </report> + </rule> + </pattern> +</schema> + diff --git a/test/schematron/zvon15_0.xml b/test/schematron/zvon15_0.xml new file mode 100644 index 00000000..390aedb5 --- /dev/null +++ b/test/schematron/zvon15_0.xml @@ -0,0 +1,4 @@ +<AAA name="aaa"> +<BBB id="bbb"/> +<CCC color="ccc"/> +</AAA> diff --git a/test/schematron/zvon4.sct b/test/schematron/zvon4.sct new file mode 100644 index 00000000..0b8a4e1b --- /dev/null +++ b/test/schematron/zvon4.sct @@ -0,0 +1,10 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="Root test"> + <rule context="/*"> + <assert test="name()='AAA'">Root element is + <name/>, not AAA + </assert> + <report test="name()='AAA'">Root element is AAA</report> + </rule> + </pattern> +</schema> diff --git a/test/schematron/zvon4_0.xml b/test/schematron/zvon4_0.xml new file mode 100644 index 00000000..4ba332e4 --- /dev/null +++ b/test/schematron/zvon4_0.xml @@ -0,0 +1,6 @@ +<AAA> + <BBB> + <CCC/> + <CCC/> + </BBB> +</AAA> diff --git a/test/schematron/zvon4_1.xml b/test/schematron/zvon4_1.xml new file mode 100644 index 00000000..5becbcf6 --- /dev/null +++ b/test/schematron/zvon4_1.xml @@ -0,0 +1,6 @@ +<XXX> + <BBB> + <CCC/> + <CCC/> + </BBB> +</XXX> diff --git a/test/schematron/zvon5.sct b/test/schematron/zvon5.sct new file mode 100644 index 00000000..36cb8bb1 --- /dev/null +++ b/test/schematron/zvon5.sct @@ -0,0 +1,12 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="Select empty elements CCC"> + <rule context="CCC"> + <assert test="normalize-space(.) and *">Source contains an empty element CCC </assert> + <report test="normalize-space(.) = ''">[1]An element CCC does not contain any text</report> + <assert test="normalize-space(.)">[2]An element CCC does not contain any text</assert> + <report test="not(*)">[1]An element CCC does not contain any child element</report> + <assert test="*">[2]An element CCC does not contain any child element</assert> + </rule> + </pattern> +</schema> + diff --git a/test/schematron/zvon5_0.xml b/test/schematron/zvon5_0.xml new file mode 100644 index 00000000..dc7c36ba --- /dev/null +++ b/test/schematron/zvon5_0.xml @@ -0,0 +1,5 @@ +<AAA> + <BBB> + <CCC/> + </BBB> +</AAA> diff --git a/test/schematron/zvon5_1.xml b/test/schematron/zvon5_1.xml new file mode 100644 index 00000000..6915fa63 --- /dev/null +++ b/test/schematron/zvon5_1.xml @@ -0,0 +1,5 @@ +<AAA> + <BBB> + <CCC>I am CCC element</CCC> + </BBB> +</AAA> diff --git a/test/schematron/zvon5_2.xml b/test/schematron/zvon5_2.xml new file mode 100644 index 00000000..2a114004 --- /dev/null +++ b/test/schematron/zvon5_2.xml @@ -0,0 +1,7 @@ +<AAA> + <BBB> + <CCC> + <DDD/> + </CCC> + </BBB> +</AAA> diff --git a/test/schematron/zvon6.sct b/test/schematron/zvon6.sct new file mode 100644 index 00000000..678ae580 --- /dev/null +++ b/test/schematron/zvon6.sct @@ -0,0 +1,8 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="Predefined values"> + <rule context="AAA"> + <report test="normalize-space(.) = 'aaa' or normalize-space(.) = 'bbb'">O.K.</report> + <assert test="normalize-space(.) = 'aaa' or normalize-space(.) = 'bbb'">The AAA value is not permitted.</assert> + </rule> + </pattern> +</schema> diff --git a/test/schematron/zvon6_0.xml b/test/schematron/zvon6_0.xml new file mode 100644 index 00000000..a3efb701 --- /dev/null +++ b/test/schematron/zvon6_0.xml @@ -0,0 +1,3 @@ +<AAA> +aaa +</AAA> diff --git a/test/schematron/zvon6_1.xml b/test/schematron/zvon6_1.xml new file mode 100644 index 00000000..7d7daf86 --- /dev/null +++ b/test/schematron/zvon6_1.xml @@ -0,0 +1,3 @@ +<AAA> + bbb +</AAA> diff --git a/test/schematron/zvon6_2.xml b/test/schematron/zvon6_2.xml new file mode 100644 index 00000000..555f24d4 --- /dev/null +++ b/test/schematron/zvon6_2.xml @@ -0,0 +1,3 @@ +<AAA> + ccc +</AAA> diff --git a/test/schematron/zvon7.sct b/test/schematron/zvon7.sct new file mode 100644 index 00000000..a22a89ed --- /dev/null +++ b/test/schematron/zvon7.sct @@ -0,0 +1,9 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="Test integer"> + <rule context="AAA"> + <report test="floor(.) = number(.)">O.K.</report> + <assert test="floor(.) = number(.)">The AAA value is not an integer.</assert> + </rule> + </pattern> +</schema> + diff --git a/test/schematron/zvon7_0.xml b/test/schematron/zvon7_0.xml new file mode 100644 index 00000000..a3efb701 --- /dev/null +++ b/test/schematron/zvon7_0.xml @@ -0,0 +1,3 @@ +<AAA> +aaa +</AAA> diff --git a/test/schematron/zvon7_1.xml b/test/schematron/zvon7_1.xml new file mode 100644 index 00000000..8da0ae59 --- /dev/null +++ b/test/schematron/zvon7_1.xml @@ -0,0 +1,3 @@ +<AAA> + 12.234 +</AAA> diff --git a/test/schematron/zvon7_2.xml b/test/schematron/zvon7_2.xml new file mode 100644 index 00000000..e27cfe78 --- /dev/null +++ b/test/schematron/zvon7_2.xml @@ -0,0 +1,3 @@ +<AAA> +45 +</AAA> diff --git a/test/schematron/zvon7_3.xml b/test/schematron/zvon7_3.xml new file mode 100644 index 00000000..c17295af --- /dev/null +++ b/test/schematron/zvon7_3.xml @@ -0,0 +1,3 @@ +<AAA> +0 +</AAA> diff --git a/test/schematron/zvon7_4.xml b/test/schematron/zvon7_4.xml new file mode 100644 index 00000000..4f34fbea --- /dev/null +++ b/test/schematron/zvon7_4.xml @@ -0,0 +1,3 @@ +<AAA> +-45 +</AAA> diff --git a/test/schematron/zvon8.sct b/test/schematron/zvon8.sct new file mode 100644 index 00000000..5641ecdb --- /dev/null +++ b/test/schematron/zvon8.sct @@ -0,0 +1,10 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="Test count"> + <rule context="/*"> + <report test="count(//BBB) = count(//AAA)">O.K.</report> + <assert test="count(//BBB) <= count(//AAA)">Some AAA are missing</assert> + <report test="count(//BBB) < count(//AAA)">Some BBB are missing</report> + </rule> + </pattern> +</schema> + diff --git a/test/schematron/zvon8_0.xml b/test/schematron/zvon8_0.xml new file mode 100644 index 00000000..b6739bb4 --- /dev/null +++ b/test/schematron/zvon8_0.xml @@ -0,0 +1,8 @@ +<XXX> + <BBB/> + <BBB/> + <AAA/> + <BBB/> + <AAA/> + <AAA/> +</XXX> diff --git a/test/schematron/zvon8_1.xml b/test/schematron/zvon8_1.xml new file mode 100644 index 00000000..196dbe25 --- /dev/null +++ b/test/schematron/zvon8_1.xml @@ -0,0 +1,7 @@ +<XXX> + <BBB/> + <AAA/> + <BBB/> + <AAA/> + <AAA/> +</XXX> diff --git a/test/schematron/zvon8_2.xml b/test/schematron/zvon8_2.xml new file mode 100644 index 00000000..f85de825 --- /dev/null +++ b/test/schematron/zvon8_2.xml @@ -0,0 +1,7 @@ +<XXX> + <BBB/> + <BBB/> + <AAA/> + <BBB/> + <AAA/> +</XXX> diff --git a/test/schematron/zvon9.sct b/test/schematron/zvon9.sct new file mode 100644 index 00000000..6f67877f --- /dev/null +++ b/test/schematron/zvon9.sct @@ -0,0 +1,9 @@ +<schema xmlns="http://www.ascc.net/xml/schematron" > + <pattern name="Test attribute"> + <rule context="CCC"> + <report test="parent::BBB and not(@id)">Attribute id is missing</report> + <report test="not(parent::BBB) and @id">Attribute id is used in wrong context</report> + </rule> + </pattern> +</schema> + diff --git a/test/schematron/zvon9_0.xml b/test/schematron/zvon9_0.xml new file mode 100644 index 00000000..d8715192 --- /dev/null +++ b/test/schematron/zvon9_0.xml @@ -0,0 +1,7 @@ +<AAA> + <CCC/> + <CCC/> + <BBB> + <CCC id="Q1"/> + </BBB> +</AAA> diff --git a/test/schematron/zvon9_1.xml b/test/schematron/zvon9_1.xml new file mode 100644 index 00000000..5c1c1bf0 --- /dev/null +++ b/test/schematron/zvon9_1.xml @@ -0,0 +1,7 @@ +<AAA> + <CCC id="Q2"/> + <CCC/> + <BBB> + <CCC id="Q1"/> + </BBB> +</AAA> diff --git a/test/schematron/zvon9_2.xml b/test/schematron/zvon9_2.xml new file mode 100644 index 00000000..7e09fab8 --- /dev/null +++ b/test/schematron/zvon9_2.xml @@ -0,0 +1,7 @@ +<AAA> + <CCC/> + <CCC/> + <BBB> + <CCC/> + </BBB> +</AAA> |