From: Olivier Courtin Date: Fri, 10 May 2013 10:47:19 +0000 (+0000) Subject: Fix #2314. Add a unit test for postgis_sfcgal_version X-Git-Tag: 2.1.0beta2~27 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e55493800406eceff01e1fed8324e56d152b37b8;p=postgis Fix #2314. Add a unit test for postgis_sfcgal_version git-svn-id: http://svn.osgeo.org/postgis/trunk@11401 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/lwgeom_backend_api.c b/postgis/lwgeom_backend_api.c index fc2c5a3fd..3f9c0934e 100644 --- a/postgis/lwgeom_backend_api.c +++ b/postgis/lwgeom_backend_api.c @@ -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); -} diff --git a/postgis/lwgeom_sfcgal.c b/postgis/lwgeom_sfcgal.c index 38e86e05f..a1f1a6ec2 100644 --- a/postgis/lwgeom_sfcgal.c +++ b/postgis/lwgeom_sfcgal.c @@ -16,9 +16,11 @@ #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); +} + diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in index f2f662622..7a0ed1ac3 100644 --- a/postgis/postgis.sql.in +++ b/postgis/postgis.sql.in @@ -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; diff --git a/regress/regress_sfcgal.sql b/regress/regress_sfcgal.sql index efda63b40..6f00f67e3 100644 --- a/regress/regress_sfcgal.sql +++ b/regress/regress_sfcgal.sql @@ -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)); diff --git a/regress/regress_sfcgal_expected b/regress/regress_sfcgal_expected index 43bd333f3..10ca36287 100644 --- a/regress/regress_sfcgal_expected +++ b/regress/regress_sfcgal_expected @@ -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)