Add some/every tests
authorMichael Kay <mike@saxonica.com>
Wed, 01 Apr 2015 00:00:29 +0100
changeset 908 dd37183a5072
parent 891 b0d6c9226dcc
child 909 4afed90fb846
Add some/every tests
catalog.xml
tests/strm/sx-QuantifiedExpr/_sx-QuantifiedExpr-test-set.xml
tests/strm/sx-QuantifiedExpr/sx-every-A.xsl
tests/strm/sx-QuantifiedExpr/sx-some-A.xsl
--- a/catalog.xml	Mon Mar 30 12:49:51 2015 +0100
+++ b/catalog.xml	Wed Apr 01 00:00:29 2015 +0100
@@ -249,6 +249,7 @@
       <test-set name="sx-IntersectExpr" file="tests/strm/sx-IntersectExpr/_sx-IntersectExpr-test-set.xml"/>
       <test-set name="sx-InstanceofExpr" file="tests/strm/sx-InstanceofExpr/_sx-InstanceofExpr-test-set.xml"/>
       <test-set name="sx-MapExpr" file="tests/strm/sx-MapExpr/_sx-MapExpr-test-set.xml"/>
+      <test-set name="sx-QuantifiedExpr" file="tests/strm/sx-QuantifiedExpr/_sx-QuantifiedExpr-test-set.xml"/>
       <test-set name="sx-TreatExpr" file="tests/strm/sx-TreatExpr/_sx-TreatExpr-test-set.xml"/>
       <test-set name="sx-UnionExpr" file="tests/strm/sx-UnionExpr/_sx-UnionExpr-test-set.xml"/>
       
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/strm/sx-QuantifiedExpr/_sx-QuantifiedExpr-test-set.xml	Wed Apr 01 00:00:29 2015 +0100
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<test-set xmlns="http://www.w3.org/2012/10/xslt-test-catalog"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" name="sx-QuantifiedExpr">
+  <description>Some/Every expressions with streaming</description>
+
+  <environment name="sx-some-A">
+    <stylesheet file="sx-some-A.xsl"/>
+  </environment>
+
+  <environment name="sx-every-A">
+    <stylesheet file="sx-every-A.xsl"/>
+  </environment>
+
+  <dependencies>
+    <spec value="XSLT30+"/>
+    <feature value="streaming"/>
+  </dependencies>
+
+  <test-case name="sx-some-001">
+    <description>Streaming "some" expression - "in" expression is grounded and
+      consuming</description>
+    <created by="Michael Kay" on="2015-03-27"/>
+    <environment ref="sx-some-A"/>
+    <test>
+      <initial-template name="r-001"/>
+    </test>
+    <result>
+      <assert>/out = 'true'</assert>
+    </result>
+  </test-case>
+
+  <test-case name="sx-some-002">
+    <description>Streaming "some" expression - "in" expression is grounded and
+      consuming</description>
+    <created by="Michael Kay" on="2015-03-27"/>
+    <environment ref="sx-some-A"/>
+    <test>
+      <initial-template name="r-002"/>
+    </test>
+    <result>
+      <assert>/out = 'true'</assert>
+    </result>
+  </test-case>
+
+  <test-case name="sx-some-003">
+    <description>Streaming "some" expression - "in" expression is grounded and
+      consuming</description>
+    <created by="Michael Kay" on="2015-03-27"/>
+    <environment ref="sx-some-A"/>
+    <test>
+      <initial-template name="r-003"/>
+    </test>
+    <result>
+      <assert>/out = 'true'</assert>
+    </result>
+  </test-case>
+
+  <test-case name="sx-some-004">
+    <description>Streaming "some" expression - "in" expression is grounded and
+      consuming</description>
+    <created by="Michael Kay" on="2015-03-27"/>
+    <environment ref="sx-some-A"/>
+    <test>
+      <initial-template name="r-004"/>
+    </test>
+    <result>
+      <assert>/out = 'true'</assert>
+    </result>
+  </test-case>
+
+  <test-case name="sx-some-005">
+    <description>Streaming "some" expression - "in" expression is grounded and
+      consuming</description>
+    <created by="Michael Kay" on="2015-03-27"/>
+    <environment ref="sx-some-A"/>
+    <test>
+      <initial-template name="r-005"/>
+    </test>
+    <result>
+      <assert>/out = 'true'</assert>
+    </result>
+  </test-case>
+
+  <test-case name="sx-every-001">
+    <description>Streaming "every" expression - "in" expression is grounded and
+      consuming</description>
+    <created by="Michael Kay" on="2015-03-27"/>
+    <environment ref="sx-every-A"/>
+    <test>
+      <initial-template name="r-001"/>
+    </test>
+    <result>
+      <assert>/out = 'true'</assert>
+    </result>
+  </test-case>
+
+  <test-case name="sx-every-002">
+    <description>Streaming "every" expression - "in" expression is grounded and
+      consuming</description>
+    <created by="Michael Kay" on="2015-03-27"/>
+    <environment ref="sx-every-A"/>
+    <test>
+      <initial-template name="r-002"/>
+    </test>
+    <result>
+      <assert>/out = 'true'</assert>
+    </result>
+  </test-case>
+
+  <test-case name="sx-every-003">
+    <description>Streaming "every" expression - "in" expression is grounded and
+      consuming</description>
+    <created by="Michael Kay" on="2015-03-27"/>
+    <environment ref="sx-every-A"/>
+    <test>
+      <initial-template name="r-003"/>
+    </test>
+    <result>
+      <assert>/out = 'true'</assert>
+    </result>
+  </test-case>
+
+  <test-case name="sx-every-004">
+    <description>Streaming "every" expression - "in" expression is grounded and
+      consuming</description>
+    <created by="Michael Kay" on="2015-03-27"/>
+    <environment ref="sx-every-A"/>
+    <test>
+      <initial-template name="r-004"/>
+    </test>
+    <result>
+      <assert>/out = 'true'</assert>
+    </result>
+  </test-case>
+
+  <test-case name="sx-every-005">
+    <description>Streaming "every" expression - "in" expression is grounded and
+      consuming</description>
+    <created by="Michael Kay" on="2015-03-27"/>
+    <environment ref="sx-every-A"/>
+    <test>
+      <initial-template name="r-005"/>
+    </test>
+    <result>
+      <assert>/out = 'true'</assert>
+    </result>
+  </test-case>
+
+
+
+
+</test-set>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/strm/sx-QuantifiedExpr/sx-every-A.xsl	Wed Apr 01 00:00:29 2015 +0100
@@ -0,0 +1,61 @@
+<xsl:stylesheet version="3.0" 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:map="http://www.w3.org/2005/xpath-functions/map"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  exclude-result-prefixes="map xs">
+  
+  <xsl:variable name="RUN" select="true()" static="yes"/>
+  <xsl:strip-space elements="*"/>
+  
+  <!-- "Every" expression with consuming and grounded "in" operand.
+        Use two references to the range variable to avoid inlining. -->
+  
+  <xsl:template name="r-001" use-when="$RUN">
+    <xsl:stream href="../docs/books.xml">
+      <out>
+        <xsl:value-of select="every $x in /BOOKLIST/BOOKS/ITEM/DIMENSIONS/string() 
+          satisfies sum(tokenize($x, ' ')!xs:decimal(.)) + string-length($x) gt 10"/>
+      </out>
+    </xsl:stream>
+  </xsl:template>
+  
+  <xsl:template name="r-002" use-when="$RUN">
+    <xsl:stream href="../docs/books.xml">
+      <out>
+        <xsl:value-of select="every $x in /BOOKLIST/BOOKS/ITEM/DIMENSIONS/data() 
+          satisfies sum(tokenize($x, ' ')!xs:decimal(.)) + string-length($x) gt 10"/>
+      </out>
+    </xsl:stream>
+  </xsl:template>
+  
+  <xsl:template name="r-003" use-when="$RUN">
+    <xsl:stream href="../docs/books.xml">
+      <out>
+        <xsl:value-of select="every $x in /BOOKLIST/BOOKS/ITEM/DIMENSIONS/copy-of() 
+          satisfies sum(tokenize($x, ' ')!xs:decimal(.)) + string-length($x) gt 10"/>
+      </out>
+    </xsl:stream>
+  </xsl:template>
+  
+  <xsl:template name="r-004" use-when="$RUN">
+    <xsl:stream href="../docs/books.xml">
+      <out>
+        <xsl:value-of select="
+          every $x in /BOOKLIST/BOOKS/ITEM/DIMENSIONS/snapshot() 
+          satisfies sum(tokenize($x, ' ')!number()) + count($x/ancestor::node()) gt 10"/>
+      </out>
+    </xsl:stream>
+  </xsl:template>
+  
+  <xsl:template name="r-005" use-when="$RUN">
+    <xsl:stream href="../docs/books.xml">
+      <out>
+        <xsl:value-of select="
+          every $x in /BOOKLIST/BOOKS/ITEM/DIMENSIONS/ancestor-or-self::*/@*/node-name() 
+          satisfies ('Q{'||namespace-uri-from-QName($x)||'}'||local-name-from-QName($x))"/>
+      </out>
+    </xsl:stream>
+  </xsl:template>
+  
+  
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/strm/sx-QuantifiedExpr/sx-some-A.xsl	Wed Apr 01 00:00:29 2015 +0100
@@ -0,0 +1,61 @@
+<xsl:stylesheet version="3.0" 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:map="http://www.w3.org/2005/xpath-functions/map"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="map xs">
+    
+    <xsl:variable name="RUN" select="true()" static="yes"/>
+    <xsl:strip-space elements="*"/>
+
+    <!-- "Some" expression with consuming and grounded "in" operand.
+        Use two references to the range variable to avoid inlining. -->
+    
+    <xsl:template name="r-001" use-when="$RUN">
+      <xsl:stream href="../docs/books.xml">
+        <out>
+          <xsl:value-of select="some $x in /BOOKLIST/BOOKS/ITEM/DIMENSIONS/string() 
+                                satisfies sum(tokenize($x, ' ')!xs:decimal(.)) + string-length($x) gt 10"/>
+        </out>
+      </xsl:stream>
+    </xsl:template>
+    
+    <xsl:template name="r-002" use-when="$RUN">
+      <xsl:stream href="../docs/books.xml">
+        <out>
+          <xsl:value-of select="some $x in /BOOKLIST/BOOKS/ITEM/DIMENSIONS/data() 
+                                satisfies sum(tokenize($x, ' ')!xs:decimal(.)) + string-length($x) gt 10"/>
+        </out>
+      </xsl:stream>
+    </xsl:template>
+    
+    <xsl:template name="r-003" use-when="$RUN">
+      <xsl:stream href="../docs/books.xml">
+        <out>
+          <xsl:value-of select="some $x in /BOOKLIST/BOOKS/ITEM/DIMENSIONS/copy-of() 
+                                satisfies sum(tokenize($x, ' ')!xs:decimal(.)) + string-length($x) gt 10"/>
+        </out>
+      </xsl:stream>
+    </xsl:template>
+    
+    <xsl:template name="r-004" use-when="$RUN">
+      <xsl:stream href="../docs/books.xml">
+        <out>
+          <xsl:value-of select="
+            some $x in /BOOKLIST/BOOKS/ITEM/DIMENSIONS/snapshot() 
+            satisfies sum(tokenize($x, ' ')!number()) + count($x/ancestor::node()) gt 10"/>
+        </out>
+      </xsl:stream>
+    </xsl:template>
+    
+    <xsl:template name="r-005" use-when="$RUN">
+      <xsl:stream href="../docs/books.xml">
+        <out>
+          <xsl:value-of select="
+            some $x in /BOOKLIST/BOOKS/ITEM/DIMENSIONS/ancestor-or-self::*/@*/node-name() 
+            satisfies ('Q{'||namespace-uri-from-QName($x)||'}'||local-name-from-QName($x))"/>
+        </out>
+      </xsl:stream>
+    </xsl:template>
+         
+    
+</xsl:stylesheet>
\ No newline at end of file