diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2016-10-19 18:25:21 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2016-10-19 18:25:21 (GMT) |
commit | d72feaf69933b069cff3c0cb20a5f5f03ecba77b (patch) | |
tree | bf51d2814f4be65c850dba86dc2a5db0ad38bedf /libxslt/tests/exslt/sets | |
parent | 34be72f9ed749a5c013d3f7f47d810e8caf652cb (diff) | |
parent | 49e8fbec2420ef55b3246aabd89328b13530810c (diff) | |
download | blt-d72feaf69933b069cff3c0cb20a5f5f03ecba77b.zip blt-d72feaf69933b069cff3c0cb20a5f5f03ecba77b.tar.gz blt-d72feaf69933b069cff3c0cb20a5f5f03ecba77b.tar.bz2 |
Merge commit '49e8fbec2420ef55b3246aabd89328b13530810c' as 'libxslt'
Diffstat (limited to 'libxslt/tests/exslt/sets')
-rw-r--r-- | libxslt/tests/exslt/sets/Makefile.am | 50 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/difference.1.out | 28 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/difference.1.xml | 14 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/difference.1.xsl | 46 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/distinct.1.out | 19 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/distinct.1.xml | 14 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/distinct.1.xsl | 24 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/has-same-node.1.out | 11 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/has-same-node.1.xml | 14 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/has-same-node.1.xsl | 24 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/leading.1.out | 10 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/leading.1.xml | 5 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/leading.1.xsl | 22 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/trailing.1.out | 9 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/trailing.1.xml | 5 | ||||
-rw-r--r-- | libxslt/tests/exslt/sets/trailing.1.xsl | 21 |
16 files changed, 316 insertions, 0 deletions
diff --git a/libxslt/tests/exslt/sets/Makefile.am b/libxslt/tests/exslt/sets/Makefile.am new file mode 100644 index 0000000..2f77c2d --- /dev/null +++ b/libxslt/tests/exslt/sets/Makefile.am @@ -0,0 +1,50 @@ +## Process this file with automake to produce Makefile.in + +$(top_builddir)/xsltproc/xsltproc: + @(cd ../../../xsltproc ; $(MAKE) xsltproc) + +EXTRA_DIST = \ + difference.1.out difference.1.xml difference.1.xsl \ + distinct.1.out distinct.1.xml distinct.1.xsl \ + has-same-node.1.out has-same-node.1.xml has-same-node.1.xsl \ + leading.1.out leading.1.xml leading.1.xsl \ + trailing.1.out trailing.1.xml trailing.1.xsl + +CLEANFILES = .memdump + +valgrind: + @echo '## Running the regression tests under Valgrind' + $(MAKE) CHECKER='libtool --mode=execute valgrind -q --leak-check=full' tests + +test tests: $(top_builddir)/xsltproc/xsltproc + @echo '## Running exslt sets tests' + @(echo > .memdump) + @(for i in $(srcdir)/*.xsl ; do \ + name=`basename $$i .xsl` ; \ + if [ ! -f $(srcdir)/$$name.xml ] ; then continue ; fi ; \ + log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \ + $(srcdir)/$$name.xsl $(srcdir)/$$name.xml > $$name.res 2>$$name.bad;\ + if [ ! -f $(srcdir)/$$name.out ] ; then \ + cp $$name.res $(srcdir)/$$name.out ; \ + if [ -s $$name.bad ] ; then \ + mv $$name.bad $(srcdir)/$$name.err ; \ + fi ; \ + else \ + if [ ! -s $$name.res ] ; then \ + echo "Fatal error, no $$name.res\n" ; \ + else \ + diff $(srcdir)/$$name.out $$name.res ; \ + if [ -s $(srcdir)/$$name.err ] ; then \ + diff $(srcdir)/$$name.err $$name.bad; \ + else \ + diff /dev/null $$name.bad; \ + fi ; \ + fi ; \ + fi; \ + grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true`;\ + if [ -n "$$log" ] ; then \ + echo $$name result ; \ + echo "$$log" ; \ + fi ; \ + rm -f $$name.res $$name.bad ; \ + done) diff --git a/libxslt/tests/exslt/sets/difference.1.out b/libxslt/tests/exslt/sets/difference.1.out new file mode 100644 index 0000000..66bfa1e --- /dev/null +++ b/libxslt/tests/exslt/sets/difference.1.out @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<out xmlns:set="http://exslt.org/sets"> + Containing i and e: + Vienna; + Berlin; + + Containing i and no e: + Paris; + Madrid; + Calais; + + Containing e and no i: + Barcelona; + Hannover; + + Containing i: + Paris; + Madrid; + Vienna; + Calais; + Berlin; + + Empty set: + + Empty set: + + Empty set: + </out> diff --git a/libxslt/tests/exslt/sets/difference.1.xml b/libxslt/tests/exslt/sets/difference.1.xml new file mode 100644 index 0000000..8ff89fc --- /dev/null +++ b/libxslt/tests/exslt/sets/difference.1.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> + +<doc> +<city name="Paris" country="France"/> +<city name="Madrid" country="Spain"/> +<city name="Vienna" country="Austria"/> +<city name="Barcelona" country="Spain"/> +<city name="Salzburg" country="Austria"/> +<city name="Bonn" country="Germany"/> +<city name="Lyon" country="France"/> +<city name="Hannover" country="Germany"/> +<city name="Calais" country="France"/> +<city name="Berlin" country="Germany"/> +</doc> diff --git a/libxslt/tests/exslt/sets/difference.1.xsl b/libxslt/tests/exslt/sets/difference.1.xsl new file mode 100644 index 0000000..2a32e26 --- /dev/null +++ b/libxslt/tests/exslt/sets/difference.1.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0"?> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" +xmlns:set="http://exslt.org/sets" > + +<!-- Test set:intersection, difference --> + +<xsl:variable name="i" select="//city[contains(@name,'i')]"/> +<xsl:variable name="e" select="//city[contains(@name,'e')]"/> + +<xsl:template match="/"> + <out> + Containing i and e: + <xsl:for-each select="set:intersection($i, $e)"> + <xsl:value-of select="@name"/>; + </xsl:for-each> + Containing i and no e: + <xsl:for-each select="set:difference($i, $e)"> + <xsl:value-of select="@name"/>; + </xsl:for-each> + Containing e and no i: + <xsl:for-each select="set:difference($e, $i)"> + <xsl:value-of select="@name"/>; + </xsl:for-each> + + <!-- test intersection and difference on empty sets --> + Containing i: + <xsl:for-each select="set:difference($i, /..)"> + <xsl:value-of select="@name"/>; + </xsl:for-each> + Empty set: + <xsl:for-each select="set:intersection($i, /..)"> + <xsl:value-of select="@name"/>; + </xsl:for-each> + Empty set: + <xsl:for-each select="set:intersection(/.., $i)"> + <xsl:value-of select="@name"/>; + </xsl:for-each> + Empty set: + <xsl:for-each select="set:difference(/.., $i)"> + <xsl:value-of select="@name"/>; + </xsl:for-each> + </out> +</xsl:template> + +</xsl:stylesheet> diff --git a/libxslt/tests/exslt/sets/distinct.1.out b/libxslt/tests/exslt/sets/distinct.1.out new file mode 100644 index 0000000..f91efd6 --- /dev/null +++ b/libxslt/tests/exslt/sets/distinct.1.out @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<out xmlns:set="http://exslt.org/sets"><all-countries>: + France; + Spain; + Austria; + Spain; + Austria; + Germany; + France; + Germany; + France; + Germany; + </all-countries>: + <distinct-countries>: + France; + Spain; + Austria; + Germany; + </distinct-countries></out> diff --git a/libxslt/tests/exslt/sets/distinct.1.xml b/libxslt/tests/exslt/sets/distinct.1.xml new file mode 100644 index 0000000..8ff89fc --- /dev/null +++ b/libxslt/tests/exslt/sets/distinct.1.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> + +<doc> +<city name="Paris" country="France"/> +<city name="Madrid" country="Spain"/> +<city name="Vienna" country="Austria"/> +<city name="Barcelona" country="Spain"/> +<city name="Salzburg" country="Austria"/> +<city name="Bonn" country="Germany"/> +<city name="Lyon" country="France"/> +<city name="Hannover" country="Germany"/> +<city name="Calais" country="France"/> +<city name="Berlin" country="Germany"/> +</doc> diff --git a/libxslt/tests/exslt/sets/distinct.1.xsl b/libxslt/tests/exslt/sets/distinct.1.xsl new file mode 100644 index 0000000..621e41f --- /dev/null +++ b/libxslt/tests/exslt/sets/distinct.1.xsl @@ -0,0 +1,24 @@ +<?xml version="1.0"?> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" +xmlns:set="http://exslt.org/sets" > + +<!-- Test exslt:distinct --> + + +<xsl:template match="/"> + <out> + <all-countries>: + <xsl:for-each select="//@country"> + <xsl:value-of select="."/>; + </xsl:for-each> + </all-countries>: + <distinct-countries>: + <xsl:for-each select="set:distinct(//@country)"> + <xsl:value-of select="."/>; + </xsl:for-each> + </distinct-countries> + </out> +</xsl:template> + +</xsl:stylesheet> diff --git a/libxslt/tests/exslt/sets/has-same-node.1.out b/libxslt/tests/exslt/sets/has-same-node.1.out new file mode 100644 index 0000000..29f6003 --- /dev/null +++ b/libxslt/tests/exslt/sets/has-same-node.1.out @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<out xmlns:set="http://exslt.org/sets"> + Test has-same-node() between two intersecting sets: + OK; + Test has-same-node() between two non-intersecting sets: + OK; + Test has-same-node() between two identical sets of namespace nodes: + OK; + Test has-same-node() between two disjoint sets of namespace nodes: + OK; + </out> diff --git a/libxslt/tests/exslt/sets/has-same-node.1.xml b/libxslt/tests/exslt/sets/has-same-node.1.xml new file mode 100644 index 0000000..efe2d17 --- /dev/null +++ b/libxslt/tests/exslt/sets/has-same-node.1.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> + +<doc> +<city name="Paris" country="France" xmlns:x="one"/> +<city name="Madrid" country="Spain" xmlns:x="one"/> +<city name="Vienna" country="Austria" xmlns:x="one"/> +<city name="Barcelona" country="Spain" xmlns:x="one"/> +<city name="Salzburg" country="Austria" xmlns:x="one"/> +<city name="Bonn" country="Germany" xmlns:x="one"/> +<city name="Lyon" country="France" xmlns:x="one"/> +<city name="Hannover" country="Germany" xmlns:x="one"/> +<city name="Calais" country="France" xmlns:x="one"/> +<city name="Berlin" country="Germany" xmlns:x="one"/> +</doc> diff --git a/libxslt/tests/exslt/sets/has-same-node.1.xsl b/libxslt/tests/exslt/sets/has-same-node.1.xsl new file mode 100644 index 0000000..f0b952a --- /dev/null +++ b/libxslt/tests/exslt/sets/has-same-node.1.xsl @@ -0,0 +1,24 @@ +<?xml version="1.0"?> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" +xmlns:set="http://exslt.org/sets" > + +<!-- Test set:has-same-node --> + +<xsl:variable name="a1" select="//city[@name='Vienna' or @name='Salzburg']"/> +<xsl:variable name="a2" select="//city[@country='Austria']"/> + +<xsl:template match="/"> + <out> + Test has-same-node() between two intersecting sets: + <xsl:if test="set:has-same-node($a1,$a2)">OK</xsl:if>; + Test has-same-node() between two non-intersecting sets: + <xsl:if test="not(set:has-same-node($a1,//city/@name))">OK</xsl:if>; + Test has-same-node() between two identical sets of namespace nodes: + <xsl:if test="set:has-same-node((//city[1])/namespace::*,(//city[1])/namespace::*)">OK</xsl:if>; + Test has-same-node() between two disjoint sets of namespace nodes: + <xsl:if test="not(set:has-same-node((//city[1])/namespace::*,(//city[2])/namespace::*))">OK</xsl:if>; + </out> +</xsl:template> + +</xsl:stylesheet> diff --git a/libxslt/tests/exslt/sets/leading.1.out b/libxslt/tests/exslt/sets/leading.1.out new file mode 100644 index 0000000..bc81b5e --- /dev/null +++ b/libxslt/tests/exslt/sets/leading.1.out @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<out>; + 6; + 1; + 3; + 0; + 8; + 0; + 0; + </out> diff --git a/libxslt/tests/exslt/sets/leading.1.xml b/libxslt/tests/exslt/sets/leading.1.xml new file mode 100644 index 0000000..175dd0a --- /dev/null +++ b/libxslt/tests/exslt/sets/leading.1.xml @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<doc> +<a/><b/><c/><d/><e/><f/><g/><h/> +</doc> + diff --git a/libxslt/tests/exslt/sets/leading.1.xsl b/libxslt/tests/exslt/sets/leading.1.xsl new file mode 100644 index 0000000..1d8d8bc --- /dev/null +++ b/libxslt/tests/exslt/sets/leading.1.xsl @@ -0,0 +1,22 @@ +<?xml version="1.0"?> + +<!-- TEST use of set:leading --> + + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" +xmlns:set="http://exslt.org/sets" exclude-result-prefixes="set" +> + + <xsl:template match="doc"> + <out>; + <xsl:value-of select="count(set:leading(*, g))"/>; + <xsl:value-of select="count(set:leading(*, b))"/>; + <xsl:value-of select="count(set:leading(*, d|f|h))"/>; + <xsl:value-of select="count(set:leading(*, a|f|h))"/>; + <xsl:value-of select="count(set:leading(*, x))"/>; + <xsl:value-of select="count(set:leading(x, *))"/>; + <xsl:value-of select="count(set:leading(a|b|c, h))"/>; + </out> + </xsl:template> + +</xsl:stylesheet> diff --git a/libxslt/tests/exslt/sets/trailing.1.out b/libxslt/tests/exslt/sets/trailing.1.out new file mode 100644 index 0000000..d906b0a --- /dev/null +++ b/libxslt/tests/exslt/sets/trailing.1.out @@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<out>; + 4; + 6; + 7; + 8; + 0; + 0; + </out> diff --git a/libxslt/tests/exslt/sets/trailing.1.xml b/libxslt/tests/exslt/sets/trailing.1.xml new file mode 100644 index 0000000..175dd0a --- /dev/null +++ b/libxslt/tests/exslt/sets/trailing.1.xml @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<doc> +<a/><b/><c/><d/><e/><f/><g/><h/> +</doc> + diff --git a/libxslt/tests/exslt/sets/trailing.1.xsl b/libxslt/tests/exslt/sets/trailing.1.xsl new file mode 100644 index 0000000..b705c8e --- /dev/null +++ b/libxslt/tests/exslt/sets/trailing.1.xsl @@ -0,0 +1,21 @@ +<?xml version="1.0"?> + +<!-- TEST use of set:trailing --> + + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" +xmlns:set="http://exslt.org/sets" exclude-result-prefixes="set" +> + + <xsl:template match="doc"> + <out>; + <xsl:value-of select="count(set:trailing(*, d))"/>; + <xsl:value-of select="count(set:trailing(*, b|d|f))"/>; + <xsl:value-of select="count(set:trailing(*, a|f|h))"/>; + <xsl:value-of select="count(set:trailing(*, x))"/>; + <xsl:value-of select="count(set:trailing(x, *))"/>; + <xsl:value-of select="count(set:trailing(d|e|f, a|e))"/>; + </out> + </xsl:template> + +</xsl:stylesheet> |