]> granicus.if.org Git - postgis/commitdiff
missing the st_geomfromtext among others because of bad conditions - switched to...
authorRegina Obe <lr@pcorp.us>
Mon, 15 Dec 2008 14:50:12 +0000 (14:50 +0000)
committerRegina Obe <lr@pcorp.us>
Mon, 15 Dec 2008 14:50:12 +0000 (14:50 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@3411 b70326c6-7e19-0410-871a-916f4a2858ee

doc/xsl/postgis_gardentest.sql.xsl

index d7eef010c4a96116ffe804ab993277285fb6408d..18a5315038d105e6fb919fafa3b88295a72aebbb 100644 (file)
@@ -9,8 +9,8 @@
                        using a garden variety of geometries.  Its intent is to flag major crashes.\r
      ******************************************************************** -->\r
        <xsl:output method="text" />\r
-       <!--Exclude this from testing - it crashes with geometry collection -->\r
-       <xsl:variable name='fnexclude'>ST_CurveToLine</xsl:variable>\r
+       <!--Exclude this from testing - it crashes or already tested in special section -->\r
+       <xsl:variable name='fnexclude'>ST_CurveToLine AddGeometryColumn DropGeometryColumn DropGeometryTable</xsl:variable>\r
        <xsl:variable name='var_srid'>4269</xsl:variable>\r
        <xsl:variable name='var_integer'>5</xsl:variable>\r
        <xsl:variable name='var_float1'>0.5</xsl:variable>\r
@@ -91,6 +91,8 @@ BEGIN;
        SELECT the_geom, ST_Multi(the_geom)\r
        FROM (<xsl:value-of select="." />) As foo;\r
        \r
+       SELECT UpdateGeometrySRID('pgis_garden', 'the_geom', 4269);\r
+       \r
        SELECT DropGeometryColumn ('pgis_garden','the_geom');\r
        SELECT DropGeometryTable ('pgis_garden');\r
 COMMIT;\r
@@ -105,94 +107,95 @@ SELECT 'create,insert,drop Test: Start Testing Multi/<xsl:value-of select="@Geom
 \r
                        <xsl:for-each select="refsynopsisdiv/funcsynopsis/funcprototype">\r
 <!--Create dummy paramaters to be used later -->\r
-                       <xsl:variable name='fnfakeparams'><xsl:call-template name="replaceparams"><xsl:with-param name="func" select="." /></xsl:call-template></xsl:variable>\r
-<!-- For each function prototype generate a test sql statement\r
-       Test functions that take no arguments  -->\r
-<xsl:if test="count(paramdef/parameter) = 0">SELECT  'Starting <xsl:value-of select="funcdef/function" />()';BEGIN; \r
+                               <xsl:variable name='fnfakeparams'><xsl:call-template name="replaceparams"><xsl:with-param name="func" select="." /></xsl:call-template></xsl:variable>\r
+                               <xsl:variable name='fnargs'><xsl:call-template name="listparams"><xsl:with-param name="func" select="." /></xsl:call-template></xsl:variable>\r
+<!-- For each function prototype generate a test sql statement -->\r
+<xsl:choose>\r
+<!--Test functions that take no arguments -->\r
+       <xsl:when test="count(paramdef/parameter) = 0">SELECT  'Starting <xsl:value-of select="funcdef/function" />()';BEGIN; \r
 SELECT  <xsl:value-of select="funcdef/function" />();\r
 COMMIT;\r
 SELECT  'Ending <xsl:value-of select="funcdef/function" />()';\r
-</xsl:if>\r
+       </xsl:when>\r
 <!--Start Test aggregate and unary functions -->\r
 <!--Garden Aggregator/Unary function with input gsets test -->\r
-<xsl:if test="(contains(paramdef/type,'geometry set') or (count(paramdef/parameter) = 1 and (contains(paramdef/type, 'geometry') or contains(paramdef/type, 'box')))) and not(contains($fnexclude,funcdef/function))" >\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
-       <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:choose>\r
-                 <xsl:when test="contains($fndef, 'geometry ')">\r
-SELECT ST_AsEWKT(<xsl:value-of select="$fnname" />(the_geom)),\r
-       ST_AsEWKT(<xsl:value-of select="$fnname" />(ST_Multi(the_geom)))\r
-                 </xsl:when>\r
-                 <xsl:otherwise>\r
-SELECT <xsl:value-of select="$fnname" />(the_geom),\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
-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
-       \r
-       </xsl:text>\r
-       </xsl:for-each>\r
-</xsl:if>\r
+       <xsl:when test="(contains(paramdef/type,'geometry set') or (count(paramdef/parameter) = 1 and (contains(paramdef/type, 'geometry') or contains(paramdef/type, 'box')))) and not(contains($fnexclude,funcdef/function))" >\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
+               <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:choose>\r
+                         <xsl:when test="contains($fndef, 'geometry ')">\r
+       SELECT ST_AsEWKT(<xsl:value-of select="$fnname" />(the_geom)),\r
+               ST_AsEWKT(<xsl:value-of select="$fnname" />(ST_Multi(the_geom)))\r
+                         </xsl:when>\r
+                         <xsl:otherwise>\r
+       SELECT <xsl:value-of select="$fnname" />(the_geom),\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
+       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
+               \r
+               </xsl:text>\r
+               </xsl:for-each>\r
+       </xsl:when>\r
 \r
 <!--Garden Relationship and 2 geom input function tests  -->\r
-<xsl:if test="(count(paramdef/parameter) = 2 and (paramdef[1]/type = 'geometry' or paramdef[1]/type = 'geometry ')  and (paramdef[2]/type = 'geometry' or paramdef[2]/type = 'geometry '))">\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
-       <xsl:for-each select="document('')//pgis:gardens/pgis:gset">\r
+       <xsl:when test="(count(paramdef/parameter) = 2 and (paramdef[1]/type = 'geometry' or paramdef[1]/type = 'geometry ')  and (paramdef[2]/type = 'geometry' or paramdef[2]/type = 'geometry '))">\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
+               <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:choose>\r
-                 <xsl:when test="contains($fndef, 'geometry ')">\r
+                       <xsl:choose>\r
+                         <xsl:when test="contains($fndef, 'geometry ')">\r
 SELECT ST_AsEWKT(<xsl:value-of select="$fnname" />(foo1.the_geom, foo2.the_geom)),\r
        ST_AsEWKT(<xsl:value-of select="$fnname" />(ST_Multi(foo1.the_geom), ST_Multi(foo2.the_geom)))\r
-                 </xsl:when>\r
-                 <xsl:otherwise>\r
+                         </xsl:when>\r
+                         <xsl:otherwise>\r
 SELECT <xsl:value-of select="$fnname" />(foo1.the_geom, foo2.the_geom),\r
-                       <xsl:value-of select="$fnname" />(ST_Multi(foo1.the_geom), ST_Multi(foo2.the_geom))\r
-                 </xsl:otherwise>\r
-               </xsl:choose>\r
-               FROM (<xsl:value-of select="." />) As foo1 CROSS JOIN (<xsl:value-of select="." />) As foo2\r
-               LIMIT 5;  \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
-       \r
-       </xsl:text>\r
-       </xsl:for-each>\r
-</xsl:if>\r
-\r
-<!--Garden Relationship more than 1 args first geom -->\r
-<xsl:if test="(count(paramdef/parameter) &gt; 1 and not(contains($fnexclude,funcdef/function)) and not(contains(paramdef[1]/type,'text')) and not(paramdef[2]/type = 'geometry' or paramdef[2]/type = 'geometry '))">\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
-       <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
+                               <xsl:value-of select="$fnname" />(ST_Multi(foo1.the_geom), ST_Multi(foo2.the_geom))\r
+                         </xsl:otherwise>\r
+                       </xsl:choose>\r
                FROM (<xsl:value-of select="." />) As foo1 CROSS JOIN (<xsl:value-of select="." />) As foo2\r
                LIMIT 5;  \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
-       \r
-       </xsl:text>\r
-       </xsl:for-each>\r
-</xsl:if>\r
-\r
+               <xsl:text>\r
+               \r
+               </xsl:text>\r
+               </xsl:for-each>\r
+       </xsl:when>\r
 \r
+<!--Functions more than 1 args not already covered -->\r
+       <xsl:when test="not(contains($fnexclude,funcdef/function))">\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
+               <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
+       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 CROSS JOIN (<xsl:value-of select="." />) As foo2\r
+                       LIMIT 5;  \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
+               <xsl:text>\r
+               \r
+               </xsl:text>\r
+               </xsl:for-each>\r
+       </xsl:when>\r
+</xsl:choose>\r
                        </xsl:for-each>\r
                </xsl:for-each>\r
        </xsl:template>\r
@@ -250,4 +253,20 @@ SELECT '<xsl:value-of select="$fnname" /><xsl:text> </xsl:text> <xsl:value-of se
                        </xsl:for-each>\r
                </xsl:for-each> \r
        </xsl:template>\r
+       \r
+       <!--macro to pull out function parameter names so we can provide a pretty arg list prefix for each function -->\r
+       <xsl:template name="listparams">\r
+               <xsl:param name="func" />\r
+               <xsl:for-each select="$func">\r
+                       <xsl:if test="count(paramdef/parameter) &gt; 0"> </xsl:if>\r
+                       <xsl:for-each select="paramdef">\r
+                               <xsl:choose>\r
+                                       <xsl:when test="count(parameter) &gt; 0"> \r
+                                               <xsl:value-of select="parameter" />\r
+                                       </xsl:when>\r
+                               </xsl:choose>\r
+                               <xsl:if test="position()&lt;last()"><xsl:text>, </xsl:text></xsl:if>\r
+                       </xsl:for-each>\r
+               </xsl:for-each> \r
+       </xsl:template>\r
 </xsl:stylesheet>\r