<xsl:variable name='fnargs'><xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template></xsl:variable>\r
<xsl:variable name='fnname'><xsl:value-of select="funcdef/function"/></xsl:variable>\r
<xsl:variable name='fndef'><xsl:value-of select="funcdef"/></xsl:variable>\r
-<!-- For each function prototype generate a test sql statement -->\r
-<xsl:choose>\r
+ <xsl:variable name='numparams'><xsl:value-of select="count(paramdef/parameter)" /></xsl:variable>\r
+ <xsl:variable name='numparamgeoms'><xsl:value-of select="count(paramdef/type[contains(text(),'geometry') or contains(text(),'box') or contains(text(), 'WKT') or contains(text(), 'bytea')])" /></xsl:variable>\r
+ <!-- For each function prototype generate a test sql statement -->\r
+ <xsl:choose>\r
<!--Test functions that take no arguments or take no geometries -->\r
- <xsl:when test="(count(paramdef/parameter) = 0 or not(contains(paramdef[1]/type,'geometry') or contains(paramdef[2]/type,'geometry') or contains(paramdef[1]/parameter,'WKT') or contains(paramdef[1]/type,'box') or contains(paramdef[1]/type,'bytea'))) and not(contains($fnexclude,funcdef/function))">SELECT 'Starting <xsl:value-of select="funcdef/function" />(<xsl:value-of select="$fnargs" />)';BEGIN; \r
+ <xsl:when test="$numparamgeoms = '0'">SELECT 'Starting <xsl:value-of select="funcdef/function" />(<xsl:value-of select="$fnargs" />)';BEGIN; \r
SELECT <xsl:value-of select="funcdef/function" />(<xsl:value-of select="$fnfakeparams" />);\r
COMMIT;\r
SELECT 'Ending <xsl:value-of select="funcdef/function" />(<xsl:value-of select="$fnargs" />)';\r
</xsl:when>\r
<!--Start Test aggregate and unary functions -->\r
<!--Garden Aggregator/Unary function with input gsets test -->\r
- <xsl:when test="(contains(paramdef[1]/type,'geometry set') or (count(paramdef/parameter) = 1 and contains(paramdef[1]/type, 'geometry')) and not(contains($fnexclude,@id)))" >\r
+ <xsl:when test="$numparams = '1' and $numparamgeoms = '1' and not(contains($fnexclude,funcdef/function))" >\r
<xsl:for-each select="document('')//pgis:gardens/pgis:gset">\r
SELECT '<xsl:value-of select="$fnname" /><xsl:text> </xsl:text><xsl:value-of select="@ID" />: Start Testing Multi/<xsl:value-of select="@GeometryType" />'; \r
BEGIN; <!-- If output is geometry show ewkt rep -->\r
<xsl:value-of select="$fnname" />(ST_Multi(the_geom))\r
</xsl:otherwise>\r
</xsl:choose>\r
- FROM (<xsl:value-of select="." />) As foo; \r
+ FROM (<xsl:value-of select="." />) As foo1; \r
COMMIT;\r
SELECT '<xsl:value-of select="$fnname" /><xsl:text> </xsl:text> <xsl:value-of select="@ID" />: End Testing Multi/<xsl:value-of select="@GeometryType" />';\r
<xsl:text>\r
</xsl:text>\r
</xsl:for-each>\r
</xsl:when>\r
+ <!-- put functions that take only one geometry no need to cross with another geom collection -->\r
+ <xsl:when test="$numparamgeoms = '1' and not(contains($fnexclude,funcdef/function))" >\r
+ <xsl:for-each select="document('')//pgis:gardens/pgis:gset">\r
+ SELECT '<xsl:value-of select="$fnname" /><xsl:text> </xsl:text><xsl:value-of select="@ID" />: Start Testing <xsl:value-of select="@GeometryType" />'; \r
+ BEGIN; <!-- If output is geometry show ewkt rep -->\r
+ <xsl:choose>\r
+ <xsl:when test="contains($fndef, 'geometry ')">\r
+ SELECT ST_AsEWKT(<xsl:value-of select="$fnname" />(<xsl:value-of select="$fnfakeparams" />))\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ SELECT <xsl:value-of select="$fnname" />(<xsl:value-of select="$fnfakeparams" />)\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ FROM (<xsl:value-of select="." />) As foo1; \r
+ COMMIT;\r
+ SELECT '<xsl:value-of select="$fnname" /><xsl:text> </xsl:text> <xsl:value-of select="@ID" />: End Testing <xsl:value-of select="@GeometryType" />';\r
+ <xsl:text>\r
+ \r
+ </xsl:text>\r
+ </xsl:for-each>\r
+ </xsl:when>\r
\r
<!--Functions more than 1 args not already covered this will cross every geometry type with every other -->\r
-<!-- TODO: put functions that take only one geometry into another section - no need to do a cross for these -->\r
<xsl:when test="not(contains($fnexclude,funcdef/function))">\r
<xsl:for-each select="document('')//pgis:gardens/pgis:gset">\r
<!--Store first garden sql geometry from -->\r
<xsl:variable name="from1"><xsl:value-of select="." /></xsl:variable>\r
-SELECT '<xsl:value-of select="$fnname" /><xsl:text> </xsl:text><xsl:value-of select="@ID" />(<xsl:value-of select="$fnargs" />): Start Testing <xsl:value-of select="@GeometryType" /> against other types'; \r
+ <xsl:variable name='geom1type'><xsl:value-of select="@GeometryType"/></xsl:variable>\r
+SELECT '<xsl:value-of select="$fnname" /><xsl:text> </xsl:text><xsl:value-of select="@ID" />(<xsl:value-of select="$fnargs" />): Start Testing <xsl:value-of select="$geom1type" /> against other types'; \r
<xsl:for-each select="document('')//pgis:gardens/pgis:gset">\r
- SELECT '<xsl:value-of select="$fnname" /><xsl:text> </xsl:text><xsl:value-of select="@ID" />(<xsl:value-of select="$fnargs" />): Start Testing <xsl:value-of select="@GeometryType" />'; \r
+ SELECT '<xsl:value-of select="$fnname" /><xsl:text> </xsl:text><xsl:value-of select="@ID" />(<xsl:value-of select="$fnargs" />): Start Testing <xsl:value-of select="$geom1type" />, <xsl:value-of select="@GeometryType" />'; \r
BEGIN; <!-- If output is geometry show ewkt rep -->\r
<xsl:choose>\r
<xsl:when test="contains($fndef, 'geometry ')">\r
FROM (<xsl:value-of select="$from1" />) As foo1 CROSS JOIN (<xsl:value-of select="." />) As foo2\r
LIMIT 3; \r
COMMIT;\r
- SELECT '<xsl:value-of select="$fnname" />(<xsl:value-of select="$fnargs" />) <xsl:text> </xsl:text> <xsl:value-of select="@ID" />: End Testing Multi/<xsl:value-of select="@GeometryType" />';\r
+ SELECT '<xsl:value-of select="$fnname" />(<xsl:value-of select="$fnargs" />) <xsl:text> </xsl:text> <xsl:value-of select="@ID" />: End Testing <xsl:value-of select="$geom1type" />, <xsl:value-of select="@GeometryType" />';\r
<xsl:text>\r
\r
</xsl:text>\r
</xsl:for-each>\r
SELECT '<xsl:value-of select="$fnname" /><xsl:text> </xsl:text><xsl:value-of select="@ID" />(<xsl:value-of select="$fnargs" />): End Testing <xsl:value-of select="@GeometryType" /> against other types';\r
+\r
+<!-- TODO: Put in test for multi geoms -->\r
</xsl:for-each>\r
- </xsl:when>\r
-</xsl:choose>\r
+ </xsl:when>\r
+ </xsl:choose>\r
</xsl:for-each>\r
</xsl:for-each>\r
</xsl:template>\r