]> granicus.if.org Git - postgis/commitdiff
Fix #2314. Add a unit test for postgis_sfcgal_version
authorOlivier Courtin <olivier.courtin@camptocamp.com>
Fri, 10 May 2013 10:47:19 +0000 (10:47 +0000)
committerOlivier Courtin <olivier.courtin@camptocamp.com>
Fri, 10 May 2013 10:47:19 +0000 (10:47 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11401 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_backend_api.c
postgis/lwgeom_sfcgal.c
postgis/postgis.sql.in
regress/regress_sfcgal.sql
regress/regress_sfcgal_expected

index fc2c5a3fd302b80855ffc0547caaa2c8be2483ef..3f9c0934ee0cf47a4beb3b257d451daa292ca5f8 100644 (file)
@@ -34,7 +34,6 @@ Datum distance(PG_FUNCTION_ARGS);
 Datum distance3d(PG_FUNCTION_ARGS);
 
 Datum intersects3d_dwithin(PG_FUNCTION_ARGS);
-Datum postgis_sfcgal_version(PG_FUNCTION_ARGS);
 
 
 struct lwgeom_backend_definition
@@ -176,16 +175,3 @@ Datum intersects3d_dwithin(PG_FUNCTION_ARGS)
       functions should be MAXFLOAT which causes false as answer*/
     PG_RETURN_BOOL(0.0 == mindist);
 }
-
-
-PG_FUNCTION_INFO_V1(postgis_sfcgal_version);
-Datum postgis_sfcgal_version(PG_FUNCTION_ARGS)
-{
-#if HAVE_SFCGAL
-        const char *ver = lwgeom_sfcgal_version();
-        text *result = cstring2text(ver);
-#else 
-       text *result = NULL;
-#endif
-        PG_RETURN_POINTER(result);
-}
index 38e86e05fdc6d942b88048d3e39f69d907c5d871..a1f1a6ec24538a38f1a9421e38755fac11ca9804 100644 (file)
 #include "fmgr.h"
 #include "../liblwgeom/liblwgeom.h"
 
+#include "lwgeom_pg.h"
 #include "lwgeom_sfcgal.h"
 
 
+Datum postgis_sfcgal_version(PG_FUNCTION_ARGS);
 
 Datum sfcgal_from_ewkt(PG_FUNCTION_ARGS);
 Datum sfcgal_distance(PG_FUNCTION_ARGS);
@@ -529,3 +531,12 @@ Datum sfcgal_extrude(PG_FUNCTION_ARGS)
     
     PG_RETURN_POINTER(output);
 }
+
+PG_FUNCTION_INFO_V1(postgis_sfcgal_version);
+Datum postgis_sfcgal_version(PG_FUNCTION_ARGS)
+{
+        const char *ver = lwgeom_sfcgal_version();
+        text *result = cstring2text(ver);
+        PG_RETURN_POINTER(result);
+}
+
index f2f6626229b7ea4b9aed6ef77d13b922257feee4..7a0ed1ac3aba3c35890b01d60b5402d5b029e109 100644 (file)
@@ -2443,10 +2443,6 @@ CREATE OR REPLACE FUNCTION postgis_geos_version() RETURNS text
        AS 'MODULE_PATHNAME'
        LANGUAGE 'c' IMMUTABLE;
 
-CREATE OR REPLACE FUNCTION postgis_sfcgal_version() RETURNS text
-       AS 'MODULE_PATHNAME'
-       LANGUAGE 'c' IMMUTABLE;
-
 CREATE OR REPLACE FUNCTION postgis_svn_version() RETURNS text
        AS 'MODULE_PATHNAME'
        LANGUAGE 'c' IMMUTABLE;
index efda63b4052e120254e31093b475961b14c5824b..6f00f67e3d6de20d4b09bdf32410f38e1475ced6 100644 (file)
@@ -5,6 +5,7 @@
 -- We only care about testing PostGIS prototype here
 -- Behaviour is already handled by SFCGAL own tests
 
+SELECT 'postgis_sfcgal_version', count(*) FROM (SELECT postgis_sfcgal_version()) AS f;
 SELECT 'ST_Tesselate', ST_AsText(ST_Tesselate('GEOMETRYCOLLECTION(POINT(4 4),POLYGON((0 0,1 0,1 1,0 1,0 0)))'));
 SELECT 'ST_3DArea', ST_3DArea('POLYGON((0 0 0,1 0 0,1 1 0,0 1 0,0 0 0))');
 SELECT 'ST_Extrude_point', ST_AsText(ST_Extrude('POINT(0 0)', 1, 0, 0));
index 43bd333f3dc1f96d6e8d5c88c7c5aa8c685e0a2e..10ca3628706bb2d0ad3f333f30dfba40c549329d 100644 (file)
@@ -1,3 +1,4 @@
+postgis_sfcgal_version|1
 ST_Tesselate|GEOMETRYCOLLECTION(POINT(4 4),TIN(((0 1,1 0,1 1,0 1)),((0 1,0 0,1 0,0 1))))
 ST_3DArea|1
 ST_Extrude_point|LINESTRING Z (0 0 0,1 0 0)