[postgis-commits] svn - r3662 - spike/wktraster/rt_pg/test
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Fri Feb 6 04:35:25 PST 2009
Author: strk
Date: 2009-02-06 04:35:20 -0800 (Fri, 06 Feb 2009)
New Revision: 3662
Added:
spike/wktraster/rt_pg/test/Makefile.in
spike/wktraster/rt_pg/test/bbox.sql
spike/wktraster/rt_pg/test/bbox_expected
spike/wktraster/rt_pg/test/io.sql
spike/wktraster/rt_pg/test/io_expected
spike/wktraster/rt_pg/test/run_test.in
Removed:
spike/wktraster/rt_pg/test/Makefile
spike/wktraster/rt_pg/test/bbox.sql.c
spike/wktraster/rt_pg/test/io.sql.c
Modified:
spike/wktraster/rt_pg/test/README
Log:
rework pgsql testing framework modeled after postgis one
Deleted: spike/wktraster/rt_pg/test/Makefile
===================================================================
--- spike/wktraster/rt_pg/test/Makefile 2009-02-06 10:56:30 UTC (rev 3661)
+++ spike/wktraster/rt_pg/test/Makefile 2009-02-06 12:35:20 UTC (rev 3662)
@@ -1,21 +0,0 @@
-# **********************************************************************
-# *
-# * WKTRaster - Raster Types for PostGIS
-# * http://www.postgis.org/support/wiki/index.php?WKTRasterHomePage
-# *
-# * Copyright (c) 2009 Sandro Santilli <strk at keybit.net>
-# *
-# * This is free software; you can redistribute and/or modify it under
-# * the terms of the GNU General Public Licence. See the COPYING file.
-# *
-# **********************************************************************
-
-TESTS=io.sql bbox.sql
-
-all: $(TESTS)
-
-%.sql: %.sql.c
- $(CPP) -P -C -traditional $< > $@
-
-clean:
- rm -f $(TESTS)
Copied: spike/wktraster/rt_pg/test/Makefile.in (from rev 3659, spike/wktraster/rt_pg/test/Makefile)
===================================================================
--- spike/wktraster/rt_pg/test/Makefile 2009-02-06 10:33:06 UTC (rev 3659)
+++ spike/wktraster/rt_pg/test/Makefile.in 2009-02-06 12:35:20 UTC (rev 3662)
@@ -0,0 +1,27 @@
+# **********************************************************************
+# *
+# * WKTRaster - Raster Types for PostGIS
+# * http://www.postgis.org/support/wiki/index.php?WKTRasterHomePage
+# *
+# * Copyright (c) 2009 Sandro Santilli <strk at keybit.net>
+# *
+# * This is free software; you can redistribute and/or modify it under
+# * the terms of the GNU General Public Licence. See the COPYING file.
+# *
+# **********************************************************************
+
+POSTGIS_SRC=@POSTGIS_SRCDIR@
+
+TESTS=io.sql bbox.sql
+
+all: run_test
+
+run_test: run_test.in Makefile
+ sed -e "s#@POSTGIS_SRC@#$(POSTGIS_SRC)#" $< > $@
+ chmod +x $@
+
+check: run_test
+ ./run_test $(TESTS)
+
+clean:
+ rm -f run_test
Property changes on: spike/wktraster/rt_pg/test/Makefile.in
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: spike/wktraster/rt_pg/test/README
===================================================================
--- spike/wktraster/rt_pg/test/README 2009-02-06 10:56:30 UTC (rev 3661)
+++ spike/wktraster/rt_pg/test/README 2009-02-06 12:35:20 UTC (rev 3662)
@@ -1,10 +1,7 @@
-The testsuite isn't automated yet, so you'll need to
-run manually.
+Run 'make check' to run the postgresql-wrappers regression testing.
-1. sudo make install from top-level dir
- (so the shared library is in place)
-2. create your database, enable postgis on it (say: testdb)
-3. enable wktraster on your database (psql -f rt_pg/rtpostgis.sql testdb)
-4. run make in this dir, to create the sql files
-5. source each sql file, how to tell if it failed or succeeds
- depends on the single test (to be improved)
+You must be allowed to create databases and install C-language
+function in it.
+
+You must also have installed the wrappers with 'make install'
+from top-level dir.
Copied: spike/wktraster/rt_pg/test/bbox.sql (from rev 3659, spike/wktraster/rt_pg/test/bbox.sql.c)
===================================================================
--- spike/wktraster/rt_pg/test/bbox.sql.c 2009-02-06 10:33:06 UTC (rev 3659)
+++ spike/wktraster/rt_pg/test/bbox.sql 2009-02-06 12:35:20 UTC (rev 3662)
@@ -0,0 +1,47 @@
+CREATE TABLE rt_test_envelope (
+ id numeric,
+ name text,
+ rast raster,
+ env box2d
+ );
+
+-- 10x20, ip:0.5,0.5 scale:2,3
+INSERT INTO rt_test_envelope
+VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0000' -- nBands (uint16 0)
+||
+'0000000000000040' -- scaleX (float64 2)
+||
+'0000000000000840' -- scaleY (float64 3)
+||
+'000000000000E03F' -- ipX (float64 0.5)
+||
+'000000000000E03F' -- ipY (float64 0.5)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0A00' -- width (uint16 10)
+||
+'1400' -- height (uint16 20)
+)::raster
+,'BOX(-0.5 -1,19.5 59)' -- expected envelope (20x60) == (10*2 x 20*3)
+);
+
+
+SELECT
+ id,
+ env as expected,
+ rast::box2d as obtained
+FROM rt_test_envelope
+WHERE
+ rast::box2d::text != env::text;
+
Deleted: spike/wktraster/rt_pg/test/bbox.sql.c
===================================================================
--- spike/wktraster/rt_pg/test/bbox.sql.c 2009-02-06 10:56:30 UTC (rev 3661)
+++ spike/wktraster/rt_pg/test/bbox.sql.c 2009-02-06 12:35:20 UTC (rev 3662)
@@ -1,49 +0,0 @@
-DROP TABLE rt_test_envelope;
-
-CREATE TABLE rt_test_envelope (
- id serial,
- name text,
- rast raster,
- env box2d
- );
-
--- 10x20, ip:0.5,0.5 scale:2,3
-INSERT INTO rt_test_envelope
-VALUES ( 0, '10x20, ip:0.5,0.5 scale:2,3 skew:0,0',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0000' -- nBands (uint16 0)
-||
-'0000000000000040' -- scaleX (float64 2)
-||
-'0000000000000840' -- scaleY (float64 3)
-||
-'000000000000E03F' -- ipX (float64 0.5)
-||
-'000000000000E03F' -- ipY (float64 0.5)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0A00' -- width (uint16 10)
-||
-'1400' -- height (uint16 20)
-)::raster
-,'BOX(-0.5 -1,19.5 59)' -- expected envelope (20x60) == (10*2 x 20*3)
-);
-
-
-SELECT
- id,
- env as expected,
- rast::box2d as obtained
-FROM rt_test_envelope
-WHERE
- rast::box2d::text != env::text;
-
Added: spike/wktraster/rt_pg/test/bbox_expected
===================================================================
Copied: spike/wktraster/rt_pg/test/io.sql (from rev 3627, spike/wktraster/rt_pg/test/io.sql.c)
===================================================================
--- spike/wktraster/rt_pg/test/io.sql.c 2009-02-03 11:59:32 UTC (rev 3627)
+++ spike/wktraster/rt_pg/test/io.sql 2009-02-06 12:35:20 UTC (rev 3662)
@@ -0,0 +1,868 @@
+CREATE TABLE rt_test (
+ id numeric,
+ name text,
+ hexwkb_ndr text,
+ hexwkb_xdr text,
+ rast raster
+ );
+
+-- 1x1, no bands, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 0, '1x1 no bands, no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0000' -- nBands (uint16 0)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+)
+,
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0000' -- nBands (uint16 0)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+)
+);
+
+-- 1x1, single band of type 1BB, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 1, '1x1 single band (1BB) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'00' -- first band type (1BB)
+||
+'00' -- novalue==0
+||
+'01' -- pixel(0,0)==1
+)
+,
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'00' -- first band type (1BB)
+||
+'00' -- novalue==0
+||
+'01' -- pixel(0,0)==1
+)
+);
+
+-- 1x1, single band of type 2BUI, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 2, '1x1 single band (2BUI) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'01' -- first band type (2BUI)
+||
+'00' -- novalue==0
+||
+'03' -- pixel(0,0)==3
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'01' -- first band type (2BUI)
+||
+'00' -- novalue==0
+||
+'03' -- pixel(0,0)==3
+) );
+
+-- 1x1, single band of type 4BUI, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 3, '1x1 single band (4BUI) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'02' -- first band type (4BUI)
+||
+'00' -- novalue==0
+||
+'0F' -- pixel(0,0)==15
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'02' -- first band type (4BUI)
+||
+'00' -- novalue==0
+||
+'0F' -- pixel(0,0)==15
+) );
+
+-- 1x1, single band of type 8BSI, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 4, '1x1 single band (8BSI) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'03' -- first band type (8BSI)
+||
+'00' -- novalue==0
+||
+'FF' -- pixel(0,0)==-1
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'03' -- first band type (8BSI)
+||
+'00' -- novalue==0
+||
+'FF' -- pixel(0,0)==-1
+) );
+
+-- 1x1, single band of type 8BUI, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 5, '1x1 single band (8BUI) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'04' -- first band type (8BUI)
+||
+'00' -- novalue==0
+||
+'FF' -- pixel(0,0)==255
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'04' -- first band type (8BUI)
+||
+'00' -- novalue==0
+||
+'FF' -- pixel(0,0)==255
+) );
+
+-- 1x1, single band of type 16BSI, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 6, '1x1 single band (16BSI) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'05' -- first band type (16BSI)
+||
+'0000' -- novalue==0
+||
+'FFFF' -- pixel(0,0)==-1
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'05' -- first band type (16BSI)
+||
+'0000' -- novalue==0
+||
+'FFFF' -- pixel(0,0)==-1
+) );
+
+-- 1x1, single band of type 16BUI, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 7, '1x1 single band (16BUI) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'06' -- first band type (16BUI)
+||
+'0000' -- novalue==0
+||
+'FFFF' -- pixel(0,0)==65535
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'06' -- first band type (16BUI)
+||
+'0000' -- novalue==0
+||
+'FFFF' -- pixel(0,0)==65535
+) );
+
+-- 1x1, single band of type 32BSI, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 8, '1x1 single band (32BSI) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'07' -- first band type (32BSI)
+||
+'00000000' -- novalue==0
+||
+'FFFFFFFF' -- pixel(0,0)==-1 ?
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'07' -- first band type (32BSI)
+||
+'00000000' -- novalue==0
+||
+'FFFFFFFF' -- pixel(0,0)==-1 ?
+) );
+
+-- 1x1, single band of type 32BUI, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 9, '1x1 single band (32BUI) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'08' -- first band type (32BUI)
+||
+'00000000' -- novalue==0
+||
+'FFFFFFFF' -- pixel(0,0)=4294967295
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'08' -- first band type (32BUI)
+||
+'00000000' -- novalue==0
+||
+'FFFFFFFF' -- pixel(0,0)=4294967295
+) );
+
+-- 1x1, single band of type 32BF, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 11, '1x1 single band (32BF) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'0A' -- first band type (32BF)
+||
+'00000000' -- novalue==0
+||
+'CDCC8C3F' -- pixel(0,0)=1.1
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'0A' -- first band type (32BF)
+||
+'00000000' -- novalue==0
+||
+'3F8CCCCD' -- pixel(0,0)=1.1
+) );
+
+-- 1x1, single band of type 64BF, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 11, '1x1 single band (64BF) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'0B' -- first band type (64BF)
+||
+'0000000000000000' -- novalue==0
+||
+'AE47E17A14AE1540' -- pixel(0,0)=5.42
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'0B' -- first band type (64BF)
+||
+'0000000000000000' -- novalue==0
+||
+'4015AE147AE147AE' -- pixel(0,0)=5.42
+) );
+
+-- 1x1, single band of type 64BF (external: 3:/tmp/t.tif),
+-- no transform, scale 1:1
+--
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 12, '1x1 single band (64BF external) no transform',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'8B' -- first band type (64BF + ext flag)
+||
+'0000000000000000' -- novalue==0
+||
+'03' -- ext band num == 3
+||
+'2F746D702F742E74696600' -- "/tmp/t.tif"
+),
+(
+'00' -- big endian (uint8 xdr)
+||
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'8B' -- first band type (64BF)
+||
+'0000000000000000' -- novalue==0
+||
+'03' -- ext band num == 3
+||
+'2F746D702F742E74696600' -- "/tmp/t.tif"
+) );
+
+SELECT name,
+ hexwkb_ndr::raster::text = hexwkb_ndr or hexwkb_ndr::raster::text = hexwkb_xdr as ndr_io,
+ hexwkb_xdr::raster::text = hexwkb_ndr or hexwkb_xdr::raster::text = hexwkb_xdr as xdr_io
+FROM rt_test;
Deleted: spike/wktraster/rt_pg/test/io.sql.c
===================================================================
--- spike/wktraster/rt_pg/test/io.sql.c 2009-02-06 10:56:30 UTC (rev 3661)
+++ spike/wktraster/rt_pg/test/io.sql.c 2009-02-06 12:35:20 UTC (rev 3662)
@@ -1,939 +0,0 @@
-DROP TABLE rt_test;
-
-CREATE TABLE rt_test (
- id numeric,
- name text,
- hexwkb_ndr text,
- hexwkb_xdr text,
- rast raster
- );
-
--- 1x1, no bands, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 0, '1x1 no bands, no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0000' -- nBands (uint16 0)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-)
-,
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0000' -- nBands (uint16 0)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-)
-);
-
--- 1x1, single band of type 1BB, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 1, '1x1 single band (1BB) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'00' -- first band type (1BB)
-||
-'00' -- novalue==0
-||
-'01' -- pixel(0,0)==1
-)
-,
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'00' -- first band type (1BB)
-||
-'00' -- novalue==0
-||
-'01' -- pixel(0,0)==1
-)
-);
-
--- 1x1, single band of type 2BUI, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 2, '1x1 single band (2BUI) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'01' -- first band type (2BUI)
-||
-'00' -- novalue==0
-||
-'03' -- pixel(0,0)==3
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'01' -- first band type (2BUI)
-||
-'00' -- novalue==0
-||
-'03' -- pixel(0,0)==3
-) );
-
--- 1x1, single band of type 4BUI, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 3, '1x1 single band (4BUI) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'02' -- first band type (4BUI)
-||
-'00' -- novalue==0
-||
-'0F' -- pixel(0,0)==15
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'02' -- first band type (4BUI)
-||
-'00' -- novalue==0
-||
-'0F' -- pixel(0,0)==15
-) );
-
--- 1x1, single band of type 8BSI, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 4, '1x1 single band (8BSI) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'03' -- first band type (8BSI)
-||
-'00' -- novalue==0
-||
-'FF' -- pixel(0,0)==-1
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'03' -- first band type (8BSI)
-||
-'00' -- novalue==0
-||
-'FF' -- pixel(0,0)==-1
-) );
-
--- 1x1, single band of type 8BUI, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 5, '1x1 single band (8BUI) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'04' -- first band type (8BUI)
-||
-'00' -- novalue==0
-||
-'FF' -- pixel(0,0)==255
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'04' -- first band type (8BUI)
-||
-'00' -- novalue==0
-||
-'FF' -- pixel(0,0)==255
-) );
-
--- 1x1, single band of type 16BSI, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 6, '1x1 single band (16BSI) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'05' -- first band type (16BSI)
-||
-'0000' -- novalue==0
-||
-'FFFF' -- pixel(0,0)==-1
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'05' -- first band type (16BSI)
-||
-'0000' -- novalue==0
-||
-'FFFF' -- pixel(0,0)==-1
-) );
-
--- 1x1, single band of type 16BUI, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 7, '1x1 single band (16BUI) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'06' -- first band type (16BUI)
-||
-'0000' -- novalue==0
-||
-'FFFF' -- pixel(0,0)==65535
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'06' -- first band type (16BUI)
-||
-'0000' -- novalue==0
-||
-'FFFF' -- pixel(0,0)==65535
-) );
-
--- 1x1, single band of type 32BSI, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 8, '1x1 single band (32BSI) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'07' -- first band type (32BSI)
-||
-'00000000' -- novalue==0
-||
-'FFFFFFFF' -- pixel(0,0)==-1 ?
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'07' -- first band type (32BSI)
-||
-'00000000' -- novalue==0
-||
-'FFFFFFFF' -- pixel(0,0)==-1 ?
-) );
-
--- 1x1, single band of type 32BUI, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 9, '1x1 single band (32BUI) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'08' -- first band type (32BUI)
-||
-'00000000' -- novalue==0
-||
-'FFFFFFFF' -- pixel(0,0)=4294967295
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'08' -- first band type (32BUI)
-||
-'00000000' -- novalue==0
-||
-'FFFFFFFF' -- pixel(0,0)=4294967295
-) );
-
-#if 0 /* 16BF pixeltype not supported yet */
--- 1x1, single band of type 16BF, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 10, '1x1 single band (16BF) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'09' -- first band type (16BF)
-||
-'0000' -- novalue==0
-||
-'FFFF' -- pixel(0,0)=?
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'09' -- first band type (16BF)
-||
-'0000' -- novalue==0
-||
-'FFFF' -- pixel(0,0)=?
-) );
-
-#endif /* 16BF pixeltype not supported yet */
-
--- 1x1, single band of type 32BF, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 11, '1x1 single band (32BF) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'0A' -- first band type (32BF)
-||
-'00000000' -- novalue==0
-||
-'CDCC8C3F' -- pixel(0,0)=1.1
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'0A' -- first band type (32BF)
-||
-'00000000' -- novalue==0
-||
-'3F8CCCCD' -- pixel(0,0)=1.1
-) );
-
--- 1x1, single band of type 64BF, no transform, scale 1:1
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 11, '1x1 single band (64BF) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'0B' -- first band type (64BF)
-||
-'0000000000000000' -- novalue==0
-||
-'AE47E17A14AE1540' -- pixel(0,0)=5.42
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'0B' -- first band type (64BF)
-||
-'0000000000000000' -- novalue==0
-||
-'4015AE147AE147AE' -- pixel(0,0)=5.42
-) );
-
--- 1x1, single band of type 64BF (external: 3:/tmp/t.tif),
--- no transform, scale 1:1
---
-INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
-VALUES ( 12, '1x1 single band (64BF external) no transform',
-(
-'01' -- little endian (uint8 ndr)
-||
-'0000' -- version (uint16 0)
-||
-'0100' -- nBands (uint16 1)
-||
-'000000000000F03F' -- scaleX (float64 1)
-||
-'000000000000F03F' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0A000000' -- SRID (int32 10)
-||
-'0100' -- width (uint16 1)
-||
-'0100' -- height (uint16 1)
-||
-'8B' -- first band type (64BF + ext flag)
-||
-'0000000000000000' -- novalue==0
-||
-'03' -- ext band num == 3
-||
-'2F746D702F742E74696600' -- "/tmp/t.tif"
-),
-(
-'00' -- big endian (uint8 xdr)
-||
-'0000' -- version (uint16 0)
-||
-'0001' -- nBands (uint16 1)
-||
-'3FF0000000000000' -- scaleX (float64 1)
-||
-'3FF0000000000000' -- scaleY (float64 1)
-||
-'0000000000000000' -- ipX (float64 0)
-||
-'0000000000000000' -- ipY (float64 0)
-||
-'0000000000000000' -- skewX (float64 0)
-||
-'0000000000000000' -- skewY (float64 0)
-||
-'0000000A' -- SRID (int32 10)
-||
-'0001' -- width (uint16 1)
-||
-'0001' -- height (uint16 1)
-||
-'8B' -- first band type (64BF)
-||
-'0000000000000000' -- novalue==0
-||
-'03' -- ext band num == 3
-||
-'2F746D702F742E74696600' -- "/tmp/t.tif"
-) );
-
-SELECT name,
- hexwkb_ndr::raster::text = hexwkb_ndr or hexwkb_ndr::raster::text = hexwkb_xdr as ndr_io,
- hexwkb_xdr::raster::text = hexwkb_ndr or hexwkb_xdr::raster::text = hexwkb_xdr as xdr_io
-FROM rt_test;
Added: spike/wktraster/rt_pg/test/io_expected
===================================================================
--- spike/wktraster/rt_pg/test/io_expected 2009-02-06 10:56:30 UTC (rev 3661)
+++ spike/wktraster/rt_pg/test/io_expected 2009-02-06 12:35:20 UTC (rev 3662)
@@ -0,0 +1,13 @@
+1x1 no bands, no transform|t|t
+1x1 single band (1BB) no transform|t|t
+1x1 single band (2BUI) no transform|t|t
+1x1 single band (4BUI) no transform|t|t
+1x1 single band (8BSI) no transform|t|t
+1x1 single band (8BUI) no transform|t|t
+1x1 single band (16BSI) no transform|t|t
+1x1 single band (16BUI) no transform|t|t
+1x1 single band (32BSI) no transform|t|t
+1x1 single band (32BUI) no transform|t|t
+1x1 single band (32BF) no transform|t|t
+1x1 single band (64BF) no transform|t|t
+1x1 single band (64BF external) no transform|t|t
Added: spike/wktraster/rt_pg/test/run_test.in
===================================================================
--- spike/wktraster/rt_pg/test/run_test.in 2009-02-06 10:56:30 UTC (rev 3661)
+++ spike/wktraster/rt_pg/test/run_test.in 2009-02-06 12:35:20 UTC (rev 3662)
@@ -0,0 +1,502 @@
+#!/bin/sh
+
+POSTGIS_SRC=@POSTGIS_SRC@
+DB=rtpostgis_reg
+DBENABLERS="${POSTGIS_SRC}/lwgeom/lwpostgis.sql ../rtpostgis.sql"
+SHP2PGSQL=../loader/shp2pgsql
+PGSQL2SHP=../loader/pgsql2shp
+
+###################################################
+#
+# Usage ./run_test <testname> [<testname>]
+#
+# Creates the spatial database '$DB'
+# Enables the spatial database with wktraster
+# functionality
+#
+# Runs the <testname>.sql script
+# Diffs output against <testname>_expected
+#
+###################################################
+
+PGOPTIONS="${PGOPTIONS} -c lc_messages=C"
+export PGOPTIONS
+
+PSQL="psql"
+
+if [ -z "$TMPDIR" ]; then
+ TMPDIR=/tmp/rtpgis_reg_$$
+fi
+
+mkdir -p ${TMPDIR}
+
+VERBOSE=0
+OPT_DROP=yes
+OPT_CREATE=yes
+
+if echo '\c' | grep c >/dev/null 2>&1; then
+ ECHO_N='echo -n'
+ ECHO_C=''
+else
+ ECHO_N='echo'
+ ECHO_C='\c'
+fi
+
+###################################################
+#
+# Helper functions
+#
+###################################################
+
+# Print a single dot
+show_progress()
+{
+ ${ECHO_N} ".${ECHO_C}"
+}
+
+#
+# fail <msg> <log>
+#
+fail ()
+{
+ _msg="$1"
+ _log="$2"
+
+ if [ -z "$_log" ]; then
+ echo " failed ($_msg)"
+ elif test "$VERBOSE" -eq "1"; then
+ echo " failed ($_msg: $_log)"
+ echo "-----------------------------------------------------------------------------"
+ cat $_log
+ echo "-----------------------------------------------------------------------------"
+ else
+ echo " failed ($_msg: $_log)"
+ fi
+
+ FAIL=`expr $FAIL + 1`
+}
+
+#
+# run_simple_test
+#
+# Run an sql script and compare results with the given expected output
+#
+# SQL input is ${TEST}.sql, expected output is {$TEST}_expected
+#
+run_simple_test ()
+{
+ _sql="$1"
+ _expected="$2"
+ if [ -n "$3" ]; then
+ _msg="$3: "
+ else
+ _msg=
+ fi
+
+ if [ ! -r "$_sql" ]; then
+ fail "can't read $_sql"
+ return 1
+ fi
+
+ if [ ! -r "$_expected" ]; then
+ fail "can't read $_expected"
+ return 1
+ fi
+
+ show_progress
+
+ OUTFILE="${TMPDIR}/test_${RUN}_out"
+ TMPFILE="${TMPDIR}/test_${RUN}_tmp"
+ DIFFILE="${TMPDIR}/test_${RUN}_diff"
+
+ # Use intermediate file to prevent MingW buffering problems
+ ${PSQL} -tA < "${_sql}" ${DB} > ${TMPFILE} 2>&1
+ cat ${TMPFILE} \
+ | grep -v "^$" \
+ | grep -v "^INSERT" \
+ | grep -v "^DELETE" \
+ | grep -v "^CONTEXT" \
+ | grep -v "^UPDATE" \
+ | grep -v "^DROP" \
+ | grep -v "^CREATE" \
+ | grep -v "^SET" \
+ | sed 's/Infinity/inf/g;s/Inf/inf/g;s/1\.#INF/inf/g' \
+ | sed 's/[eE]\([+-]\)0\{1,\}\([0-9]\{1,\}\)/e\1\2/g' \
+ | sed 's/Self-intersection .*/Self-intersection/' \
+ | sed 's/^ROLLBACK/COMMIT/' \
+ > "${OUTFILE}"
+ rm ${TMPFILE}
+
+ if diff -c "${_expected}" "${OUTFILE}" > ${DIFFILE}; then
+ #SUCCESS=`expr $SUCCESS + 1`
+ rm "${OUTFILE}" "${DIFFILE}" # we don't need these anymore
+ return 0
+ else
+ fail "${_msg}diff expected obtained" "${DIFFILE}"
+ #rm "${OUTFILE}" # diff is enough
+ return 1
+ fi
+}
+
+#
+# run_loader_test
+#
+# Load a shapefile with different methods, create a 'select *' SQL
+# test and run simple test with provided expected output.
+#
+# SHP input is ${TEST}.shp, expected output is {$TEST}_expected
+#
+run_loader_test ()
+{
+ _tblname=loadedshp
+
+ # ON_ERROR_STOP is used by psql to return non-0 on an error
+ _psql_opts="--variable ON_ERROR_STOP=true"
+
+ #echo "SELECT * from ${_tblname}" > ${TEST}.sql
+
+
+ #
+ # Run in HEXWKB insert mode
+ #
+
+ show_progress
+
+ ${SHP2PGSQL} ${TEST}.shp $_tblname \
+ > ${TMPDIR}/loader \
+ 2> ${TMPDIR}/loader.err
+
+ if [ $? -gt 0 ]; then
+ fail "running shp2pgsql" "${TMPDIR}/loader.err"
+ return 1
+
+ fi
+
+ show_progress
+
+ ${PSQL} -c "DROP table ${_tblname}" "${DB}" >> ${TMPDIR}/regress_log 2>&1
+ ${PSQL} ${_psql_opts} -f ${TMPDIR}/loader "${DB}" > ${TMPDIR}/loader.err 2>&1
+ if [ $? -gt 0 ]; then
+ fail "sourcing shp2pgsql output" "${TMPDIR}/loader.err"
+ return 1
+ fi
+
+ if [ -f "${TEST}-wkb.sql" ]; then
+ if run_simple_test ${TEST}-wkb.sql ${TEST}-wkb.expected "wkb insert"; then
+ :
+ else
+ return 1
+ fi
+ fi
+
+
+ #
+ # Run in HEXWKB dump mode
+ #
+
+ show_progress
+
+ ${SHP2PGSQL} -D ${TEST}.shp $_tblname \
+ > ${TMPDIR}/loader \
+ 2> ${TMPDIR}/loader.err
+
+ if [ $? -gt 0 ]; then
+ fail "running shp2pgsql -D" "${TMPDIR}/loader.err"
+ return 1
+
+ fi
+
+ show_progress
+
+ ${PSQL} -c "DROP table ${_tblname}" "${DB}" >> ${TMPDIR}/regress_log 2>&1
+ ${PSQL} ${_psql_opts} -f ${TMPDIR}/loader "${DB}" > ${TMPDIR}/loader.err 2>&1
+ if [ $? -gt 0 ]; then
+ fail "sourcing shp2pgsql -D output" "${TMPDIR}/loader.err"
+ return 1
+ fi
+
+ if [ -f "${TEST}-wkb.sql" ]; then
+ if run_simple_test ${TEST}-wkb.sql ${TEST}-wkb.expected "wkb dump"; then
+ :
+ else
+ return 1
+ fi
+ fi
+
+ ###########################################################
+ #
+ # Dump and compare.
+ # Do this using WKB mode, as WKT is unable to reproduce
+ # M values
+ #
+
+ show_progress
+
+ ${PGSQL2SHP} -f ${TMPDIR}/dumper ${DB} "${_tblname}" > "${TMPDIR}/dumper.err" 2>&1
+ if [ $? -gt 0 ]; then
+ fail "dumping loaded table" "${TMPDIR}/dumper.err"
+ return 1
+ fi
+
+ show_progress
+
+ if diff "${TMPDIR}"/dumper.shp "${TEST}".shp > /dev/null; then
+ :
+ else
+ ls -lL "${TMPDIR}"/dumper.shp "${TEST}".shp > "${TMPDIR}"/dumper.diff
+ fail "dumping loaded table" "${TMPDIR}/dumper.diff"
+ return 1
+ fi
+
+# I'm not sure it's safe to compare indexes
+# if diff "${TMPDIR}"/dumper.shx "${TEST}".shx; then
+# :
+# else
+# ls -lL "${TMPDIR}"/dumper.shx "${TEST}".shx > "${TMPDIR}"/dumper.diff
+# fail "dumping loaded table" "${TMPDIR}/dumper.diff"
+# return 1
+# fi
+
+# Change in attribute sizes would make this fail
+# if diff "${TMPDIR}"/dumper.dbf "${TEST}".dbf; then
+# :
+# else
+# ls -lL "${TMPDIR}"/dumper.dbf "${TEST}".dbf > "${TMPDIR}"/dumper.diff
+# fail "dumping loaded table" "${TMPDIR}/dumper.diff"
+# return 1
+# fi
+
+
+ #
+ # End of dump and compare.
+ #
+ ################################################
+
+ show_progress
+
+ ${SHP2PGSQL} -w ${TEST}.shp $_tblname \
+ > ${TMPDIR}/loader \
+ 2> ${TMPDIR}/loader.err
+
+ if [ $? -gt 0 ]; then
+ fail "running shp2pgsql -w" "${TMPDIR}/loader.err"
+ return 1
+ fi
+
+ show_progress
+
+ ${PSQL} -c "DROP table ${_tblname}" "${DB}" >> ${TMPDIR}/regress_log 2>&1
+ ${PSQL} ${_psql_opts} -f ${TMPDIR}/loader "${DB}" > ${TMPDIR}/loader.err 2>&1
+ if [ $? -gt 0 ]; then
+ fail "sourcing shp2pgsql -w output" "${TMPDIR}/loader.err"
+ return 1
+ fi
+
+ if [ -f "${TEST}-wkt.sql" ]; then
+ if run_simple_test ${TEST}-wkt.sql ${TEST}-wkt.expected "wkt insert"; then
+ :
+ else
+ return 1
+ fi
+ fi
+
+ #
+ # Run in WKT dump mode
+ #
+
+ show_progress
+
+ ${SHP2PGSQL} -D -w ${TEST}.shp $_tblname \
+ > ${TMPDIR}/loader \
+ 2> ${TMPDIR}/loader.err
+
+ if [ $? -gt 0 ]; then
+ fail "running shp2pgsql -D -w" "${TMPDIR}/loader.err"
+ return 1
+
+ fi
+
+ show_progress
+
+ ${PSQL} -c "DROP table ${_tblname}" "${DB}" >> ${TMPDIR}/regress_log 2>&1
+ ${PSQL} ${_psql_opts} -f ${TMPDIR}/loader "${DB}" > ${TMPDIR}/loader.err 2>&1
+ if [ $? -gt 0 ]; then
+ fail "sourcing shp2pgsql -D -w output" "${TMPDIR}/loader.err"
+ return 1
+ fi
+
+ if [ -f "${TEST}-wkt.sql" ]; then
+ if run_simple_test ${TEST}-wkt.sql ${TEST}-wkt.expected "wkt dump"; then
+ :
+ else
+ return 1
+ fi
+ fi
+
+ #rm ${TEST}.sql
+
+ return 0;
+}
+
+###################################################
+#
+# Parse command line opts
+#
+###################################################
+
+while [ -n "$1" ]; do
+
+ if test "$1" = "-v"; then
+ VERBOSE=1
+ shift
+ continue
+ elif test "$1" = "--nodrop"; then
+ OPT_DROP=no
+ shift
+ continue
+ elif test "$1" = "--nocreate"; then
+ OPT_CREATE=no
+ shift
+ continue
+ else
+ break
+ fi
+done
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 [-v] [--nocreate] [--nodrop] <test> [<test>]" >&2
+ exit 1
+fi
+
+###################################################
+#
+# Prepare the database
+#
+###################################################
+
+db_exists=`${PSQL} -l | grep -w ${DB}`
+
+if test -z "$db_exists"; then
+
+ if test x"$OPT_CREATE" = "xyes"; then
+ echo "Creating spatial db ${DB} "
+
+ createdb "${DB}" > ${TMPDIR}/regress_log
+ createlang plpgsql "${DB}" >> ${TMPDIR}/regress_log
+ for f in $DBENABLERS; do
+ ${PSQL} -f $f "${DB}" >> ${TMPDIR}/regress_log 2>&1
+ done
+ else
+
+ echo "Database ${DB} does not exist" >&2
+ echo "Run w/out the --nocreate flag to create it" >&2
+ exit 1
+ fi
+else
+ if test x"$OPT_CREATE" = "xyes"; then
+ echo "Database ${DB} already exist." >&2
+ echo "Run with the --nocreate flag to use it " \
+ "or drop it and try again." >&2
+ exit 1
+ else
+ echo "Using existing database ${DB}"
+ fi
+fi
+
+
+libver=`${PSQL} -tAc "select postgis_lib_version()" "${DB}"`
+
+if [ -z "$libver" ]; then
+ echo
+ echo " Something went wrong (no postgis installed in ${DB})."
+ if [ -z "$db_exists" ]; then
+ echo " For details, check ${TMPDIR}/regress_log"
+ else
+ echo " Try dropping the database, it will be recreated" \
+ " on next run."
+ fi
+ echo
+ exit 1
+fi
+
+###################################################
+#
+# Report runtime environment
+#
+###################################################
+
+geosver=`${PSQL} -tAc "select postgis_geos_version()" "${DB}"`
+projver=`${PSQL} -tAc "select postgis_proj_version()" "${DB}"`
+libbuilddate=`${PSQL} -tAc "select postgis_lib_build_date()" "${DB}"`
+pgsqlver=`${PSQL} -tAc "select version()" "${DB}"`
+
+echo "TMPDIR is ${TMPDIR}"
+
+echo
+echo " $pgsqlver"
+echo " Postgis $libver - $libbuilddate"
+if [ -n "$geosver" ]; then
+ echo " GEOS: $geosver"
+fi
+if [ -n "$projver" ]; then
+ echo " PROJ: $projver"
+fi
+
+###################################################
+#
+# Run the tests
+#
+###################################################
+
+echo
+echo "Running tests"
+echo
+
+RUN=0
+SKIP=0
+FAIL=0
+#SUCCESS=0
+while [ -n "$1" ]; do
+ TEST="$1"; shift;
+
+ # catch a common mistake (strip trailing .sql)
+ TEST=`echo "$TEST" | sed 's/\.sql$//'`
+
+ #printf %20s " ${TEST}"
+ #echo -ne " ${TEST}"
+ ${ECHO_N} " ${TEST}${ECHO_C}"
+
+ RUN=`expr $RUN + 1`
+
+ # Check .shp *before* .sql as loader test would
+ # create the .sql
+ if [ -r "${TEST}.shp" ]; then
+ if run_loader_test; then
+ echo " ok"
+ fi
+ elif [ -r "${TEST}.sql" ]; then
+ if run_simple_test ${TEST}.sql ${TEST}_expected; then
+ echo " ok"
+ fi
+ else
+ echo "Skipped (can't read ${TEST}.sql)"
+ SKIP=`expr $SKIP + 1`
+ continue
+ fi
+
+
+done
+
+echo
+echo "Run tests: $RUN"
+#echo "Skipped: $SKIP"
+#echo "Successful: $SUCCESS"
+echo "Failed: $FAIL"
+
+if test x"$OPT_DROP" = "xyes" -a x"$OPT_CREATE" = "xyes"; then
+ sleep 1
+ dropdb "${DB}" > /dev/null
+else
+ : echo "Drop database ${DB} manually"
+fi
+
More information about the postgis-commits
mailing list